Bug 72036 - Setting SVGResize event on outermost svg tag via script fails to work
Summary: Setting SVGResize event on outermost svg tag via script fails to work
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: http://code.google.com/p/chromium/iss...
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-10 11:08 PST by Joel Webber
Modified: 2022-06-17 21:05 PDT (History)
8 users (show)

See Also:


Attachments
Repro case (758 bytes, image/svg+xml)
2011-11-10 11:09 PST, Joel Webber
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joel Webber 2011-11-10 11:08:42 PST
(From the linked chromium bug)
- Open attached file.  One will see a javascript alert saying callback was added.
- Resize browser window. One should see a javascript alert saying resize event was detected.  However, Chrome does not do that.

There's a bit of a hack in SVGSVGElement::parseMappedAttribute() that grabs 'onresize', et al, attributes at parse time and punts them to the window object, which appears to be correct according to the spec (http://www.w3.org/TR/SVG/interact.html). But no such hack exists in SVGSVGElement::addEventListener() for SVGResize, et al, so svg.addEventListener() silently fails.
Comment 1 Joel Webber 2011-11-10 11:09:40 PST
Created attachment 114529 [details]
Repro case
Comment 2 Ahmad Saleem 2022-06-17 15:59:04 PDT
I am able to reproduce this bug in Safari 15.5 on macOS 12.4 and also across all other browsers as well. Where, on window resize, there is no 'resize event detected' triggered. **As long as actual results go based on Comment 01**

As confirmed in "Comment 01", it is happening in "Chrome" as well. Also from the URL< I can see that related Chrome bug is still Open and is not fixed as of Chrome Canary 105.

I even tried to look into source code of test case and it has listener on root element with "SVGResize" and also in Chrome bug, the latest test case has slight changed source code and with <script>, the event listener is changed from "SVGResize" to "Resize" but it is still "root" element.

Further, on this MDN - I am not able to find much about "resize" support across browser - https://developer.mozilla.org/en-US/docs/Web/API/SVGElement

I am not sure, which browser has ideal behavior or whether the test case is even valid or not. Whether it should be on VisualViewport? Can someone please confirm and retest it or it is something not implemented yet at all - as a result, it is failing silently? Thanks!
Comment 3 Ryosuke Niwa 2022-06-17 21:05:56 PDT
All browsers match the behavior here so it's unclear that we want to do this. Closing as invalid for now.