From 6c38d842544159d2334f2252c9015c737d5046b0 Mon Sep 17 00:00:00 2001 From: Juriy Zaytsev Date: Wed, 25 Mar 2009 01:19:28 -0400 Subject: [PATCH] Revert Opera title fix --- CHANGELOG | 2 -- src/dom/dom.js | 20 +++++++------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3b99dd2..87afc76 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,3 @@ -* Use feature testing in `Element#readAttribute` when taking care of Opera's `getAttribute('title')` quirk. (kangax) - * Use `Prototype.emptyFunction` consistently throughout unit tests. [#253 state:resolved] (Michael M Slusarz, John David Dalton, kangax) * deprecation extension: mark Array#reduce() as removed. [#569 state:resolved] (Tobie Langel) diff --git a/src/dom/dom.js b/src/dom/dom.js index 60804ba..137c822 100644 --- a/src/dom/dom.js +++ b/src/dom/dom.js @@ -609,16 +609,6 @@ Element.Methods = { return isBuggy; })(); - // Opera 9.25 returns `null` instead of "" for getAttribute('title') - // when `title` attribute is empty - var GET_ATTRIBUTE_TITLE_RETURNS_NULL = (function(){ - var el = document.createElement('div'); - el.title = ''; - var isBuggy = (el.getAttribute('title') === null); - el = null; - return isBuggy; - })(); - return function(element, name) { element = $(element); // check boolean first, to get out of expression faster @@ -627,9 +617,6 @@ Element.Methods = { element.tagName.toUpperCase() == 'IFRAME') { return element.getAttribute('type'); } - if (GET_ATTRIBUTE_TITLE_RETURNS_NULL && name === 'title') { - return element.title; - } if (Prototype.Browser.IE) { var t = Element._attributeTranslations.read; if (t.values[name]) return t.values[name](element, name); @@ -1243,6 +1230,13 @@ if (Prototype.Browser.Opera) { } } ); + + Element.Methods.readAttribute = Element.Methods.readAttribute.wrap( + function(proceed, element, attribute) { + if (attribute === 'title') return element.title; + return proceed(element, attribute); + } + ); } else if (Prototype.Browser.IE) {