fgnass / domino

Server-side DOM implementation based on Mozilla's dom.js
BSD 2-Clause "Simplified" License
768 stars 120 forks source link

Checkbox input: once checked, can't uncheck #90

Closed issa-tseng closed 7 years ago

issa-tseng commented 7 years ago

I'm on domino version 1.0.27:

cxlt@Durindana:janus-stdlib#master± node --version
v6.9.1
cxlt@Durindana:janus-stdlib#master± node
> var window = require('domino').createWindow('<input type="checkbox"/>')
undefined
> var input = window.document.querySelector('input')
undefined
> input.checked
false
> input.checked = true
true
> input.checked
true
> input.checked = false
false
> input.checked
true
> delete input.checked
true
> input.checked
true

Originally, I was using jQuery .prop('checked', someBoolean) with domino which also failed, but this bare case doesn't work either.

I'm happy to take a look and submit a PR if you have a pointer on where to start.

issa-tseng commented 7 years ago

Despite the above, it appears that input.outerHTML does yield the expected result. It's just the attribute itself that doesn't read correctly.

issa-tseng commented 7 years ago

Okay, I dug more. Sorry about live-blogging this. Looks like removeAttribute doesn't update _attrsByQName which hasAttribute checks. Or something. I'll try to submit a PR if I figure this out.