Skip to content

set-value! and value functions do not work as expected for checkboxes #62

@xavi

Description

@xavi

Domina's set-value! doesn't work to change the value attribute of a checkbox. Looking at the code, I see this is because it's implemented by calling Google Closure Library's goog.dom.forms/setValue, whose code does not set the value of the value attribute of checkboxes, but it adds or removes the checked attribute (see the setInputChecked_ function in the same file, which, BTW, it has this comment "This seems potentially unintuitive since it doesn't set the value property").

On the other hand, Domina's value function only returns a checkbox value attribute if the checkbox is checked. Again, this is because value relies on Closure Library's equivalent function (getValue) which has this behavior for checkboxes.

I find these set-value! and value behaviors for checkboxes very uintuitive (besides, they made me waste a lot of time!) as they change the semantics of value in the HTML spec apparently for no reason.

I've raised the issue in Closure Library's mailing list but nobody replied as of now. I wonder... don't you agree that the current behavior is not correct? If so, should this be fixed in Domina, or should we wait for this to be fixed in Closure Library?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions