Allow unitless values for rootMargin in IntersectionObservers #1885

Closed
opened 1 year ago by Moonchild · 2 comments
Owner

As a follow-up to #1881 where we allow empty/whitespace strings to mean "0px" as rootMargin for IntersectionObservers, we end up with a confusing situation where "", "0" and 0 all mean 0px, but other unitless values are an error.
Contrary to what one expects, "0" is not treated as a value, but rather as an "allowed error that means 0", i.e.:

  • 0 = 0px
  • 1 = error
  • "0" = 0px
  • "1" = error
  • "" = 0px
  • " " = 0px
  • "1px" = 1px

Instead we should just accept unitless values (floats) as pixel values, so it will actually accept 0 1 "0" and "1" as actual values instead of this strange "sometimes but sometimes not".
The standard specification, if I read this correctly, equates unitless absolute dimensions as pixels everywhere, and these kinds of dimensions should be accepted by rootMargin.

As a follow-up to #1881 where we allow empty/whitespace strings to mean "0px" as rootMargin for IntersectionObservers, we end up with a confusing situation where "", "0" and 0 all mean 0px, but other unitless values are an error. Contrary to what one expects, "0" is not treated as a value, but rather as an "allowed error that means 0", i.e.: * 0 = 0px * 1 = error * "0" = 0px * "1" = error * "" = 0px * " " = 0px * "1px" = 1px Instead we should just accept unitless values (floats) as pixel values, so it will actually accept `0` `1` `"0"` and `"1"` as actual values instead of this strange "sometimes but sometimes not". The standard specification, if I read this correctly, equates unitless absolute dimensions as pixels everywhere, and these kinds of dimensions should be accepted by rootMargin.
Moonchild added this to the 31.0.0 milestone 1 year ago
Moonchild added the
DOM
Layout
Standards Compliance
labels 1 year ago
Moonchild self-assigned this 1 year ago
Poster
Owner

Test file with added ints and floats. Seems to be OK on the parser side.

Test file with added ints and floats. Seems to be OK on the parser side.
Moonchild closed this issue 1 year ago
Poster
Owner

Apparently Emilio is all over this one and the main antagonist to common sense.
https://bugzilla.mozilla.org/show_bug.cgi?id=1766163
Spec issue which has been alive for a long time but has been held off: https://github.com/w3c/IntersectionObserver/issues/244

Apparently Emilio is all over this one and the main antagonist to common sense. https://bugzilla.mozilla.org/show_bug.cgi?id=1766163 Spec issue which has been alive for a long time but has been held off: https://github.com/w3c/IntersectionObserver/issues/244
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: MoonchildProductions/UXP#1885
Loading…
There is no content yet.