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 }}
Repository navigation
hidden="until-found" is minified to bare hidden, which changes behavior #292
The HTML spec defines hidden as an enumerated attribute with two states (spec). hidden="until-found" collapses the element but leaves it reachable: find-in-page and fragment navigation can reveal it, and it fires beforematch when they do. minify-html rewrites it to bare hidden, which the browser never reveals, so minifying changes what the page does.
Any value collapses the same way ("bogus" and "" included). No option keeps it.
Cause
minify-html-common/html-data_2023013104.0.0.json marks hidden as {"boolean": true} on every element. minify-html/src/minify/attr.rs then drops the value of any boolean attribute, whatever it is:
if is_boolean || value_raw.is_empty(){returnAttrMinified::NoValue;};
Special-case hidden: keep the value when it's until-found (ASCII case-insensitive). Every other value, the empty string included, maps to the plain hidden state, so collapsing those stays safe.
More general: collapse a boolean attribute only when its value is empty or matches the attribute name, case-insensitively. The spec allows only those two values on a true boolean attribute. Any other value means the input either isn't plain boolean or isn't valid, and keeping it is the safe choice. This would also cover the next boolean that grows a second state.
I can send a PR for either; tell me which you prefer.
Context
We hit this on a live page: a demo's target element has shipped as bare hidden since the demo went live, so find-in-page never revealed it. We now swap the value through a placeholder attribute before minifying and restore it afterwards, the approach #219 describes. #81 was an earlier case where html-data's attribute table disagreed with browsers.
Activity