Skip to content

sync between attributes and properties  #1579

Open
@dagolinuxoid

Description

@dagolinuxoid

But there are exclusions, for instance input.value synchronizes only from attribute → to property, but not back:

I don't know is it worth or not to mention (as a side note) that the sync between attributes and properties is not going to happen after a property is assigned directly. Example

let inp = document.getElementById('search');
inp.setAttribute('value','initialValue');
inp.value === 'initialValue'; //true
inp.setAttribute('value','changedValue via setAttribute');
inp.value === 'changedValue via setAttribute'; // true;
inp.value = 'cancel all consecutive attempts to sync via setAttribute';
inp.value === 'cancel all consecutive attempts to sync via setAttribute'; // true
inp.setAttribute('value','has no effect on input.value');
inp.value === 'has no effect on input.value'; // false
inp.value === 'cancel all consecutive attempts to sync via setAttribute'; // true

go to the website

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions