Details
-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
5.0.0, 4.22.6, 5.1.1, 5.2.0, 4.13.26, 4.20.13, 5.3.0
-
Severity 3 - Minor
-
Description
Issue Summary
This is reproducible on Data Center: yes
Steps to Reproduce
- Use any Jira / JSM instance that has Assets (Insight) enabled
- Open developer console.log and type "test".startsWith("est", 1)
Expected Results
It should return true
Actual Results
It returns false because Assets (Insight) code base is overriding the startsWith implementation with only one param
String.prototype.startsWith = function(str) { return this.indexOf(str) == 0; };
Workaround
If you are developing a plugin for an instance that has Assets (Insight) enabled and you want to use the string startsWith prototype with two params, you can
- Define separate startsWith the method to use rather than use the string prototype one.
- Or redefine the startsWith prototype with a proper polyfill that supports two params. This one will also be compatible with 1 param.
Â
String.prototype.startsWith = function(searchString, position) { position = position || 0; return this.indexOf(searchString, position) === position; };
Â