This tests that querySelector, querySelectorAll and matchesSelector (webkitMatchesSelector) don't crash when used in a viewless document. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". PASS testDoc.querySelector('p') is p1 PASS testDoc.querySelectorAll('span').length is 2 PASS testDoc.querySelectorAll('span').item(1) is s2 PASS testDoc.querySelector('.d1') is d1 PASS testDoc.querySelectorAll('p span').length is 1 PASS p1.webkitMatchesSelector('p') is true PASS s1.webkitMatchesSelector('p span') is true PASS s2.webkitMatchesSelector('#s2') is true PASS d1.webkitMatchesSelector('.d1') is true PASS successfullyParsed is true TEST COMPLETE