| Nicolás Peña Moreno | bb603cc | 2019-04-04 15:03:43 | [diff] [blame^] | 1 | <!DOCTYPE HTML> |
| 2 | <meta charset=utf-8> |
| 3 | <title>Element Timing: observe element with background image</title> |
| 4 | <body> |
| 5 | <style> |
| 6 | body { |
| 7 | margin: 0; |
| 8 | } |
| 9 | #target { |
| 10 | width: 100px; |
| 11 | height: 50px; |
| 12 | background-image: url('/images/black-rectangle.png'); |
| 13 | } |
| 14 | </style> |
| 15 | <script src="/resources/testharness.js"></script> |
| 16 | <script src="/resources/testharnessreport.js"></script> |
| 17 | <script src="resources/element-timing-helpers.js"></script> |
| 18 | <script> |
| 19 | let beforeRender = performance.now(); |
| 20 | async_test(function (t) { |
| 21 | const observer = new PerformanceObserver( |
| 22 | t.step_func_done(function(entryList) { |
| 23 | assert_equals(entryList.getEntries().length, 1); |
| 24 | const entry = entryList.getEntries()[0]; |
| 25 | const index = window.location.href.lastIndexOf('/'); |
| 26 | const pathname = window.location.href.substring(0, index - 14) + |
| 27 | 'images/black-rectangle.png'; |
| 28 | checkElement(entry, pathname, 'my_div', 'target', beforeRender); |
| 29 | checkRect(entry, [0, 100, 0, 50]); |
| 30 | checkNaturalSize(entry, 100, 50); |
| 31 | }) |
| 32 | ); |
| 33 | observer.observe({entryTypes: ['element']}); |
| 34 | }, 'Element with elementtiming attribute and background image is observable.'); |
| 35 | </script> |
| 36 | <div id='target' elementtiming='my_div'></div> |
| 37 | </body> |