Friday, May 7, 2010

getAttribute("href",MAGIC_FLAG)

I have notice the cross-browser difference on
getAttribute("href"), value.href
long, long time ago,
but I hade no reasonable explanation nor workaround ;-(

Of course jQuery people already knew ;-)
// Check to see if an attribute returns normalized href attributes
div.innerHTML = "";
if (div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
div.firstChild.getAttribute("href") !== "#") {
Expr.attrHandle.href = function(elem) {
return elem.getAttribute("href", 2);
};
}
I have missed the RTFM step ?

http://msdn.microsoft.com/en-us/library/ms536429(VS.85).aspx

No comments:

Post a Comment