tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

observe-mathml.html (1691B)


      1 <!DOCTYPE HTML>
      2 <meta charset=utf-8>
      3 <title>Largest Contentful Paint: observe element rendered by MathML</title>
      4 <body>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="resources/largest-contentful-paint-helpers.js"></script>
      8 <style>
      9 mathml {
     10  font-size: 12px;
     11 }
     12 </style>
     13 <script>
     14  async_test(function (t) {
     15    assert_implements(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented");
     16    let beforeLoad;
     17    const observer = new PerformanceObserver(
     18      t.step_func_done(function(entryList) {
     19        assert_equals(entryList.getEntries().length, 1);
     20        const entry = entryList.getEntries()[0];
     21        assert_equals(entry.entryType, 'largest-contentful-paint');
     22        assert_greater_than_equal(entry.renderTime, beforeRender);
     23        assert_approx_equals(entry.startTime, entry.renderTime, 0.001,
     24          'startTime should be equal to renderTime to the precision of 1 millisecond.');
     25        assert_equals(entry.duration, 0);
     26        // Some lower bound: height of at least 12 px.
     27        // Width of at least 100 px.
     28        assert_greater_than(entry.size, 1200);
     29        assert_equals(entry.loadTime, 0);
     30        assert_equals(entry.id, 'mathml');
     31        assert_equals(entry.url, '');
     32        assert_equals(entry.element, document.getElementById('mathml'));
     33      })
     34    );
     35    observer.observe({type: 'largest-contentful-paint', buffered: true});
     36    beforeRender = performance.now();
     37  }, 'Element rendered by MathML is observable');
     38 </script>
     39 <math display="block">
     40  <mrow>
     41    <msup>
     42      <mi id="mathml">This is important text! :)</mi>
     43    </msup>
     44  </mrow>
     45 </math>
     46 </body>