You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 9, 2024. It is now read-only.
WebMangler currently only supports mangled for "Standards mode", but not "Quirks mode". As a result, mangling might not work as expected if the website being mangled is running in "Quirks mode".
As an example: in "Quirks mode", CSS classes are case insensitive. Since the CssClassMangler assumes classes are case sensitive (see the CharSet), mangling a website that runs in "Quirks mode" might not work correctly. This is because class names could be generated that are identical in "Quirks mode", e.g. .a and .A.
The following is a snippet of HTML to test the behaviour of quirk mode:
<!-- Comment the next line to enter "Quirks Mode" --><!DOCTYPE html><h1>Quirks mode behaviour</h1><h2>IDs</h2><style>#a { color: red; }
</style><divid="a">lowercase ID</div><divid="A">uppercase ID</div><divid="b">other ID</div><script>console.log(document.querySelectorAll("#a"))console.log(document.getElementById("a"))</script><hr><h2>classes</h2><style>
.a { color: blue; }
</style><divclass="a">lowercase class</div><divclass="A">uppercase class</div><divclass="b">other class</div><script>console.log(document.querySelectorAll(".a"))console.log(document.getElementsByClassName("a"))</script>
Motivation
The motivation for supporting "Quirks mode" is that it's supported by browsers. Hence, a developer with a website that works in "Quirks mode" will reasonably expect it still works after mangling it with WebMangler.
Proposal
Add support for a flag2 to enable mangling for "Standards mode". When this flag is set (to true), plugins should work the way they do now. When this flag is not set(/set to false), plugins should operate as though they're mangling for a website running in "Quirks mode".
The motivation for mangling for "Quirks mode" by default is that it also works for "Standards mode", whereas the reverse is not true. This makes WebMangler easier to pickup for developers that are not necessarily aware of the differences between "Standards mode" and "Quirks mode".
Alternatives
Detecting quirk mode dynamically: This approach seems almost intractable. It's hard to say whether or not a website will run in "Quirks mode", so it'll be hard to instruct mangler/language plugins to operate in a "Quirks mode"-compliant manner.
Mangle for "Standards Mode" by default: See the proposal for an explanation of why this wasn't chosen.
Notes
This feature request is related, but not identical, to #184. It was discovered while working on #184.
Footnotes
If a mangler plugin is missing from this list, please leave a comment with a detailed explanation of the reason why it doesn't support "Quirks Mode". ↩
To be decided if this will be in the top-level config, the plugin config, or somewhere else. ↩
The text was updated successfully, but these errors were encountered:
Package(s)
mangler-css-classes (0.1.23), mangler-html-ids (0.1.23)
Description
WebMangler currently only supports mangled for "Standards mode", but not "Quirks mode". As a result, mangling might not work as expected if the website being mangled is running in "Quirks mode".
As an example: in "Quirks mode", CSS classes are case insensitive. Since the
CssClassMangler
assumes classes are case sensitive (see theCharSet
), mangling a website that runs in "Quirks mode" might not work correctly. This is because class names could be generated that are identical in "Quirks mode", e.g..a
and.A
.This problem exists for1:
mangler-css-classes
mangler-html-ids
The following is a snippet of HTML to test the behaviour of quirk mode:
Motivation
The motivation for supporting "Quirks mode" is that it's supported by browsers. Hence, a developer with a website that works in "Quirks mode" will reasonably expect it still works after mangling it with WebMangler.
Proposal
Add support for a flag2 to enable mangling for "Standards mode". When this flag is set (to true), plugins should work the way they do now. When this flag is not set(/set to false), plugins should operate as though they're mangling for a website running in "Quirks mode".
The motivation for mangling for "Quirks mode" by default is that it also works for "Standards mode", whereas the reverse is not true. This makes WebMangler easier to pickup for developers that are not necessarily aware of the differences between "Standards mode" and "Quirks mode".
Alternatives
Notes
This feature request is related, but not identical, to #184. It was discovered while working on #184.
Footnotes
If a mangler plugin is missing from this list, please leave a comment with a detailed explanation of the reason why it doesn't support "Quirks Mode". ↩
To be decided if this will be in the top-level config, the plugin config, or somewhere else. ↩
The text was updated successfully, but these errors were encountered: