Missing type="text" on inputs in prerendered HTML-files
See original GitHub issueDescribe the bug On input fields in prerendered HTML-files, the type attribute is missing if it has the default value “text”. Strangely this is not happening when testing directly with the “preact-render-to-string” package in this CodeSandbox example.
But it happens when I prerender the same content with preact build
.
To Reproduce
- Prerender a file with an input with
type="text"
in it. - Check the prerendered index.html file, the type attribute should be gone
Expected behavior
The type="text"
attribute should not be stripped away, even though it is the default value. It might for example be used for CSS styling.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Changing an Input value in Blazor by javascript doesn't ...
Apparently changing <input> value or any other changes in DOM by javascript doesn't change State, so blazor won't re-render the component.
Read more >Using Vue.js with Server Rendered Form Input Values
But Vue.js isn't so great for forms with input values already rendered from the server. We'll look at how to get around that...
Read more >chrome/browser/autofill/autofill_browsertest.cc - chromium/src - Git ...
Navigate to the form, input values into the fields, and submit the form. // The function returns after the PersonalDataManager is updated.
Read more >Knockout pre-rendered binding handlers - GitHub
This library adds two new binding handlers to Knockout that allow observables to be initialized from pre-rendered HTML content:.
Read more >Binding syntax - Angular
Angular binding distinguishes between HTML attributes and DOM properties. ... When the browser renders <input type="text" value="Sarah"> , it creates a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry for the super late response!
This is intentional, redundant attributes are stripped by
html-webpack-plugin
(which useshtml-minifier-terser
to do this).If you want to disable this, you can use your config file to do so:
preact.config.js
@developit If
--no-inline-css
completely disables Critters, then it has nothing to do with it. I already disabled inline CSS in the project where I stumbled upon this bug and I tested it in the example repository too, sadly it didn’t resolve the issue.type="Text"
andType="text"
are also getting stripped away.