This test makes sure that :scope works correctly. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". PASS scope.querySelectorAll("ul a").length is 1 PASS scope.querySelector("ul a") is scope.firstChild PASS scope.querySelectorAll(":scope ul a").length is 0 PASS scope.querySelector(":scope ul a") is null PASS document.querySelectorAll(":scope ul a").length is 2 PASS document.querySelectorAll(":root ul a").length is 2 PASS document.querySelectorAll(":scope a").length is 2 PASS scope.querySelectorAll(":scope a").length is 1 PASS scope.querySelectorAll(":scope a").item(0) is scope.firstChild PASS scope.querySelector(":scope a") is scope.querySelectorAll(":scope a").item(0) PASS successfullyParsed is true TEST COMPLETE abc def efg