The boolean logic in steps 2-3 of "run the update intersection
observations steps" was incorrect. The code used || between the two
negated skip conditions instead of &&, and the first sub-expression
had its negation inverted.
This caused intersection geometry to be computed (and callbacks fired)
for targets that are not descendants of an explicit element root,
as long as they spatially overlapped the root's bounding rect.
The spec says:
- Step 2: Skip if root is not implicit AND target not in same document.
- Step 3: Skip if root is Element AND target not descendant of root.
The enter condition is NOT(skip2) AND NOT(skip3), but we had
NOT(skip2) OR NOT(skip3) with a wrong negation in the first part.
Add tests verifying behavior when an IntersectionObserver has an
explicit element root:
- A target that is a descendant of the root should be reported as
intersecting when it overlaps the root.
- A target that is NOT a descendant of the root but spatially overlaps
it should NOT be reported as intersecting per spec step 3 of "run
the update intersection observations steps". The expected output
currently reflects the wrong (buggy) behavior.