Comments (3)
Hi,
According to spec parser doesn't distinguish attributes with value and attributes without value (parser should treat boolean attributes as an attribute with an empty value) :
Set that attribute's name to the current input character, and its value to the empty string.
http://www.w3.org/html/wg/drafts/html/master/syntax.html#before-attribute-name-state
This caused by the fact that attribute values are handled by the later stage of the page processing in browser (e.g. building render tree, when it decide to not consider checked
attribute value and just checks it's presence). So, for the browser and parser <input type="checkbox" checked>
is an equivalent to <input type="checkbox" checked="">
). If you have some specific issue caused by such behavior could you please describe it in details. I'll try to assist you to find workaround for it.
from parse5.
Hi thanks for clearing this up.
As far as I understand checked
in fact needs to be converted to checked="checked"
amongst others, following http://www.w3.org/TR/xhtml1/dtds.html.
So I guess I need to take care of that on my part.
from parse5.
Yes, checked
attribute value has restrictions only in the XHTML. In HTML (4 and 5) only presense of the attribute matters and it can have any value. So if you perform conversion beetween HTML and XHTML you need to handle boolean attributes manually.
from parse5.
Related Issues (20)
- Expose createTextNode() on default tree adapter HOT 3
- Custom single closing tag can`t be parsed correctly HOT 1
- Rewriter trigger the "text" event even after the write callback is executed HOT 10
- Node types don't appear to be exported in an ergonomic way HOT 4
- Enable Keeping Attribute Name Casing HOT 9
- Adding config that allow for the use of self close tags HOT 1
- Failed to parse source map from file: Error: ENOENT: no such file or directory HOT 18
- parse5-html-rewriting-stream fails on file > 128kByte HOT 2
- Failed to parse source map ... HOT 3
- Package subpath './lib/parser/index.js' is not defined by "exports" HOT 2
- Incorrect handling of CDATA sections HOT 1
- browserify fails for parse5 HOT 1
- node_modules/parse5/dist/index.d.ts:1:15 - error TS1005: ',' expected. HOT 4
- Type definitions are not properly generated and typescript compile fails HOT 2
- Wrong HTML string when reading from a file with encoding utf8 with bom HOT 1
- Parsing messes up when given a utf-8 input with a BOM HOT 12
- The detachNode has not been called HOT 1
- Outlook VML statements become commented HOT 1
- Noframes tag not parsed according to specification when in body
- Migrate some or most methods of Tokenizer and Parser to `protected`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parse5.