From 94d83334488b80e69ff1cc0811d56e8c22f2449b Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Wed, 28 Feb 2007 01:16:52 +0000 Subject: [PATCH] prototype: Fix a bug in the simulated hasAttribute for IE due to getAttributeNode sometimes returning null. --- CHANGELOG | 2 ++ src/dom.js | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9d70cbe..60a3c6e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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] diff --git a/src/dom.js b/src/dom.js index ab5b069..6168877 100644 --- a/src/dom.js +++ b/src/dom.js @@ -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; } };