bigskysoftware / idiomorph

A DOM-merging algorithm
BSD 2-Clause "Simplified" License
693 stars 33 forks source link

Fix input property sync #22

Closed hastebrot closed 10 months ago

hastebrot commented 10 months ago

idiomorph has a bug introduced in the latest release 0.0.9, where it syncs the checked attribute of <input> but does not sync the checked property. it is actually one line (to[attributeName] = from[attributeName];), but there were also changes for the order for the sync of checked (and others) and value, I'll apply chesterton's fence here.

just to be sure I migrated some unit tests from nanomorph's tape test suite [1] to idiomorphs mocha test suite.

[1] https://github.com/choojs/nanomorph/blob/v5.4.3/test/diff.js#L125-L245

steps to reproduce

technical details

checked A boolean attribute indicating whether this checkbox is checked by default (when the page loads). It does not indicate whether this checkbox is currently checked: if the checkbox's state is changed, this content attribute does not reflect the change. (Only the HTMLInputElement's checked IDL attribute is updated.)