This project is archived and is in readonly mode.

#502 ✓invalid
Fábio M. Costa

getProperty 'value' issue

Reported by Fábio M. Costa | November 29th, 2008 @ 02:13 PM | in 1.2.2

 <li id="li_test" value="moo">text</li>


Both these 2 functions will return the same values. Depending on the browser they will be 1, 0 or -1.

On 'input' it works ok, but not on 'li', and 'value' is a valid attribute for 'li'.


'getAttribute' javascript's function works ok on all browsers i tested (ie6,firefox,opera,safari,chrome). I don't have a fix for this, maybe you guys can help.

Comments and changes to this ticket

  • Tom Occhino

    Tom Occhino November 29th, 2008 @ 04:25 PM

    • Milestone changed from 2.0 to 1.2.2
    • State changed from “new” to “invalid”

    value has never been a valid attribute for 'li' elements.

    regardless, even with invalid attributes, get and getProperty should still work the same, but it appears that browsers are handling the value attribute differently. Unfortunately this, also, isn't a MooTools issue.

    >>> new Element('ul').inject(document.body).adopt(new Element('li', {text:'abcdef', value:'moo'}));
    >>> var li = $$('li')[0];
    >>> li
    <li value="0">
    >>> li.value = 'moo';
    >>> li.value

    I would use a different 'custom' attribute other than value, or store the data you need to store a different way.

  • Fábio M. Costa

    Fábio M. Costa November 30th, 2008 @ 02:50 PM

    in fact it is a valid attribute at xhtml 1.0 transitional:

    Don't say 'has never been', it's rude.

    but the thing is that it should have number values, not string as my example haves.

    Just tested with numbers and it works fine.


Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket