Made sure that a child element exists before the check is done, fixes jQuery bug #3870.

This commit is contained in:
John Resig 2009-01-19 23:04:03 +00:00
parent 735d44f6df
commit 6799982835

View file

@ -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);
};