| <!DOCTYPE html> |
| <meta name="viewport" content="width=device-width,initial-scale=1"> |
| <link rel="author" href="mailto:[email protected]" title="Emilio Cobos Álvarez"> |
| <link rel="author" href="https://mozilla.org" title="Mozilla"> |
| <link rel="help" href="https://w3c.github.io/IntersectionObserver/#dom-intersectionobserverentry-intersectionratio"> |
| <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1581876"> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <style> |
| block { |
| display: block; |
| width: 50vw; |
| height: 50vh; |
| background: green; |
| } |
| </style> |
| <inline> |
| <block></block> |
| </inline> |
| <script> |
| promise_test(async function() { |
| for (let element of document.querySelectorAll("inline, block")) { |
| let entries = await new Promise(resolve => { |
| new IntersectionObserver(resolve).observe(element); |
| }); |
| assert_equals(entries.length, 1, element.nodeName + ": Should get an entry"); |
| assert_true(entries[0].isIntersecting, element.nodeName + ": Should be intersecting"); |
| assert_equals(entries[0].intersectionRatio, 1, element.nodeName + ": Should be fully intersecting"); |
| } |
| }, "IntersectionObserver on an IB split gets the right intersection ratio"); |
| </script> |