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