Changeset 10541

Show
Ignore:
Timestamp:
09/17/07 20:49:19 (14 months ago)
Author:
bill
Message:

Simplify attributeMap code and remove disabling for everything except Textarea
(which causes an exception on Safari). Refs #3058.

Location:
dijit/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/form/Textarea.js

    r10527 r10541  
    99        dijit.form._FormWidget, 
    1010{ 
     11        // TODO: set this up to work correctly 
     12        attributeMap: {}, 
     13 
    1114        // summary 
    1215        //      A textarea that resizes vertically to contain the data. 
  • dijit/trunk/_Widget.js

    r10532 r10541  
    108108                this.buildRendering(); 
    109109 
    110                 // Copy attributes listed in attributeMap into the newly created DOM for the widget 
    111                 // The placement of these attributes is according to the property mapping in attributeMap 
     110                // Copy attributes listed in attributeMap into the [newly created] DOM for the widget. 
     111                // The placement of these attributes is according to the property mapping in attributeMap. 
    112112                // Note special handling for 'style' and 'class' attributes which are lists and can 
    113113                // have elements from both old and new structures, and some attributes like "type" 
    114114                // cannot be processed this way as they are not mutable. 
    115  
    116 //KLUDGE: skip the widgets which aren't yet working.  See #3058 
    117 if(!/dijit\.form\.(Slider|Textarea|ComboBox|FilteringSelect)/.test(this.declaredClass)) 
    118  
    119                 for(var attr in this.attributeMap){ 
    120                         if(this.domNode){ 
     115                if(this.domNode){ 
     116                        for(var attr in this.attributeMap){ 
    121117                                var mapNode = this[this.attributeMap[attr] || "domNode"]; 
    122118                                var value = this[attr]; 
    123119                                if(value !== "" || (params && params[attr])){ 
    124                                         var domValue = mapNode.getAttribute(attr); 
    125                                         // Deal with IE quirks for 'class' and 'style' 
    126120                                        switch(attr){ 
    127121                                        case "class": 
    128                                                 domValue = mapNode.className; 
     122                                                mapNode.className += " " + value; 
    129123                                                break; 
    130124                                        case "style": 
    131                                                 domValue = domValue && domValue.cssText; // FIXME: Opera 
    132                                         } 
    133                                         if(domValue){ 
    134                                                 var delim = {style: ";", "class": " "}[attr]; 
    135                                                 // style and class attributes are special and contain lists 
    136                                                 // which need to be combined 
    137                                                 if(delim && value){ 
    138                                                         value += delim + domValue; 
    139                                                 }else{ 
    140                                                         value = domValue; 
    141                                                 } 
    142                                         } 
    143  
    144                                         // Deal with IE quirks for 'class' and 'style' 
    145                                         switch(attr){ 
    146                                         case "class": 
    147                                                 mapNode.className = value; 
     125                                                mapNode.style.cssText += "; " + value;// FIXME: Opera 
    148126                                                break; 
    149                                         case "style": 
    150                                                 if(mapNode.style && dojo.isObject(mapNode.style)){ 
    151                                                         mapNode.style.cssText = value; // required for IE, doesn't work in Opera 
    152                                                         break; 
    153                                                 } 
    154                                                 // fallthrough... 
    155127                                        default: 
    156128                                                mapNode.setAttribute(attr, value);