prototype: Fix a bug in the simulated hasAttribute for IE due to getAttributeNode sometimes returning null.

This commit is contained in:
Sam Stephenson 2007-02-28 01:16:52 +00:00
parent 60bb0686ba
commit 94d8333448
2 changed files with 5 additions and 2 deletions

View File

@ -1,5 +1,7 @@
*SVN*
* Fix a bug in the simulated hasAttribute for IE due to getAttributeNode sometimes returning null. [sam]
* Optimize Element.getStyle and add new Element.getOpacity method. Special case IE and Opera getStyle methods. Closes #7648. [Tobie Langel, Thomas Fuchs]
* Optimize Element.setStyle and add new Element.setOpacity method, special case IE and Gecko opacity methods. Closes #7585. [savetheclocktower]

View File

@ -512,9 +512,10 @@ Object.extend(Element._attributeTranslations.values, {
Element.Methods.Simulated = {
hasAttribute: function(element, attribute) {
var t = Element._attributeTranslations;
var t = Element._attributeTranslations, node;
attribute = t.names[attribute] || attribute;
return $(element).getAttributeNode(attribute).specified;
node = $(element).getAttributeNode(attribute);
return node && node.specified;
}
};