| 651 | | var rx = new RegExp("("+this._lastInput+")", "i"); |
| 652 | | return label.replace(rx, '<span class="dijitComboBoxHighlightMatch">$1</span>'); |
| | 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; |
| | 659 | }, |
| | 660 | |
| | 661 | _escapeHtml:function(/*string*/str){ |
| | 662 | // TODO Should become dojo.html.entities(), when exists use instead |
| | 663 | // summary: |
| | 664 | // Adds escape sequences for special characters in XML: &<>"' |
| | 665 | str = String(str).replace(/&/gm, "&").replace(/</gm, "<") |
| | 666 | .replace(/>/gm, ">").replace(/"/gm, """); |
| | 667 | return str; // string |