It working in Firefox is likely Firefox trying to be smart about
checked="false".

Like I said, the spec says checked="anything" means the checkbox is checked.
The HTML attribute and the DOM property do not perfectly mirror each other,
which is why setting myInput.checked = false works. So, as backwards as this
may seem, it's expected behavior.

You can change it to use null instead of false like so:

new Element('input', {
    type: 'checkbox',
    checked: isChecked || null
});


On Tue, Nov 30, 2010 at 10:57 AM, Gafa <[email protected]> wrote:

> Except for the fact on the creation of the Element it's being
> specifically set with mootools, and as I stated worked in 1.2.4.
> Works fine in FF any mootools version.
>
> So either this is supposed to work or isn't in Mootools 1.2.5 or
> higher.  That is my question?
>
> As far as assigning null, yes that works for IE as does setting the
> checked attribute directly from the returned object, but if you are
> dynamically creating the checked element using DB data values, False/
> True that does not work with 1.2.5 or higher, and yes I know I can
> test an set for null with the assignment.
>
> Gafa
>
>
> On Nov 30, 1:10 pm, Sean McArthur <[email protected]> wrote:
> > A checkbox is considered checked if it has the checked attribute at all.
> No
> > matter that the value is set to. If it simply exists, the HTML spec says
> it
> > should be checked.
> >
> > Either don't include the property with false, or setting it to null
> should
> > also not add it (I think, don't quote me on that).
> >
> > On Tue, Nov 30, 2010 at 7:10 AM, Gafa <[email protected]> wrote:
> > > Create an input element set checked attribute to false does not work.
> >
> > > Seems since Mootools version 1.2.5 core or higher issues exists.
> >
> > > Mootools 1.2.4 core no issue.
> >
> > > Here is test code:http://jsfiddle.net/mn2vW/
> >
> > > Gafa
>

Reply via email to