Menu

#462 javascript Option constructor problems

Latest SVN
closed
None
5
2012-10-21
2007-04-23
No

1)
Option constructor takes 4 arguments, current implementation only takes 2.

New 3rd argument is boolean and is the value for defaultSelected property.

New 4th arguement is boolean and is the value for selected property.

This change also implements defaultSelected property (read only)

2)
Also, the constructor's first agument is the value for the text property not the label property. In the constructor, the first argument is now used to set the text content of the option tag, not the label attribute.

Attached patch for code and test

Discussion

  • Bruce Chapman

    Bruce Chapman - 2007-04-23

    code and test patch

     
  • Marc Guillemot

    Marc Guillemot - 2007-04-23

    Logged In: YES
    user_id=402164
    Originator: NO

    With which browser did you test? If I correctly remember, FF and IE don't behave the same here.

     
  • Bruce Chapman

    Bruce Chapman - 2007-04-23

    Logged In: YES
    user_id=1750644
    Originator: YES

    Marc,

    Our app hasn't shown any difference between FF and IE in this respect, but I will do some tests and confirm.

    There is a browser specific difference in the interpretation of arguments when adding an Option to a Select, (Select.add(newOption, old)).

     
  • Bruce Chapman

    Bruce Chapman - 2007-04-23

    test html file to confirm FF and IE have same arguments for new Option()

     
  • Bruce Chapman

    Bruce Chapman - 2007-04-23

    Logged In: YES
    user_id=1750644
    Originator: YES

    Have tested and both FF (5.1) and IE (6) behave the same. Test file attached.
    File Added: test.html

     
  • Marc Guillemot

    Marc Guillemot - 2007-05-04

    Logged In: YES
    user_id=402164
    Originator: NO

    Patch applied, thanks.

    I've made a few changes:
    - the unit test didn't work in my FF (select.add missing argument)
    - changed get to is for defaultSelected
    - changed the unit test to only rely on js to make check in real browser easier
    - added support for the label property

     
  • Marc Guillemot

    Marc Guillemot - 2007-05-04

    Logged In: YES
    user_id=402164
    Originator: NO

    Patch applied, thanks.

    I've made a few changes:
    - the unit test didn't work in my FF (select.add missing argument)
    - changed get to is for defaultSelected
    - changed the unit test to only rely on js to make check in real browser easier
    - added support for the label property

     

Log in to post a comment.