test_custom_content_inheritance.html (841B)
1 <!doctype html> 2 <title>Test for custom content inheritance</title> 3 <style> 4 html { color: red !important; } 5 </style> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <script> 8 onload = function() { 9 let doc = SpecialPowers.wrap(document); 10 let div = doc.createElement('div'); 11 div.id = "test-id"; 12 ok(!!doc.insertAnonymousContent, 13 "Must have the insertAnonymousContent API"); 14 let content = doc.insertAnonymousContent(); 15 ok(!!content, "Must have anon content"); 16 content.root.appendChild(div); 17 let color = SpecialPowers.wrap(window).getComputedStyle(div).color; 18 ok(!!color, "Should be able to get a color"); 19 isnot(color, getComputedStyle(document.documentElement).color, 20 "Custom anon content shouldn't inherit from the root element"); 21 SimpleTest.finish(); 22 }; 23 SimpleTest.waitForExplicitFinish(); 24 </script>