From 5630369f42a444f2cad908b36484fa11610949db Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Tue, 5 Feb 2008 03:35:04 +0000 Subject: [PATCH] prototype: Make Prototype tagName comparisons XHTML-compliant. Closes #11012, #11013, #11014. --- CHANGELOG | 2 ++ src/dom.js | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0c30302..6bcc971 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Make Prototype tagName comparisons XHTML-compliant. Closes #11012, #11013, #11014. [cfis, Tobie Langel] + * Avoid breaking Element.prototype in browsers which support it. Closes #11004. [cfis, Tobie Langel] * Prevent Element#cumulativeOffset, Element#getOffsetParent, Element#positionedOffset, Element#viewportOffset and Element#clonePosition from throwing an error in IE when called on a parent-less element. Closes #9416, #10192, #10248. [ronstoney, psiborg, kangax] diff --git a/src/dom.js b/src/dom.js index 936b408..a2c3862 100644 --- a/src/dom.js +++ b/src/dom.js @@ -518,7 +518,7 @@ Element.Methods = { valueL += element.offsetLeft || 0; element = element.offsetParent; if (element) { - if (element.tagName == 'BODY') break; + if (element.tagName.toUpperCase() == 'BODY') break; var p = Element.getStyle(element, 'position'); if (p !== 'static') break; } @@ -603,7 +603,7 @@ Element.Methods = { element = forElement; do { - if (!Prototype.Browser.Opera || element.tagName == 'BODY') { + if (!Prototype.Browser.Opera || element.tagName.toUpperCase() == 'BODY') { valueT -= element.scrollTop || 0; valueL -= element.scrollLeft || 0; } @@ -903,7 +903,7 @@ else if (Prototype.Browser.WebKit) { (value < 0.00001) ? 0 : value; if (value == 1) - if(element.tagName == 'IMG' && element.width) { + if(element.tagName.toUpperCase() == 'IMG' && element.width) { element.width++; element.width--; } else try { var n = document.createTextNode(' '); @@ -1060,7 +1060,7 @@ Element.extend = (function() { element.nodeType != 1 || element == window) return element; var methods = Object.clone(Methods), - tagName = element.tagName, property, value; + tagName = element.tagName.toUpperCase(), property, value; // extend methods for specific tags if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);