update to DOM2 compatibility - use localName instead of tagName and nodeName

This commit is contained in:
alecf%netscape.com 2000-06-07 05:49:08 +00:00
parent 5a025ab964
commit 9cc2ab1266
3 changed files with 11 additions and 11 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;