Closed Bug 1738791 Opened 2 years ago Closed 2 years ago

(intersection-observer) Chrome allows an empty string for rootMargin, Firefox throws an exception, breaking some shopping sites.

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

RESOLVED FIXED
96 Branch
Webcompat Priority P1
Tracking Status
firefox96 --- fixed

People

(Reporter: twisniewski, Assigned: emilio)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

Chrome apparently allows passing in an empty string as rootMargin, while Firefox throws this exception:

DOMException: IntersectionObserver constructor: rootMargin must be specified in pixels or percent.

This is breaking at least two shopping site pages completely, as they rely on the same (or very similar) scripts from https://*.b2w.io/catalog-statics/js/:

The spec seems clear that with zero tokens we should just fall back to the default: https://w3c.github.io/IntersectionObserver/#parse-a-root-margin

Astounding if there's no test for this.

Flags: needinfo?(emilio)
Assignee: nobody → emilio
Status: NEW → ASSIGNED
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f8c0561be4db
Treat empty root margin as zero as per spec. r=AlaskanEmily
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d66bfd00b545
Treat empty root margin as zero as per spec. r=AlaskanEmily
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch

FYI FF96 docs work for this can be tracked in https://github.com/mdn/content/issues/10854#issuecomment-987580613 . This is mostly just a release note and addition of a note to the browser compatibility data.

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