Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ricardobeat/450086 to your computer and use it in GitHub Desktop.
Save ricardobeat/450086 to your computer and use it in GitHub Desktop.
function testAttributeSupport() {
var head = document.getElementsByTagName('head')[0];
var style = document.createElement('style');
var s = 'div[id] {}';
style.type = 'text/css';
if (style.styleSheet)
style.styleSheet.cssText = s;
else
style.appendChild( document.createTextNode(s) );
head.appendChild( style );
s = style.sheet || style.styleSheet;
s = (s.rules || s.cssRules)[0];
return (s.selectorText || s.cssText).toLowerCase() == 'div[id]';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment