New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search highlighting may break markup #366

Open
cmb69 opened this Issue Oct 16, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@cmb69
Copy link
Member

cmb69 commented Oct 16, 2018

@cmb69 cmb69 added the bug label Oct 16, 2018

@cmb69 cmb69 added this to the 1.7.3 milestone Oct 16, 2018

cmb69 added a commit to cmb69/cmsimple-xh that referenced this issue Nov 6, 2018

Fix cmsimple-xh#366: Search highlighting may break markup
HTML manipulation with regular expressions is too error prone, as the
bug report shows; manipulating the DOM is way more resilient.  Since
the highlighting of the search strings is not a fundamental property of
CMSimple_XH, we change it to be done as progressive enhancement.

We're using a JavaScript routine which is based on Stuart Langridge's
serchhi.js[1], but use only those parts which we really need.  We also
refactor these parts according to our needs.  Since we still support
IE8 for the back-end, we stick with this for the front-end search
highlighting.  We also do not want to move functionality from
admin.min.js to core.min.js in a patch version, so we write even more
clumsy code which we should refactor for XH 1.8.

[1] <https://kryogenix.org/code/browser/searchhi/>
@cmb69

This comment has been minimized.

Copy link
Member

cmb69 commented Nov 6, 2018

This is more serious than I thought. Actually, any HTML entity on a page can be searched, breaking the markup. For instance, https://www.cmsimple-xh.org/?privacy-protection&search=amp.

cmb69 added a commit to cmb69/cmsimple-xh that referenced this issue Nov 6, 2018

Fix cmsimple-xh#366: Search highlighting may break markup
HTML manipulation with regular expressions is too error prone, as the
bug report shows; manipulating the DOM is way more resilient.  Since
the highlighting of the search strings is not a fundamental property of
CMSimple_XH, we change it to be done as progressive enhancement.

We're using a JavaScript routine which is based on Stuart Langridge's
serchhi.js[1], but use only those parts which we really need.  We also
refactor these parts according to our needs.  Since we still support
IE8 for the back-end, we stick with this for the front-end search
highlighting.  We also do not want to move functionality from
admin.min.js to core.min.js in a patch version, so we write even more
clumsy code which we should refactor for XH 1.8.

[1] <https://kryogenix.org/code/browser/searchhi/>

cmb69 added a commit to cmb69/cmsimple-xh that referenced this issue Nov 6, 2018

Fix cmsimple-xh#366: Search highlighting may break markup
HTML manipulation with regular expressions is too error prone, as the
bug report shows; manipulating the DOM is way more resilient.  Since
the highlighting of the search strings is not a fundamental property of
CMSimple_XH, we change it to be done as progressive enhancement.

We're using a JavaScript routine which is based on Stuart Langridge's
serchhi.js[1], but use only those parts which we really need.  We also
refactor these parts according to our needs.  Since we still support
IE8 for the back-end, we stick with this for the front-end search
highlighting.  We also do not want to move functionality from
admin.min.js to core.min.js in a patch version, so we write even more
clumsy code which we should refactor for XH 1.8.

[1] <https://kryogenix.org/code/browser/searchhi/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment