A PR (see https://github.com/plone/plone.patternslib/pull/26) was merged in plone.patternslib to only override these methods if they are not present. Most modern browsers (if not all) have support for those methods.
What would be a good solution to fix this in Products.CMFPlone/static/components/patternslib/src/core/jquery-ext.js? I am not that familiar with these static resources, I think the easiest would be to replace the two offending lines with the fix from PR 26 in plone.patternslib. If I look at the commit history (see https://github.com/plone/plone.patternslib/commits/master/src/plone/patternslib/static/components/patternslib/src/core/jquery-ext.js) of jquery-ext.js, I see only two commits. There are not other changes in this file, expect for the first commit and the fix from the PR.
I close the issue, because it addresses a Plone version that is no longer supported.
If you think this is wrong please reopen the issue and assign a matching milestone.
BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)
What I did:
Call
startsWith
javascript function with a special char (such as?
) on any plone site:On plone.org in the Chrome developer toolbar:
When I click 'default.js' in above screenshot, I see:
What I expect to happen:
The
startsWith
function should not return an error. See this codepen where I reproduced the error: https://codepen.io/anon/pen/oJZBqzWhat actually happened:
The
startswith
andendswith
functions are overridden using prototype in:https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/static/components/patternslib/src/core/jquery-ext.js#L226-L227
A PR (see https://github.com/plone/plone.patternslib/pull/26) was merged in
plone.patternslib
to only override these methods if they are not present. Most modern browsers (if not all) have support for those methods.What would be a good solution to fix this in
Products.CMFPlone/static/components/patternslib/src/core/jquery-ext.js
? I am not that familiar with these static resources, I think the easiest would be to replace the two offending lines with the fix from PR 26 inplone.patternslib
. If I look at the commit history (see https://github.com/plone/plone.patternslib/commits/master/src/plone/patternslib/static/components/patternslib/src/core/jquery-ext.js) ofjquery-ext.js
, I see only two commits. There are not other changes in this file, expect for the first commit and the fix from the PR.What version of Plone/ Addons I am using:
Plone 5.1.4