Changeset 13343

Show
Ignore:
Timestamp:
04/17/08 01:56:15 (7 months ago)
Author:
wolfram
Message:

+ optimized refs#6461 as of Bill's suggestion, thx

Files:
1 modified

Legend:

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

    r13340 r13343  
    649649                        //              highlights the first occurence found. Override this method 
    650650                        //              to implement your custom highlighing. 
    651                         var pos = label.toLowerCase().indexOf(this._lastInput.toLowerCase()); 
    652                         if (pos!=-1) { 
    653                                 var l = this._lastInput.length; 
    654                                 var e = this._escapeHtml; 
    655                                 return e(label.substr(0, pos)) + '<span class="dijitComboBoxHighlightMatch">' + 
    656                                                 e(label.substr(pos, l)) + '</span>' + e(label.substr(pos+l)); 
    657                         } 
    658                         return label; 
     651                        return this._escapeHtml(label).replace( 
     652                                new RegExp("("+ this._escapeHtml(this._lastInput) +")", "i"), 
     653                                '<span class="dijitComboBoxHighlightMatch">$1</span>'); 
     654                        // returns String, (almost) valid HTML (entities encoded) 
    659655                }, 
    660656