Skip to content

Commit

Permalink
Make sure disconnectedMatch test isn't done iff no matchesSelector im…
Browse files Browse the repository at this point in the history
…plementation exists.
  • Loading branch information
jeresig committed Mar 25, 2011
1 parent 0625079 commit f12b930
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions sizzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -1202,23 +1202,23 @@ if ( document.querySelectorAll ) {

(function(){
var html = document.documentElement,
matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
pseudoWorks = false,
matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;

if ( matches ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9 fails this)
disconnectedMatch = !matches.call( document.createElement( "div" ), "div" );
var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
pseudoWorks = false;

try {
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" );
try {
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" );

} catch( pseudoError ) {
pseudoWorks = true;
}
} catch( pseudoError ) {
pseudoWorks = true;
}

if ( matches ) {
Sizzle.matchesSelector = function( node, expr ) {
// Make sure that attribute selectors are quoted
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
Expand Down

0 comments on commit f12b930

Please sign in to comment.