Uploaded image for project: 'Jira Service Management Data Center'
  1. Jira Service Management Data Center
  2. JSDSERVER-12026

Calling String.prototype.startsWith with position params does not work with installed Assets (Insight)

      Issue Summary

      This is reproducible on Data Center: yes

      Steps to Reproduce

      1. Use any Jira / JSM instance that has Assets (Insight) enabled
      2. 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;
      }; 

       

            [JSDSERVER-12026] Calling String.prototype.startsWith with position params does not work with installed Assets (Insight)

            Marc Dacanay made changes -
            Labels Original: ecohelp ecosystem New: ecohelp ecosystem ril
            Marc Dacanay made changes -
            Remote Link New: This issue links to "Internal ticket (Web Link)" [ 955668 ]
            James Richards made changes -
            Labels New: ecohelp ecosystem
            Anh Nguyen made changes -
            Status Original: Needs Triage [ 10030 ] New: Gathering Impact [ 12072 ]
            Anh Nguyen created issue -

              Unassigned Unassigned
              26dfe8128d58 Anh Nguyen
              Affected customers:
              0 This affects my team
              Watchers:
              3 Start watching this issue

                Created:
                Updated: