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

sxml: remove special handling for html boolean attributes #359

Merged
merged 1 commit into from Jul 10, 2018

Conversation

Projects
None yet
2 participants
@pclouds
Copy link
Contributor

pclouds commented Jul 4, 2018

HTML boolean attributes can be specified without a value to represent "true". The presence of the attribute itself is enough to represent true. The value will be ignored (and to represent false, the attribute must not be present).

This special handling for boolean attribute (i.e. hiding the value) causes problems because this code does not really know if the attribute in question is boolean. This code would trip with this element

(a (@ (href "foo") (title "title")))

and render "title" attribute as a boolean, e.g.

<a href="foo" title>

which is wrong (i.e. empty title) because it is the same as

<a href="foo" title="">

Remove this code. This means boolean attribute will be shown with value, e.g.

<input checked="checked">

But semantically this is still correct. And it fixes the mistaking "title" as boolean above.

sxml: remove special handling for html boolean attributes
HTML boolean attributes can be specified without a value to represent
"true". The presence of the attribute itself is enough to represent
true. The value will be ignored (and to represent false, the attribute
must _not_ be present).

This special handling for boolean attribute (i.e. hiding the value)
causes problems because this code does not really know if the
attribute in question is boolean. This code would trip with this
element

    (a (@ (href "foo") (title "title")))

and render "title" attribute as a boolean, e.g.

    <a href="foo" title>

which is wrong (i.e. empty title) because it is the same as

    <a href="foo" title="">

Remove this code. This means boolean attribute will be shown with
value, e.g.

    <input checked="checked">

But semantically this is still correct. And it fixes the mistaking
"title" as boolean above.
@shirok

This comment has been minimized.

Copy link
Owner

shirok commented Jul 10, 2018

It looks like it is from the original sxml code but I think your assessment is valid. Thanks.

@shirok shirok merged commit 3c3654c into shirok:master Jul 10, 2018

shirok added a commit that referenced this pull request Jul 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment