Closed lebnic closed 3 years ago
FYI @philipwalton
Marked as non substantive for IPR from ash-nazg.
This only fixes the polyfill, not the specification, right? What's the point of that?
Documentation states that [rootMargin] Can have values similar to the CSS margin property
(ref: https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)
Thus, one would expect, for exemple, a value of rootMargin: "200px 0 0"
to be valid. However, current implementation will throw an error, because only 0px
or 0%
are valid offsets, but not 0
.
Hence this PR.
Moreover, there has been an open issue (https://github.com/w3c/IntersectionObserver/issues/244) since 2017 for this particular use-case, so I thought that maybe my proposed changes would be beneficial to others. If not, I guess we could simply write rootMargin: "200px 0px 0px"
and move on with our lives. Anyways, thanks for the review @emilio , and let me know if there is anything else I can clarify
Well, my point is that:
Documentation, right now, is wrong. https://w3c.github.io/IntersectionObserver/#parse-a-root-margin disallows 0
. It also disallows calc()
/ min()
/ max()
/ viewport units and other relative units that you can use in the margin
shorthand (some of them for very good reason, it's not clear what em
would do here for example!).
You're changing a polyfill that doesn't have anything to do with any browser implementation. If you want browsers to change, first you need to change the spec (which is in this repo, and is in the index.bs
file), then you need to change browsers (filing bugs in the relevant bug trackers).
So changing the polyfill without changing the specification and at the very least filing browser bugs and adding tests to wpt seems a bit odd / not useful.
Well, my point is that:
- Documentation, right now, is wrong. https://w3c.github.io/IntersectionObserver/#parse-a-root-margin disallows
0
. It also disallowscalc()
/min()
/max()
/ viewport units and other relative units that you can use in themargin
shorthand (some of them for very good reason, it's not clear whatem
would do here for example!).- You're changing a polyfill that doesn't have anything to do with any browser implementation. If you want browsers to change, first you need to change the spec (which is in this repo, and is in the
index.bs
file), then you need to change browsers (filing bugs in the relevant bug trackers).So changing the polyfill without changing the specification and at the very least filing browser bugs and adding tests to wpt seems a bit odd / not useful.
You are 100% right, my bad.
Closes #244
The following tasks have been completed:
Implementation commitment: