Ticket #6262: 6262.patch

File 6262.patch, 5.1 kB (added by doughays, 10 months ago)

Move onresize code from _Spinner to ValidationTextBox?? and allow for inherited font to change. Add some font family/size tests to help verify correct function.

  • form/_Spinner.js

     
    9595                        this._connects.push(dijit.typematic.addListener(this.upArrowNode, this.textbox, {keyCode:dojo.keys.UP_ARROW,ctrlKey:false,altKey:false,shiftKey:false}, this, "_typematicCallback", this.timeoutChangeRate, this.defaultTimeout)); 
    9696                        this._connects.push(dijit.typematic.addListener(this.downArrowNode, this.textbox, {keyCode:dojo.keys.DOWN_ARROW,ctrlKey:false,altKey:false,shiftKey:false}, this, "_typematicCallback", this.timeoutChangeRate, this.defaultTimeout)); 
    9797                        if(dojo.isIE){ 
    98                                 // When spinner is moved from hidden to visible, call _setStateClass to remind IE to render it. (#6123) 
    99                                 var _this = this; 
    100                                 this.connect(this.domNode, "onresize",  
    101                                         function(){ setTimeout(dojo.hitch(_this, 
    102                                                 function(){ 
    103                                                         // cause the IE expressions to rerun 
    104                                                         this.upArrowNode.style.behavior = ''; 
    105                                                         this.downArrowNode.style.behavior = ''; 
    106                                                         // cause IE to rerender 
    107                                                         this._setStateClass(); 
    108                                                 }), 0); 
    109                                         } 
    110                                 ); 
     98                                this._IEbehaviors.push(this.upArrowNode); 
     99                                this._IEbehaviors.push(this.downArrowNode); 
    111100                        } 
    112101                } 
    113102}); 
  • form/ValidationTextBox.js

     
    155155                        if(this.invalidMessage == "$_unset_$"){ this.invalidMessage = this.messages.invalidMessage; } 
    156156                        var p = this.regExpGen(this.constraints); 
    157157                        this.regExp = p; 
     158                }, 
     159 
     160                postCreate: function(){ 
     161                        this.inherited(arguments); 
     162                        if(dojo.isIE){ 
     163                                // When moved from hidden to visible, call _setStateClass to remind IE to render it. (#6123) 
     164                                var _this = this; 
     165                                this._IEbehaviors = [this.textbox]; 
     166                                this.connect(this.domNode, "onresize",  
     167                                        function(){ setTimeout(dojo.hitch(_this, 
     168                                                function(){ 
     169                                                        // cause the IE expressions to rerun 
     170                                                        for (i=0; i < this._IEbehaviors.length; i++){ 
     171                                                                this._IEbehaviors[i].style.behavior=''; 
     172                                                        } 
     173                                                        // cause IE to rerender 
     174                                                        this._setStateClass(); 
     175                                                }), 0); 
     176                                        } 
     177                                ); 
     178                        } 
    158179                } 
    159180        } 
    160181); 
  • tests/form/test_Spinner.html

     
    4040                <br> 
    4141                <br> 
    4242                initial value=1000, delta=10, min=9 max=1550<br> 
    43                 <label for="integerspinner2">Spinbox with custom styling (width=50%, 200% Courier font): </label> 
     43                <label for="integerspinner2">Spinbox with custom styling (width=25%, <span style="font-size:200%;font-family:Courier;">200% Courier font</span>): </label> 
    4444                <input dojoType="dijit.form.NumberSpinner" 
    45                         style="font-size:200%;font-family:Courier;border:1px solid blue;width:50%;" 
     45                        style="font-size:200%;font-family:Courier;border:1px solid blue;width:50%;width:25%;" 
    4646                        value="1000" 
    4747                        smallDelta="10" 
    4848                        constraints="{min:9,max:1550,places:0}" 
  • tests/form/test_validate.html

     
    9090                                <span class="noticeMessage"> NumberTextBox class, <b>tabIndex=1</b>, Attributes: {trim: true}, no initial value specified, tooltipPosition=[above, below]</span> 
    9191                        </div> 
    9292                        <div class="testExample"> 
     93                                <span style="font-family:Courier;font-size:150%;">150% Courier: 
    9394                                <input id="q03" type="text" name="age" tabIndex=1 
    9495                                        dojoType="dijit.form.NumberTextBox" 
    9596                                        promptMessage="(optional) Enter an age between 0 and 120" 
     
    9899                                        constraints="{places:0,min:0,max:120}" 
    99100                                        onChange="console.debug('onChange fired for widget id = ' + this.id + ' with value = ' + arguments[0]);" 
    100101                                        tooltipPosition="above, below" 
    101                                         /> 
     102                                        /></span> 
    102103                        </div> 
    103104 
    104105                        <div class="dojoTitlePaneLabel"> 
  • themes/dijit.css

     
    4343        font-family: inherit; /* trigger pseudo font-family inheritance */ 
    4444        behavior: expression( /* if the font-family = inherit, then get the parent's font-family */ 
    4545                function(self){ 
    46                         var cs, e;  
    4746                        try{ 
    48                                 if(self.currentStyle.fontFamily=='inherit'){ 
    49                                         cs = self.parentNode.currentStyle || document.documentElement.currentStyle; 
     47                                if(self.currentStyle.fontFamily=='inherit' || self.fontFamily=='inherit'){ 
     48                                        self.fontFamily = self.currentStyle.fontFamily; 
     49                                        var cs = self.parentNode.currentStyle || document.documentElement.currentStyle; 
    5050                                        self.style.fontFamily = cs.fontFamily; 
    5151                                } 
    5252                                self.style.behavior = null; /* #5562: prevent re-eval of css expression */ 
     
    14831483.dj_ie .dijitSpinner .dijitInputLayoutContainer .dijitArrowButton { 
    14841484        behavior: expression( 
    14851485                function(self){ 
    1486                         var e;  
    14871486                        try{ 
    14881487                                var h = self.parentNode.offsetHeight/2; 
    14891488                                if(h > 1){