javascript - Detached radio inputs dont synchronize checkedness? -
is bug or missing something?
i create radio inputs detached document, , check them both. expect second stay checked, both stay checked:
var container = document.createelement('div'); container.innerhtml = '<input type="radio" name="tiny" value="elephants">' + '<input type="radio" name="tiny" value="robots">'; var radios = container.queryselectorall('[name=tiny]'); // select one, other while detached radios[0].checked = true; radios[1].checked = true; console.log(radios[0].checked); // true console.log(radios[1].checked); // true
if attached same container
document, exclusive checkedness enforced:
document.body.appendchild(container); radios[0].checked = true; radios[1].checked = true; console.log(radios[0].checked); // false console.log(radios[1].checked); // true
seems me these radios meet the spec's definition of single radio button group. if switch containing element form, checkedness synchronized while detached. i've checked in chrome 25 far.
Comments
Post a Comment