JuliaWeb / JuliaWeb/Hyperscript.jl

support boolean values for boolean attributes

Open
#20 7 comments 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
105
Forks
12
PR merge metrics
No merged PRs in 30d

Description

Even though the correct HTML5 thing to do is to use valueless boolean attributes or to not add them at all (i.e. `` versus ``), this becomes a bit awkward when generating them programmatically. In particular, if one wants to add observables to Hyperscript to add interactivity (see https://github.com/SimonDanisch/JSServe.jl/pull/35 for instance), things become a bit awkward.

From what I understand, HTML5 actually disallows using `"true"` or `"false"` as values for boolean attributes (see [here](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes#Boolean_Attributes)). Could it be possible to support passing `checked = false` to mean that the attribute is actually not set, and `checked = true` to set it?

I confess I'm not sure what the attribute should be set to with `checked = true`, but I imagine anything that conforms to HTML5 would be fine (empty string, or name of the attribute, or maybe even valueless).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.