Details
-
Bug
-
Resolution: Fixed
-
Normal
-
8.5.2.1
-
Security Level: Jimmy
Description
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.