diff --git a/xpfe/global/resources/content/nsWidgetStateManager.js b/xpfe/global/resources/content/nsWidgetStateManager.js index 35f826de3cc..8c68d2fd3e9 100644 --- a/xpfe/global/resources/content/nsWidgetStateManager.js +++ b/xpfe/global/resources/content/nsWidgetStateManager.js @@ -87,6 +87,8 @@ function nsWidgetStateManager ( aFrameID ) { get: wsm.get_Textbox, set: wsm.set_Textbox }, listitem: { get: wsm.get_Listitem, set: wsm.set_Listitem }, + data: + { get: wsm.get_Data, set: wsm.set_Data }, default_handler: { get: wsm.get_Default, set: wsm.set_Default } } @@ -198,7 +200,7 @@ nsWidgetStateManager.prototype = { if (property == "localname") continue; - if ( !aDataObject[property] ) + if ( !aDataObject[property] && typeof aDataObject[property] == "boolean") aElement.removeAttribute( property ); else aElement.setAttribute( property, aDataObject[property] ); @@ -365,6 +367,32 @@ nsWidgetStateManager.prototype = return null; }, + // + set_Data: + function ( aElementID, aDataObject ) + { + + var element = wsm.contentArea.document.getElementById( aElementID ); + wsm.generic_Set( element, aDataObject ); + if( 'value' in aDataObject ) + { + element.setAttribute("value", aDataObject.value); + } + }, + + get_Data: + function ( aElementID ) + { + var element = wsm.contentArea.document.getElementById( aElementID ); + var dataObject = wsm.generic_Get( element ); + if( dataObject ) + { + dataObject.value = element.getAttribute( "value" ); + return dataObject; + } + return null; + }, + // set_Default: function ( aElementID, aDataObject )