Closed Bug 1766163 Opened 3 years ago Closed 3 years ago

(intersection-observer) Firefox doesn't accept unitless rootMargin

Categories

(Core :: Layout, defect)

defect

Tracking

()

RESOLVED INVALID

People

(Reporter: mark, Unassigned)

References

Details

Firefox doesn't accept unitless rootMargin attributes when creating intersection observers.
Unlike any other dimension values where unitless numbers default to the equivalent number of pixels, Firefox instead throws an error.
Confusingly, passing an empty string "" or just whitespace is accepted as meaning "0px", but "0" isn't. This seems to be terribly inconsistent and prone to breakage.

This is the same across browsers afaict, and is per spec. The spec issue is https://github.com/w3c/IntersectionObserver/issues/244

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID

Well, it seems to be clear to me that the spec needs to change then.
It's madness that "" = 0px, but "0" != 0px and throws. Either empty strings need to also be throwing, or unit-less dimensions need to be accepted just like for margin.

You need to log in before you can comment on or make changes to this bug.