marcj / css-element-queries

CSS Element-Queries aka Container Queries. High-speed element dimension/media queries in valid css.
http://marcj.github.io/css-element-queries/
MIT License
4.27k stars 487 forks source link

ResizeSensor kills performance when meets with a Window type #303

Open kergekacsa opened 3 years ago

kergekacsa commented 3 years ago

Hi there!

I've found an infinit loop in this line: (at https://github.com/marcj/css-element-queries/blob/master/src/ResizeSensor.js#L239 ) var invisible = element.offsetWidth === 0 && element.offsetHeight === 0;

The problem is that Windows types doesn't have offsetWidth/offsetHeight, so it's basically redraw the whole layout again and again. It would be a nice touch if in case os a Window type if could use a little smarter check for invisibility. I've think something like this: https://gist.github.com/danbrianwhite/bcdd7fbd6d775a4e0dc0

What do you think?