Issue #1431: writeAttribute('checked') fails to write the 'checked' attribute, writes an 'undefined' attribute instead #80

merged 1 commit into from Nov 2, 2012


None yet

3 participants


Fixed, with unit tests.

@sdumitriu sdumitriu Issue #1431: writeAttribute('checked') fails to write the 'checked' a…
…ttribute, writes an 'undefined' attribute instead

Sorry I missed this one last week.

Great job writing so many tests — in the future, maybe be a bit more restrained with the column alignment, but that's just a quibble. 😄

@savetheclocktower savetheclocktower merged commit b0b9c93 into sstephenson:master Nov 2, 2012

I followed the codestyle that was used nearby, normally I don't do column alignment. Thanks for merging this.


Hell, you're right. How did that get in there?

Deses commented on 4a22a52 Aug 27, 2014

With this change, this code now always sets the checkbox to checked no matter what on IE8 and Chrome, in IE10 it's working fine though.

new Element('input', {
    id: 'name',
    name: 'name',
    checked: rowObj.checked,
    disabled: !rowObj.disabled

rowObj.checked and rowObj.disabled are booleans and both are false.


Oh, this code is so WRONG! What was I thinking?

Hmm... so, how can I hot fix this?

I've been looking to the code and I don't have that ATTRIBUTE_TRANSLATIONS.values function! Mysterious!


I think this should work, but I didn't test it yet:

- name = table.values[attr](element, value) || name;
+ value = table.values[attr](element, value);

That should do it, it was like that in 1.7.1 and it worked fine then, but I wasn't sure that it would break another thing.

Thank you, this is pretty critical for our application. :)


So was this a matter of insufficient test coverage, or did we not run the tests in enough browsers? I confess I do not remember how thoroughly I checked this before I merged it, but I swear I ran the tests in every browser known to man before the 1.7.2 release.


@Deses see #262 for the full fix.

@savetheclocktower Looks like insufficient browsers tested, it worked with FF and modern IE; not sure why it fails in Chrome, as @Deses claims.


Speaking of tests, I get a lot of test failures with the current master. Is it just me?


The problem is that all the DOM tests pass in 1.7.2 in Chrome. And if I try to extract @Deses's example code into a unit test…

var newUncheckedElement = new Element('input', {
  type: 'checkbox', 
  name: 'name',
  checked: false,
  disabled: false

var newCheckedElement = new Element('input', {
  type: 'checkbox',
  name: 'name',
  checked: true,
  disabled: false


…then everything still passes (on both Chrome 36 and Chrome 37). @Deses, you're running 1.7.2, right? What version of Chrome are you on?

I was working with Chrome 36, and IE10 using "Standards" document mode and "IE8 Standards" document mode.

I'm really not sure what was the correct behavior (probably Chrome was the one that worked fine), but I wasn't getting consistent results on the two (three?) browsers.

The issue with our app is that we are upgrading from IE8 to IE10, but IE10 has this document mode stuff that renders pages depending on how badly is the code, but we force it to use the "Standard" mode using <meta http-equiv="X-UA-Compatible" content="IE=edge">. But somehow on IE8 all the check boxes were always checked and on IE10 all the check boxes were unchecked. And Chrome, IIRC, showed some check boxes checked and some weren't.

I know I'm not being very clear but I was frustrated and pretty confused, so I don't remember all the details, sorry. :(

Hope this helps!


The problem is that the function in ATTRIBUTE_TRANSLATIONS.values correct attribute values, not the names, so the returned value should be assigned to value, not name.

@sdumitriu sdumitriu deleted the sdumitriu:issue-1431 branch Dec 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment