Skip to content

Commit 6fd052b

Browse files
committed
Blackberry 4.6 is capable of finding elements that are no longer in the DOM via getElementById. It only appears to happen when the node has been inside of a cloned Document Fragment. Fixes #6963.
1 parent cb74bd6 commit 6fd052b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sizzle.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,9 @@ var Expr = Sizzle.selectors = {
391391
ID: function(match, context, isXML){
392392
if ( typeof context.getElementById !== "undefined" && !isXML ) {
393393
var m = context.getElementById(match[1]);
394-
return m ? [m] : [];
394+
// Check parentNode to catch when Blackberry 4.6 returns
395+
// nodes that are no longer in the document #6963
396+
return m && m.parentNode ? [m] : [];
395397
}
396398
},
397399
NAME: function(match, context){

0 commit comments

Comments
 (0)