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

Fixing exceptions when attribute contains no value #1056

Open
wants to merge 3 commits into
base: gh-pages
Choose a base branch
from
Open

Fixing exceptions when attribute contains no value #1056

wants to merge 3 commits into from

Conversation

Chopinsky
Copy link

This PR is to address the exception being thrown if the target html file contains link tags whose type attribute is defined but without a value.

For example, when using the plugin with webpack, encountering the following link tag:

<link href="https://somecdn.com/favicon/favicon.png" rel="icon" type>

in a html file will crash the build process because of this exception: TypeError: Cannot read property 'toLowerCase' of undefined.

With this fix, we will treat the undefined attribute value as a blank string value, i.e. it will be equivalent as the link tag below:

<link href="https://somecdn.com/favicon/favicon.png" rel="icon" type="">.

src/htmlminifier.js Outdated Show resolved Hide resolved
reverting from a more sweeping change where any attrValue not of the type of 'string' is treated as a blank entry.
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.

4 participants