Element-currentCSSZoom.html (1436B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>Element.currentCSSZoom</title> 4 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 5 <link rel="author" title="Mozilla" href="https://mozilla.org"> 6 <link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-currentcsszoom"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <div id="unzoomed"> 10 <div id="unzoomedChild"></div> 11 </div> 12 <div style="zoom: 2" id="outer"> 13 <div style="zoom: 2" id="inner"> 14 <div id="renderedChild"></div> 15 <div style="display: none" id="nonRenderedChild"></div> 16 </div> 17 </div> 18 <script> 19 test(() => { 20 assert_equals(unzoomed.currentCSSZoom, 1, "Unzoomed content"); 21 assert_equals(outer.currentCSSZoom, 2, "Zoomed content"); 22 assert_equals(inner.currentCSSZoom, 4, "Effective zoom gets multiplied properly"); 23 assert_equals(renderedChild.currentCSSZoom, 4, "Effective zoom gets propagated to children"); 24 assert_equals(nonRenderedChild.currentCSSZoom, 1, "Non-rendered elements return 1 for currentCSSZoom"); 25 }, "Element.currentCSSZoom basic test"); 26 27 test(() => { 28 unzoomed.style.zoom = 2; 29 assert_equals(unzoomed.currentCSSZoom, 2, "currentCSSZoom reacts to style changes"); 30 assert_equals(unzoomedChild.currentCSSZoom, 2, "currentCSSZoom propagates to descendants after style changes"); 31 }, "Element.currentCSSZoom reacts to style changes"); 32 </script>