Open
Bug 620002
Opened 14 years ago
Updated 2 years ago
Support SVG 2 event model (dispatch load rather than SVGLoad etc)
Categories
(Core :: DOM: Events, enhancement, P3)
Core
DOM: Events
Tracking
()
NEW
People
(Reporter: heycam, Unassigned)
References
(Blocks 1 open bug, )
Details
(Keywords: dev-doc-needed)
Attachments
(2 files, 1 obsolete file)
(deleted),
image/svg+xml
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review |
The spec says to dispatch a non-bubbling SVGLoad event: http://www.w3.org/TR/SVG/interact.html#LoadEvent
Comment 1•14 years ago
|
||
I'm pretty sure we only fire the 'load' event for <svg> elements right now.
This was discussed a bit in bug 552938 (and I think that's where we dropped it for other elements (?)). See in particular bug 552938 Comment 27 and bug 552938 Comment 28.
Blocks: 552938
Reporter | ||
Comment 2•14 years ago
|
||
For some reason I thought that even HTML <img> elements get a load even dispatched, so that listening for it on SVG <image> wouldn't that crazy. If our view is that load shouldn't dispatch anywhere except on the root element of a document, then that's fine.
Comment 3•14 years ago
|
||
html images do get an onload so svg images should get the SVG equivalent. I think this needs to be an exception to our svg only rule.
Component: SVG → HTML: Parser
QA Contact: general → parser
Reporter | ||
Comment 4•14 years ago
|
||
OK, great. As much as possible I'd like SVG's load event dispatching to be consistent with HTML's.
Updated•14 years ago
|
Component: HTML: Parser → DOM: Events
QA Contact: parser → events
Comment 5•14 years ago
|
||
Assignee: nobody → longsonr
Attachment #498597 -
Flags: review?(jonas)
Comment 6•14 years ago
|
||
Could this break some existing content?
Should we perhaps dispatch both SVGLoad and load for now, and ask
SVG WG to drop SVGLoad eventually?
Comment 7•14 years ago
|
||
If you do <image onload="something()" .../> with an SVG image, nothing happens at the moment. The only other way to trigger something is addEventListener isn't it? So something doing addEventListener might change. Dispatching both seems reasonable to me.
We should ask the SVG WG to drop most of the SVG events. http://www.w3.org/TR/SVG/interact.html#SVGEvents
SVGAbort and SVGError should go too and maybe others.
Comment 8•14 years ago
|
||
(In reply to comment #7)
> If you do <image onload="something()" .../> with an SVG image, nothing happens
> at the moment.
Oh. I thought onload was supported in svg:img.
Comment 9•14 years ago
|
||
It is, just not by us.
I'd be in favor of just dispatching 'load' for now.
Comment 10•14 years ago
|
||
We do have some special handling in
http://mxr.mozilla.org/mozilla-central/source/content/events/src/nsEventListenerManager.cpp#982
Comment 11•14 years ago
|
||
I think dispatching both events is the lowest risk option at this point. Converting to just onload risks us not doing the right think like having the correct bubbling and canceling properties.
Attachment #498597 -
Attachment is obsolete: true
Attachment #498620 -
Flags: review?(Olli.Pettay)
Attachment #498597 -
Flags: review?(jonas)
Updated•14 years ago
|
Attachment #498620 -
Flags: review?(jwatt)
Comment 12•14 years ago
|
||
I really don't want to dispatch SVGXxx events that we don't already dispatch. It will just make it harder to remove the SVGXxx event crap from the spec, and we'll have to live with it and dispatching two events forever. For the most part people will be using 'onload' and 'onerror' attributes and not checking the event name, so I think us using 'load' and 'error' is the better road.
Comment 13•14 years ago
|
||
We're already dispatching an SVGLoad event for the outer SVG element. If I remove the code that converts the SVGLoad event to call the onload handler then I'd have to dispatch an ordinary load event to the outer SVG. I'm not sure what the consequences of that would be and I'd be very hesitant therefore to make such a change.
Comment 14•14 years ago
|
||
The other alternative is to give up on this for 4.0
Comment 15•14 years ago
|
||
Or option c) dispatch load and SVGLoad but only dispatch error and not SVGError just remove the SVGError conversion.
Reporter | ||
Comment 16•14 years ago
|
||
How about just dispatching load to <image>, making <image onload=""> trigger off that, and don't do anything to support addEventListener for SVGLoad? That gets us part of the way to where we want to be and makes the test pass. (None of the SVG 1.1 test suite tests currently use addEventListener to listen for any of the SVG* events.)
Comment 17•14 years ago
|
||
I don't think I can implement that without changing the outer SVG element SVGLoad to be load too.
I think doing nothing here would be a better option than dispatching SVGLoad in more cases.
Let's go to the group ASAP and try to get agreement to drop the unnecessary SVG* events, then implement that post-FF4. How does that sound?
Comment 19•14 years ago
|
||
Comment on attachment 498620 [details] [diff] [review]
dispatch both events and support onerror too
Doing nothing is always an option :-)
Attachment #498620 -
Flags: review?(jwatt)
Attachment #498620 -
Flags: review?(Olli.Pettay)
Updated•14 years ago
|
Assignee: longsonr → nobody
Comment 20•12 years ago
|
||
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #18)
> I think doing nothing here would be a better option than dispatching SVGLoad
> in more cases.
>
> Let's go to the group ASAP and try to get agreement to drop the unnecessary
> SVG* events, then implement that post-FF4. How does that sound?
Has this happened?
Comment 21•12 years ago
|
||
I raised it - http://lists.w3.org/Archives/Public/www-svg/2011Oct/0046.html. I don't think anything happened though.
Reporter | ||
Comment 22•12 years ago
|
||
Once I get to reviewing/rewriting the Interaction chapter in SVG 2, I'll bring this up again. I've added a note to the chapter to remind myself.
Comment 23•11 years ago
|
||
maybe this bug should be morphed into converting SVGxxx events to SVG 2/html events i.e.
OnSVGLoad becomes onload, same for onunload, onresize and onscroll.
onerror and onabort have been done in bug 500261 already as we never fired SVGError events.
Reporter | ||
Comment 24•11 years ago
|
||
(In reply to Robert Longson from comment #23)
> maybe this bug should be morphed into converting SVGxxx events to SVG 2/html
> events i.e.
>
> OnSVGLoad becomes onload, same for onunload, onresize and onscroll.
Sounds fine to me.
Updated•11 years ago
|
Summary: SVG <image> elements should dispatch a load event → Support SVG 2 event model (dispatch load rather than SVGLoad etc)
Updated•9 years ago
|
Updated•6 years ago
|
Priority: -- → P3
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•