Skip to content
This repository was archived by the owner on Jun 20, 2025. It is now read-only.
This repository was archived by the owner on Jun 20, 2025. It is now read-only.

Setting prop using Boolean (to trigger prop over attribute) always sets true #426

Open
@trevorparscal

Description

@trevorparscal

Using an Object form to trigger prop over attribute setting doesn't work with Boolean objects, because they always resolve to true when applied to boolean DOM properties expecting native booleans, such as checkbox.checked.

a = new Boolean( false );
console.log( !!a ); // outputs true
console.log( a.valueOf() ); // outputs false

By adding something like this to the inside of setProp, this can be easily resolved.

// Convert Boolean objects to native boolean values
if ( value instanceof Boolean ) {
  value = value.valueOf();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions