Topic: error in Chrome with method switch

In my case I have a mif tree listing that shows name of groups.
I have an ajax function that returns a json object with groups that are linked to some other variable.
onSuccess of that ajax request I walk through the returned groups. For each group I walk through the tree and when the group id matches the node id I call "this.switch('checked')" so that my tree's checkboxes are checked.

Chrome throws an error "Unexpected token switch", I think because of the (native) switch method.
If I copy the switch method in miftree.js and call it "glitch" and call that everything works fine, so I think that method in miftree should be renamed. Maybe to something like check or switchMe or _switch.

I'm using a build from the trunk btw, but I think this applies to all "versions".

Last edited by Rolf (2010-01-22 18:26:54)

Thumbs up Thumbs down

Re: error in Chrome with method switch

don't call switch with dot syntax, use ['switch']:

this['switch']('checked')

Re: error in Chrome with method switch

Aah, of course.. I remember seeing that in the original checkboxClick method (then wondering again why you did that there).

Case closed.

Thumbs up Thumbs down