servo/tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet-constructable-duplicate.html

20 lines
761 B
HTML

<!doctype html>
<title>Cascade order of a stylesheet for duplicate sheets.</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="help" href="https://wicg.github.io/construct-stylesheets/">
<script src = '/resources/testharness.js'></script>
<script src = '/resources/testharnessreport.js'></script>
<div></div>
<script>
test(function() {
let sheets = [];
for (let i = 0; i < 2; ++i) {
sheets.push(new CSSStyleSheet());
sheets[i].replaceSync("div { z-index: " + i + " }");
}
document.adoptedStyleSheets = [sheets[1], sheets[0], sheets[1]];
assert_equals(getComputedStyle(document.querySelector("div")).zIndex, "1", "duplicate stylesheet should take right position in the cascade");
});
</script>