[css-value] Fragment URLs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[css-value] Fragment URLs

Ku(顧思捷)CJ

Hi,
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.

It's helpful if we can have clear definition of how resolving local-ref of an anonymous clones element.

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

Reply | Threaded
Open this post in threaded view
|

Re: [css-value] Fragment URLs

Chris Lilley



On 2016-07-05 21:02, Ku(顧思捷)CJ wrote:

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

This is defined in RFC 3986 (for all urls, not just for ones in SVG).
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.
Yes.

Reference Resolution

This section defines the process of resolving a URI reference within a context that allows relative references https://tools.ietf.org/html/rfc3986#section-5

-- 
Chris Lilley
@svgeesus
Technical Director, W3C Interaction Domain