[csswg-drafts] [resize-observer] Which box information should we pass to the callback

gregwhitworth has just created a new issue for https://github.com/w3c/csswg-drafts:

== [resize-observer] Which box information should we pass to the callback ==
We now allow authors to determine which box(es) they wish to observe on layout changes. Now we need to discuss which boxes we provide the information on. We have a few options:

Take the following example: If the author sets `content-box` and `border-box` to be observed, which box dimensions would you expect to receive passed to your callback?

1. The box(es) that were requested to be observed: so in the example above, `content-box` and `border-box` information
2. They receive all available CSS boxes that are observable: They will receive `border-box`, `content-box`, `scroll-box` dimensions.

**Option 1 Pros** is good because it makes sense that I requested a specific set of boxes to be observed and those are the ones that you returned information on.

**Option 1 Cons** If the sets the observer to the `border-box` but desires to know something about an inner box, they may request it in some other manner causing us to do additional work which defeats the purpose of this API altogether.

**Option 2 Pros** You can set one observation and get information about all of the boxes, so if you have a scenario in which you want to observe the border box but check the content or scroll box - this is possible without having to observe them.

**Option 2 Cons** It clutters up the response, if I only care about the `border-box` but I get results for every other box this may be a nuisance.

My personal opinion is to go with option 2 as I think people will either over observe to get the potential rects they care about or will ask for them in some other manner. That said, I don't have a strong opinion about this as I think it will be user preference. I have a [twitter poll](https://twitter.com/gregwhitworth/status/1062954297757904898) going about this in hopes of crowd sourcing some thoughts from web devs.



Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3329 using your GitHub account

Received on Friday, 16 November 2018 06:17:04 UTC