Re: Resolving URIs in shadow trees

Cameron,
I think the general answer is that:

(1) SVG is a fully dynamic language. The processing model is that with each 
clock tick the entire document is re-evaluated, including all URL 
references. Of course, there are all sorts of implementation optimization 
opportunities so that you don't have to re-evaluate and redraw everything 
with each tick.

(2) All URL references, including both attributes such as xlink:href and 
properties such as clip-path="url(#CP1)", are resolved according to the 
xml:base recommendation and various relevant RFCs.The most current SVG spec 
that discusses xml:base and the relevant RFCs is the SVG-t 1.2 spec at 
http://www.w3.org/TR/SVGMobile12/linking.html#xlinkRefAttrs.

(3) SVG fragment identifiers, such as xlink:href="#foo" and 
clip-path="url(#CP1)", rely on ID referencing, which in SVG translates into 
evaluation of fragment identifiers. I am not sure that the SVG spec says 
this anywhere, but I think everyone would agree that ID referencing within 
fragment identifiers are processed by 
currentElement.ownerDocument.getElementById(), except for sXBL shadow 
trees, where you call getElementById() on the relevant <shadowTree> element 
that is the root of the shadow tree.

I haven't run through your six cases yet, however.

Jon

At 12:25 AM 8/2/2005, Cameron McCormack wrote:

>I may have overlooked this, but I'm not sure what the rules are for
>resolving URIs within shadow trees.  For example:
>
>   <svg ...>
>     <clipPath id="CP1"/>
>     <text id="T1"/>
>     <sbl:xbl>
>       <xbl:definition element="ex:test">
>         <xbl:template>
>           <clipPath id="CP2"/>
>           <text id="T2"/>
>           <g id="G1" clip-path="url(#CP1)"/>
>           <g id="G2" clip-path="url(#CP2)"/>
>           <use xlink:href="#T1"/>
>           <use xlink:href="#T2"/>
>         </xbl:template>
>         <xbl:handlerGroup>
>           <handler ev:event="xbl:bound">
>             var CP3 = document.createElementNS(SVGNS, "clipPath");
>             CP3.id = "CP3";
>
>             var G3 = document.createElementNS(SVGNS, "g");
>             G3.id = "G3";
>             G3.setAttributeNS(null, "clip-path", "url(#CP3)");
>
>             var T3 = document.createElementNS(SVGNS, "text");
>             T3.id = "T3";
>
>             var U3 = document.createElementNS(SVGNS, "use");
>             U3.id = "U3";
>             U3.setAttributeNS(XLINKNS, "xlink:href", "#T3");
>
>             evt.xblShadowTree.appendChild(CP3);
>             evt.xblShadowTree.appendChild(G3);
>             evt.xblShadowTree.appendChild(T3);
>             evt.xblShadowTree.appendChild(U3);
>           </handler>
>         </xbl:handlerGroup>
>       </dbl:definition>
>     </xbl:xbl>
>   </svg>
>
>There are six cases for URI referencing here that I can see:
>
>   referer       referent        reference type  defined where
>   -------       --------        --------------  -------------
>   G1            CP1             CSS url()       document scope
>   G2            CP2             CSS url()       document scope AND shadow 
> tree
>   G3            CP3             CSS url()       shadow tree
>   U1            T1              xlink:href      document scope
>   U2            T2              xlink:href      document scope AND shadow 
> tree
>   U3            T3              xlink:href      shadow tree
>
>So my questions are:
>
>   - Does G1's clip-path property resolve to CP1 in the document level
>     scope or null?
>   - Does G2's clip-path property resolve to the CP2 in the shadow tree,
>     the CP2 in the document (the child of the xbl:template element)
>     or null?
>   - Does G3's clip-path property resolve to CP3 in the shadow tree or
>     null?
>
>and those same questions again substituting "T" for "CP", "href" for
>"clip-path" and "U" for "G".
>
>Thanks,
>
>Cameron
>
>--
>   e-mail : cam (at) mcc.id.au           icq : 26955922
>      web : http://mcc.id.au/            msn : cam-msn (at) aka.mcc.id.au
>   office : +61399055779              jabber : heycam (at) jabber.org

Received on Tuesday, 2 August 2005 09:01:50 UTC