Skip to content
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

Disable event: Fix ampersand in basic HTML mode's activation link #9144

Merged
merged 1 commit into from
Aug 11, 2021

Conversation

EricDunsworth
Copy link
Member

@EricDunsworth EricDunsworth commented Jul 30, 2021

This plugin adds an ampersand before wbdisable=true if the current page's URL contains parameters.

The plugin used to build basic HTML mode's activation link using innerHTML. Later on, #9036 changed it to use the addSkipLink helper method.

However, that changed how the ampersand got interpreted. It started getting double-escaped (&&).

This resolves it by changing the ampersand from a numeric entity into a normal ampersand character. It'll get transformed into & upon being inserted into the page by addSkipLink.

The addSkipLink method uses setAttribute (which expects plain-text values) to set the activation link's destination. Afterwards, appendChild subsequently changes the ampersand into a named entity.

Fixes #9139.

Related reading:

@EricDunsworth EricDunsworth force-pushed the v4.0-disable-ampersand branch 2 times, most recently from 126dee6 to 4d7dbb9 Compare August 10, 2021 17:47
@EricDunsworth EricDunsworth marked this pull request as ready for review August 10, 2021 17:47
This plugin adds an ampersand before wbdisable=true if the current page's URL contains parameters.

The plugin used to build basic HTML mode's activation link using innerHTML. Later on, wet-boew#9036 changed it to use the addSkipLink helper method.

However, that changed how the ampersand got interpreted. It started getting double-escaped (&&wet-boew#38;).

This resolves it by changing the ampersand from a numeric entity into a normal ampersand character. It'll get transformed into & upon being inserted into the page by addSkipLink.

The addSkipLink method uses setAttribute (which expects plain-text values) to set the activation link's destination. Afterwards, appendChild subsequently changes the ampersand into a named entity.

Fixes wet-boew#9139.
@GormFrank GormFrank merged commit 0be4a0d into wet-boew:master Aug 11, 2021
EricDunsworth added a commit to EricDunsworth/wet-boew that referenced this pull request Aug 11, 2021
Activating the "switch to standard version" link while in basic HTML mode previously caused a trailing ampersand to appear in the URL if the page contained multiple URL parameters.

This removes it by using a case-insensitive regex to check for an optional ampersand before "wbdisable=false".

Complements wet-boew#9144.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Switch to Basic HTML - URI parameters not transferred properly
2 participants