Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4076

update JS polyfills for String prototype functions

XMLWordPrintable

      the Javascript String.prototype functions (startsWith/endsWith/trim) have been standardized and are more or less supported by modern browsers.

      ZK's current polyfills in js.js are 9 years old and don't fully implement the JS spec potentially breaking 3rd party libraries depending on the standards.

      https://github.com/zkoss/zk/blob/v8.5.2.1/zk/src/archive/web/js/zk/js.js#L14-L22

      compared to:

      https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
      https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
      https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim

      We should update the polyfills using the recommendations from MDN and only apply them in older browsers depending on availability.

            rudyhuang rudyhuang
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 4 hours
                4h
                Remaining:
                Time Spent - 3 hours Remaining Estimate - 1 hour
                1h
                Logged:
                Time Spent - 3 hours Remaining Estimate - 1 hour
                3h