[Webkit-unassigned] [Bug 44227] Event of a Use element points to SVGElementInstance
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Mar 1 06:03:14 PST 2012
https://bugs.webkit.org/show_bug.cgi?id=44227
--- Comment #1 from Nikolas Zimmermann <zimmermann at kde.org> 2012-03-01 06:03:15 PST ---
(In reply to comment #0)
> Created an attachment (id=64802)
--> (https://bugs.webkit.org/attachment.cgi?id=64802&action=review) [details]
> Test case
>
> (actually tested with Safari 5 on Windows and Epiphany 2.30 on Linux)
>
> Set an event listener on a Use element, for example like this:
> <use id="useElement" onclick="alert(evt.target.toString())"
> xlink:href="#sourceElement" />
>
> The reported target object should be [object SVGUseElement]
> That would result in evt.target.id="useElement"
An SVGUseElement is never clickable, it's the sourceElement it referenced, which gets clicked - so its SVGELementInstance receives the event.
Opera handles the testcase the same way, only SVGElementInstances receive events.
Quoting SVG 1.1:
If event attributes are assigned to referenced elements, then the actual target for the event will be the SVGElementInstance object within the "instance tree" corresponding to the given referenced element.
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. The event's target and currentTarget attributes are set to the SVGElementInstance that corresponds to the target and current target elements in the referenced subtree. An event propagates through the exposed and non-exposed portions of the tree in the same manner as it would in the regular document tree: first going from the root element to the ‘use’ element and then through non-exposed tree elements in the capture phase, followed by the target phase at the target of the event, then bubbling back through non-exposed tree to the use element and then back through regular tree to the root element in bubbling phase.
--
There's no way you could click a SVGUseElement, except sending such an event to the <use> element manually via dispatchEvent - in that case the target would be SVGUseElement.
> The Attachment is a test file with several different constellations of <use> elements and event listener attachments. All of them end up with [object SVGElementInstance], even if the event attribute is on a parent element of the <use>.
Try in Opera, it's the same there.
Do you agree that we can close this bug?
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list