| <!DOCTYPE html><!-- webkit-test-runner [ ResizeObserverEnabled=true ] --> |
| <pre id="log">This tests observing an element with an ResizeObserver and removing the element from the document. |
| The element should become eligible for GC at some point. |
| <script src="../resources/gc.js"></script> |
| if (!window.testRunner || !window.internals) { |
| log.textContent += 'FAIL - This test requires internals'; |
| testRunner.waitUntilDone(); |
| initialNodeCount = internals.referencingNodeCount(document); |
| const resizeObserverCount = 100; |
| for (let i = 0; i < resizeObserverCount; ++i) |
| requestAnimationFrame(() => { |
| log.textContent += internals.referencingNodeCount(document) < initialNodeCount + resizeObserverCount * 0.95 ? 'PASS' : 'FAIL - Less than 20% of nodes were collected.' |
| function createResizeObserver() |
| const element = document.createElement('div'); |
| const resizeObserver = new ResizeObserver(() => { }).observe(element); |