Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!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>
<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>