Skip to content

Commit

Permalink
Made sure that a child element exists before the check is done, fixes…
Browse files Browse the repository at this point in the history
… jQuery bug #3870.
  • Loading branch information
jeresig committed Jan 19, 2009
1 parent 735d44f commit 6799982
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/selector.js
Expand Up @@ -700,7 +700,7 @@ try {

// Check to see if an attribute returns normalized href attributes
div.innerHTML = "<a href='#'></a>";
if ( div.firstChild.getAttribute("href") !== "#" ) {
if ( div.firstChild && div.firstChild.getAttribute("href") !== "#" ) {
Expr.attrHandle.href = function(elem){
return elem.getAttribute("href", 2);
};
Expand Down

0 comments on commit 6799982

Please sign in to comment.