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

Issue with HTML Minification Stripping type Attribute from button Tag #190

Open
youappz opened this issue Jun 6, 2024 · 0 comments
Open

Comments

@youappz
Copy link

youappz commented Jun 6, 2024

When running HTML minification, the type attribute of a button tag is being stripped off. Below is an example:
in the above example button html tag after running html minify it strips of the type attribute

Original HTML:

<button aria-live="assertive" class="wpforms-submit" data-alt-text="Sending..." data-submit-text="Submit" id="wpforms-submit-6" name="wpforms[submit]" value="wpforms-submit" type="submit">Submit</button>```
</text>

Minified HTML

<button aria-live="assertive" class="wpforms-submit" data-alt-text="Sending..." data-submit-text="Submit" id="wpforms-submit-6" name="wpforms[submit]" value="wpforms-submit">Submit</button>

Minification Configuration

Using the following Rust code for HTML minification:

pub fn minify_html(html: &[u8]) -> Vec<u8> {
    let mut minify_cfg = minify_html::Cfg::spec_compliant();
    minify_cfg.minify_css = true; // temporary disable as its causing issues
    minify_cfg.minify_js = false; // causes issues with \\/ escaped urls in html
    minify_cfg.keep_closing_tags = true;
    minify_cfg.keep_input_type_text_attr = true;
    minify_html::minify(html, &minify_cfg)
}
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

No branches or pull requests

1 participant