Re: The intersection of scripting and the use element

On 11/7/10 10:52 PM, G. Wade Johnson wrote:
> 3. "The effect of a ‘use’ element is as if the contents of the
>     referenced element were deeply cloned into a separate non-exposed DOM
>     tree which had the ‘use’ element as its parent and all of the ‘use’
>     element's ancestors as its higher-level ancestors."
>
> This statement does not make any distinctions about the kinds of
> elements copied. It is conceivable "the contents of the referenced
> element" would apply to script elements included within a referenced
> 'g' element.

Note that when a <script> element that has already run is cloned by a 
browser the clone is marked with a "do not execute" flag...

> 4. "The event handling for the non-exposed tree works as if the
>     referenced element had been textually included as a deeply cloned
>     child of the ‘use’ element, except that events are dispatched to the
>     SVGElementInstance objects."
>
> Now this could imply that at least event handling attributes are
> have the appropriate scripting copied from the reference. However,
> experimentation suggests that the copied hander references scripting
> from the referencing document, not the referenced document. This seems
> somewhat counter-intuitive.

It's consistent with them being cloned and then inserted, no?

> Does anyone know what the intent of the 'use' element with respect to
> referenced scripting is? Whichever way this should be interpreted, the
> specification should probably be more clear on this point.

It really sounds like you're looking for something more like XBL than 
<use> elements...

-Boris

Received on Monday, 8 November 2010 04:11:20 UTC