Really simple: how do I most accurately test if a browser has support for a certain CSS selector?
I currently have some CSS code that makes the page a little more in
You could use querySelector:
function testSelector(selector, node){
var scope = document.createElement("div");
scope.appendChild(node);
try {
return scope.querySelector(selector) !== null;
} catch(e) { return false; }
}
You can test it like this:
var node = document.createElement("input");
node.type = 'checkbox';
node.checked = 'checked';
testSelector("input:checked", node); // === true
See this other question for more info on querySelector.