Test for cssText of ':host-context()' rule. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". PASS document.getElementById('style1').sheet.cssRules.item(0).cssText is ".foo:host-context(body.mytheme) > div { display: block; }" PASS document.getElementById('style1').sheet.cssRules.item(1).cssText is ":host-context(*) { display: block; }" PASS document.getElementById('style-invalid').sheet.cssRules.length is 0 PASS successfullyParsed is true TEST COMPLETE