From 9cc2ab1266f6b097c67881d82f429f2c97140656 Mon Sep 17 00:00:00 2001 From: "alecf%netscape.com" Date: Wed, 7 Jun 2000 05:49:08 +0000 Subject: [PATCH] update to DOM2 compatibility - use localName instead of tagName and nodeName --- xpfe/global/resources/content/dialogOverlay.js | 2 +- .../resources/content/nsWidgetStateManager.js | 6 +++--- .../global/resources/content/widgetStateManager.js | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/xpfe/global/resources/content/dialogOverlay.js b/xpfe/global/resources/content/dialogOverlay.js index b44476ffebef..ffd56836c332 100644 --- a/xpfe/global/resources/content/dialogOverlay.js +++ b/xpfe/global/resources/content/dialogOverlay.js @@ -19,7 +19,7 @@ function doOKButton() { var v = document.commandDispatcher.focusedElement; - if (v && v.tagName == 'TEXTAREA') + if (v && v.localName.toLowerCase() == 'textarea') return; var close = true; diff --git a/xpfe/global/resources/content/nsWidgetStateManager.js b/xpfe/global/resources/content/nsWidgetStateManager.js index 717299e26524..b5cc0e782d5d 100644 --- a/xpfe/global/resources/content/nsWidgetStateManager.js +++ b/xpfe/global/resources/content/nsWidgetStateManager.js @@ -128,12 +128,12 @@ nsWidgetStateManager.prototype = for( var i = 0; i < elements.length; i++ ) { var elementID = elements[i].id; - var elementType = elements[i].nodeName; + var elementType = elements[i].localName; if (!this.dataManager.pageData[aPageTag]) this.dataManager.pageData[aPageTag] = []; this.dataManager.pageData[aPageTag][elementID] = []; // persist element Type - this.dataManager.pageData[aPageTag][elementID].nodeName = elementType; + this.dataManager.pageData[aPageTag][elementID].localName = elementType; // persist attributes var get_Func = this.handlers[elementType] != undefined ? this.handlers[elementType].get : @@ -157,7 +157,7 @@ nsWidgetStateManager.prototype = var element = this.contentArea.document.getElementById( elementID ); if( element ) { - var elementType = element.nodeName; + var elementType = element.localName; var set_Func = this.handlers[elementType] != undefined ? this.handlers[elementType].set : this.handlers.default_handler.set; diff --git a/xpfe/global/resources/content/widgetStateManager.js b/xpfe/global/resources/content/widgetStateManager.js index a6b580c341bc..242cf1247c72 100644 --- a/xpfe/global/resources/content/widgetStateManager.js +++ b/xpfe/global/resources/content/widgetStateManager.js @@ -110,7 +110,7 @@ function WSM_SavePageData( currentPageTag, optAttributes, exclElements, inclElem else elementEntry.excluded = true; - if( formElement.nodeName.toLowerCase() == "select" ) { // select & combo + if( formElement.localName.toLowerCase() == "select" ) { // select & combo /* commenting out until select fields work properly, or someone tells me how to do this (also, is it better to store .value, or .text?):*/ if( formElement.getAttribute("multiple") ) { @@ -157,7 +157,7 @@ function WSM_SavePageData( currentPageTag, optAttributes, exclElements, inclElem this.AddAttributes( formElement, elementEntry, "value", optAttributes ); // generic elementEntry.id = formElement.id; - elementEntry.nodeName = formElement.nodeName; + elementEntry.localName = formElement.localName; // save the type attribute on the element if one is present elementEntry.elType = ( formElement.type ) ? formElement.type : null; } @@ -210,7 +210,7 @@ function WSM_SetPageData( currentPageTag, hasExtraAttributes ) } // default "value" attributes - if( formElement && formElement.nodeName.toLowerCase() == "input" ) { + if( formElement && formElement.localName.toLowerCase() == "input" ) { if( formElement.type.toLowerCase() == "checkbox" || formElement.type.toLowerCase() == "radio" ) { if( value == undefined ) @@ -246,7 +246,7 @@ function WSM_SetPageData( currentPageTag, hasExtraAttributes ) formElement.value = value; } } - else if( formElement && formElement.nodeName.toLowerCase() == "select" ) { + else if( formElement && formElement.localName.toLowerCase() == "select" ) { /* commenting this out until select widgets work properly */ if( formElement.getAttribute("multiple") && typeof(value) == "object" ) { @@ -270,7 +270,7 @@ function WSM_SetPageData( currentPageTag, hasExtraAttributes ) } } } - else if( formElement && formElement.nodeName.toLowerCase() == "textarea" ) + else if( formElement && formElement.localName.toLowerCase() == "textarea" ) formElement.value = value; } } @@ -372,7 +372,7 @@ function WSM_AddAttributes( formElement, elementEntry, valueAttribute, optAttrib /** string ElementIsIgnored( DOMElement element, StringArray exclElements ) ; * - purpose: check to see if the current element is one of the ignored elements * - in: element - element to check, - * - exclElements - array of string ignored attribute nodeNames; + * - exclElements - array of string ignored attribute localNames; * - out: boolean if element is ignored (true) or not (false); **/ function WSM_ElementIsIgnored( element, exclElements ) @@ -380,7 +380,7 @@ function WSM_ElementIsIgnored( element, exclElements ) if (!exclElements) return false; for( var i = 0; i < exclElements.length; i++ ) { - if( element.nodeName.toLowerCase() == exclElements[i] ) + if( element.localName.toLowerCase() == exclElements[i] ) return true; } return false;