jsxtools / cqfill

Polyfill for CSS Container Queries
402 stars 4 forks source link

Added support for multiple containers #14

Open Blazsoul opened 2 years ago

Blazsoul commented 2 years ago

From what i have noticed the layoutContainerSet variable is being cleared on each mutation and therefore it has only one container element, I just removed the clear command so it will add all the containers to the set, It seems to function properly with multiple containers on the same page now.

What do you think ?

jonathantneal commented 2 years ago

I like it, @Blazsoul. After if (!doesMatchAllElements) {}, should there be something like this, to clear containers that no longer match?

if (!doesMatchAllElements) { /* ... */ } else {
  for (const element of elements) {
    layoutContainerSet.delete(element)
  }
}
DEfusion commented 2 years ago

I've just hit this issue too and this PR fixes my issue also

Blazsoul commented 2 years ago

@jonathantneal I tried to add this piece of code but then it's just blows up all of the responsiveness functionality

Blazsoul commented 2 years ago

any update ? @jonathantneal