Resize event on DOM elements

Currently, only IE implements a resize event on DOM elements. Making this standard would address / help fix https://github.com/ajaxorg/ace/issues/2153, SVG element resize event, and many other headaches involving changes in content size.

4 Likes

I think this could use something similar to a matchMedia() query for element queries if/when that solidifies: http://responsiveimagescg.github.io/eq-usecases/

There is even an open issue which matches this:

This would certainly give far more fine grained control.

For what it’s worth, here is the Firefox issue, that I submitted over 3 years ago: https://bugzilla.mozilla.org/show_bug.cgi?id=701648

II believe blink layout engineers are against this for performance reasons. But they’re trying to enable the scenarios via “custom layout” as part of CSS Houdini.

Nope, Blink is for it. We discussed it in public with other browser vendors at the last Extensible Web meetup.

1 Like

When you say you discussed in public, do you mean you discussed it in person at a public meetup? Because, to the internet, “in person” discussions are private (unless they’re webcast and saved).

1 Like

Oh sorry - I stand corrected!

Not to be a troll or anything, but the lack of simple features like this one are why “native” developers that don’t like web tech don’t like web tech.

Then again, a “native” developer (who will manually ship an app that doesn’t run in the web anyway) could fork a browser and easily add this feature and then ship the browser as part of the app’s stack. :laughing:

But,

Blink is for it.

So, then hopefully this will be fixed soon?

What’s taking so long!

I suspect it is something about 5-10 years as usual. :slight_smile:

2 Likes

Implemented in Chrome Dev 54 behind experimental web platform features flag.

new ResizeObserver(callback).observe(element)

https://crbug.com/612962

3 Likes