React: Missing onLoad and onError events on SVG <image> tag

Created on 8 Dec 2015  路  12Comments  路  Source: facebook/react

SVG <image> is supposed as far as I know to support at least the same onload and onerror events <img> supports.

From looking at React code the events are handled on specific elements in ReactDOMComponents.js in trapBubbledEventsLocal, mountComponent, unmountComponent.

It would be easy to create a pull request to add 'image' to these cases, but it seems that there is a separation between js files that handle DOM and SVG in the codebase that this might collide with.

Am I correct and there is more to it than just adding more cases? Or these functions are the right place to also handle SVG image?

Most helpful comment

I've commited PR which adds onLoad and onError events to SVG, but we are still missing few others like onUnload, onResize, onScroll, onZoom etc. Thank you @gaearon for mentioning correct file name.

All 12 comments

+1 to add this handler

+1

+1

If you鈥檙e interested in this, could you please send a PR? Yes I think ReactDOMComponent.js is the right place for this.

@gaearon I'm gonna try this.

I've commited PR which adds onLoad and onError events to SVG, but we are still missing few others like onUnload, onResize, onScroll, onZoom etc. Thank you @gaearon for mentioning correct file name.

<image /> load and error events were fixes here #9042

@mdogadailo that doesn't seem to have affected <svg /> load and error events...

@zabojad yes, but this ticket about <image /> tag, not about <svg /> element like in #9607

This was resolved by https://github.com/facebook/react/pull/9042/ 馃嵕

@aweary seems that onLoad event is not getting dispatched on IE11 (it is supported)

(Let's track that in https://github.com/facebook/react/issues/11058)

Was this page helpful?
0 / 5 - 0 ratings