Esanders has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/381754 )
Change subject: Follow-up I576f31: highlightQuery: Handle case when query is
not found
......................................................................
Follow-up I576f31: highlightQuery: Handle case when query is not found
Change-Id: If6afc383280455cd71bffc82b21a21647035a50a
---
M src/mixins/LabelElement.js
1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/54/381754/1
diff --git a/src/mixins/LabelElement.js b/src/mixins/LabelElement.js
index 0991d3d..d6136dd 100644
--- a/src/mixins/LabelElement.js
+++ b/src/mixins/LabelElement.js
@@ -66,13 +66,14 @@
* sub-string wrapped in highlighted span
*/
OO.ui.mixin.LabelElement.static.highlightQuery = function ( text, query,
compare ) {
- var i, offset, tLen, qLen,
+ var i, tLen, qLen,
+ offset = -1,
$result = $( '<span>' );
if ( compare ) {
tLen = text.length;
qLen = query.length;
- for ( i = 0; offset === undefined && i <= tLen - qLen; i++ ) {
+ for ( i = 0; offset === -1 && i <= tLen - qLen; i++ ) {
if ( compare( query, text.slice( i, i + qLen ) ) === 0
) {
offset = i;
}
--
To view, visit https://gerrit.wikimedia.org/r/381754
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If6afc383280455cd71bffc82b21a21647035a50a
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits