Giter Site home page Giter Site logo

Handle boolean attributes? about parse5 HOT 3 CLOSED

inikulin avatar inikulin commented on September 9, 2024
Handle boolean attributes?

from parse5.

Comments (3)

inikulin avatar inikulin commented on September 9, 2024

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.

cburgmer avatar cburgmer commented on September 9, 2024

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.

inikulin avatar inikulin commented on September 9, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.