Skip to content

[css-value] Fragment URLs #274

Closed
Closed
@CJKu

Description

@CJKu

https://lists.w3.org/Archives/Public/www-style/2016Jul/0025.html

While implementing fragment urls[1] inside gecko, I have come across a
behavior which can not find definition on the spec.

When a SVG use element[2] references to a graphic element(located in
another document) with a local-ref url. By referring behavior on most
modern browsers, I think the correct behavior is to resolve the local-ref
url by base of the referenced document.

Here is an example: ref-external.svg uses a rect in ref-resource.svg
ref-external.svg

<svg>
  <!-- draw in blue -->
  <linearGradient id="grad1 ">
    <stop offset="0.0" stop-color="blue"/>
  </linearGradient>

  <use xlink:href="ref-resource.svg#myrect">
</svg>

ref-resource.svg

<svg>
  <!-- draw in red -->
  <linearGradient id="grad1 ">
    <stop offset="0.0" stop-color="red"/>
  </linearGradient>

  <rect id="myrect" x="200" y="125" width="200" height="125" stroke="none"
fill="url(#grad1)" />
</svg>

While rendering ref-external.svg, I would expect(can be wrong) seeing a
red rectangle on the screen, since url(#radialGrad1) will be resolved as
http://.../ref-source.svg#grad1
not
http://.../ref-external.svg#grad1.

Have clear definition of how resolving local-ref of
an anonymous clones element is super useful.

[1] https://drafts.csswg.org/css-values/#local-urls
[2] https://svgwg.org/svg2-draft/struct.html#UseElement

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions