Skip to content

Instantly share code, notes, and snippets.

@fabiomcosta
Created February 20, 2011 20:02
Show Gist options
  • Save fabiomcosta/836246 to your computer and use it in GitHub Desktop.
Save fabiomcosta/836246 to your computer and use it in GitHub Desktop.
msMatchesSelector errors on unattached nodes
// live demo: http://jsbin.com/oxuri5/9
var div = document.createElement('div');
div.setAttribute('attr', 'test');
console.log(div.msMatchesSelector('[attr="test"]'), ' should be true');
console.log(div.msMatchesSelector('[attr^="test"]'), ' should be true');
console.log(div.msMatchesSelector('[attr$="test"]'), ' should be true');
document.body.appendChild(div);
console.log(div.msMatchesSelector('[attr="test"]'), ' should be true');
console.log(div.msMatchesSelector('[attr^="test"]'), ' should be true');
console.log(div.msMatchesSelector('[attr$="test"]'), ' should be true');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment