Parcel: πŸ› Using type="text" on input in HTML gets stripped

Created on 1 Feb 2018  Β·  3Comments  Β·  Source: parcel-bundler/parcel

Choose one: is this a πŸ› bug report or πŸ™‹ feature request?
πŸ›

πŸŽ› Configuration (.babelrc, package.json, cli command)

No config. Just a HTML5 Boilerplate with Parcel.

πŸ€” Expected Behavior

When running parcel build index.html --public-url ./, any HTML should not be altered.

😯 Current Behavior

When running parcel build index.html --public-url ./:

<input type="text" name="FirstName" class="form-control" id="FirstName" placeholder="*Firstname" required>

changes to

<input name="FirstName" class="form-control" id="FirstName" placeholder="*Firstname" required="">

πŸ’ Possible Solution

Not sure.

πŸ”¦ Context

Need type="text" to stay, especially when using CSS [type="text"].

🌍 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.4.1
| Node | 8.5.0
| npm/Yarn | 5.3.0
| Operating System | macOS 10.13.2

Question HTML Preprocessing

Most helpful comment

@davidnagli it's a problem because it breaks CSS selectors, it's a known side-effect from htmlnano

@donaldallen did you try the htmlnano removeRedundantAttributes option?

Example, in a .htmlnanorc file (see #445 for a list of possible location for the configuration) :

{
  removeRedundantAttributes: false
}

All 3 comments

When is this a problem? Because I’m pretty sure the browser defaults to assuming that an input is type=β€œtext”, so it’s actually kinda redundant information.

Is there some case you encountered where this behavior get’s in the way?

@davidnagli it's a problem because it breaks CSS selectors, it's a known side-effect from htmlnano

@donaldallen did you try the htmlnano removeRedundantAttributes option?

Example, in a .htmlnanorc file (see #445 for a list of possible location for the configuration) :

{
  removeRedundantAttributes: false
}

That did the trick. Thanks @fathyb!

Was this page helpful?
0 / 5 - 0 ratings