summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/cssom/cssimportrule-parent.html
blob: 2792af69c0c7352812624cda9b4a6aa282d5aec8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!doctype html>
<title>CSSImportRule correctly unlinks its child stylesheet from its parent</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://drafts.csswg.org/cssom/#the-cssimportrule-interface">
<style>
  @import "data:text/css,:root{background:red}";
</style>
<script>
let t = async_test("@import stylesheet is properly unlinked from parent after removal");
window.onload = t.step_func_done(function() {
  let sheet = document.styleSheets[0];
  let childSheet = sheet.cssRules[0].styleSheet;
  assert_not_equals(childSheet, null, "@import rule should have a stylesheet");
  assert_equals(childSheet.parentStyleSheet, sheet, "@import rule should the correct parent");
  sheet.deleteRule(0);
  assert_equals(childSheet.parentStyleSheet, null, "@import rule should be correctly unlinked");
});
</script>