Mglaser has uploaded a new change for review.
https://gerrit.wikimedia.org/r/263833
Change subject: Restored startsWith / endsWith functionality
......................................................................
Restored startsWith / endsWith functionality
After switching to exact identity comparison, startsWith and endsWith
were broken when using regexes. This lead to breaking our VisualEditor.
Now changed to JS string functions. Tested with VE, works again.
Change-Id: I393eb9315cc97e1d44a70fd6e3cfa67c7b3d4fcb
---
M resources/bluespice/bluespice.string.js
1 file changed, 3 insertions(+), 2 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation
refs/changes/33/263833/1
diff --git a/resources/bluespice/bluespice.string.js
b/resources/bluespice/bluespice.string.js
index 27f178b..edf5bfb 100644
--- a/resources/bluespice/bluespice.string.js
+++ b/resources/bluespice/bluespice.string.js
@@ -13,12 +13,13 @@
return newString;
};
+// taken from
http://stackoverflow.com/questions/646628/how-to-check-if-a-string-startswith-another-string
String.prototype.startsWith = function ( startString ) {
- return ( this.match( "^" + startString ) === startString );
+ return this.slice( 0, startString.length ) === startString;
};
String.prototype.endsWith = function ( endString ) {
- return ( this.match( endString + "$" ) === endString );
+ return endString === '' || this.slice( -endString.length ) ===
endString;
};
String.prototype.format = function () {
--
To view, visit https://gerrit.wikimedia.org/r/263833
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I393eb9315cc97e1d44a70fd6e3cfa67c7b3d4fcb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Mglaser <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits