Robert Vogel has submitted this change and it was merged.
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(-)
Approvals:
Robert Vogel: Looks good to me, approved
jenkins-bot: Verified
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: merged
Gerrit-Change-Id: I393eb9315cc97e1d44a70fd6e3cfa67c7b3d4fcb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Mglaser <[email protected]>
Gerrit-Reviewer: Dvogel hallowelt <[email protected]>
Gerrit-Reviewer: Ljonka <[email protected]>
Gerrit-Reviewer: Pwirth <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits