Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#442 closed defect (fixed)

extraArgs is broken because of case differences between IE, FF and Opera

Reported by: jasonp@… Owned by: alex
Priority: high Milestone:
Component: Widgets Version: 0.2
Keywords: Cc:
Blocked By: Blocking:

Description

When Creating Widgets via markup like so <div dojoType="ContentPane?" id="myContentPane"></div>

when you try to retrieve a reference to the widget by id using dojo.widget.getWidgetById('myContentPane'); in opera it fails. This is because in opera it is not parsing out the ID and assigning ot. Instead it is assigning a unique Id i.e. ContentPane0.

It works fine in all the other browsers I tried Konqueror, Firefox 1.5, IE 6.0

but fails on both Opera 8.5 and 8.51 on both windows and linux.

Change History (9)

comment:1 Changed 14 years ago by anonymous

Milestone: 0.2.2release0.3release

comment:2 Changed 14 years ago by jasonp@…

I discovered the source of this problem.

Opera converts "id" to "ID" when it is parsed.

so in Manager.js

if you change the line if(widget.extraArgsid?){

widget.widgetId = widget.extraArgsid?;

}

To

if(widget.extraArgsid?
widget.extraArgsID?){
widget.widgetId = widget.extraArgsid?
widget.extraArgsID?;

}

This will solve this problem

I am not sure how to fix this in source so someone please resolve this bug.

comment:3 Changed 14 years ago by anonymous

Sorry forgot to format it as code should be

if(widget.extraArgs["id"]||widget.extraArgs["ID"]){
   widget.widgetId = widget.extraArgs["id"]||widget.extraArgs["ID"]; 
}

comment:4 Changed 14 years ago by Morris Johns

Summary: Widget ID's are not being parsed correctly in OperaextraArgs is broken because of case differences between IE, FF and Opera

There is a serious cross-browser problem with the keys of widget.extraArgs. in IE6 the keys for extraArgs retain the mixed case property name. in FF1.5.0.1 the keys for extraArgs are always in lower case. I haven't tried Opera, but this fault is saying that it sets the keys to uppercase.

e.g. <div dojoType="Button2" someCustomArg="bar"></div>

To access extraArgs in Opera would be: widget.extraArgsSOMECUSTOMARG? To access extraArgs in IE would be: widget.extraArgssomeCustomArg? To access extraArgs in FF would be: widget.extraArgssomecustomarg?

Perhaps extraArgs should be renamed to lcExtraArgs, and forced to always be lower-case.

comment:5 Changed 14 years ago by alex

Owner: changed from anonymous to alex
severity: majornormal
Status: newassigned

I would agree that it would be nice to have them lower-cased. Given that there's a compat issue, I don't know that we should ever "advertise" the mixed-case version at all. If anything, extraArgs should be fixed to always contain at a minimum lower-case versions in addition to whatever mixed-case versions the browser may provide. That should solve it.

comment:6 Changed 14 years ago by Morris Johns

Alex, I don't think that a mixed-case key should be stored.

That would mean that people could write and test code and it would work on one browser, only later to find it was broken on another. I thought one of the primary reasons dojo exists is to remove such cross-browser issues.

Code that expects HTML properties to be case-sensitive would be unexpected behaviour to many developers (although perhaps not to any XHTML devs!).

comment:7 Changed 14 years ago by alex

Morris, you make a good point. I'm changing the behavior to include only lower-case variants.

comment:8 Changed 14 years ago by alex

Resolution: fixed
Status: assignedclosed

fixed in [3351]

comment:9 Changed 12 years ago by (none)

Milestone: 0.3release

Milestone 0.3release deleted

Note: See TracTickets for help on using tickets.