| 651 | | return this._escapeHtml(label).replace( |
| 652 | | // Add greedy when this.highlightMatch=="all" |
| 653 | | new RegExp("("+ this._escapeHtml(this._lastInput) +")", "i"+(this.highlightMatch=="all"?"g":"")), |
| 654 | | '<span class="dijitComboBoxHighlightMatch">$1</span>'); |
| 655 | | // returns String, (almost) valid HTML (entities encoded) |
| | 651 | var find = this._escapeHtml(this._lastInput); |
| | 652 | // Add greedy when this.highlightMatch=="all" |
| | 653 | var modifiers = "i"+(this.highlightMatch=="all"?"g":""); |
| | 654 | var escapedLabel = this._escapeHtml(label); |
| | 655 | ret = escapedLabel.replace(new RegExp("^("+ find +")", modifiers), |
| | 656 | '<span class="dijitComboBoxHighlightMatch">$1</span>'); |
| | 657 | if (escapedLabel==ret){ // Nothing replaced, try to replace at word boundaries. |
| | 658 | ret = escapedLabel.replace(new RegExp(" ("+ find +")", modifiers), |
| | 659 | ' <span class="dijitComboBoxHighlightMatch">$1</span>'); |
| | 660 | } |
| | 661 | return ret;// returns String, (almost) valid HTML (entities encoded) |