Opened 12 years ago
Closed 12 years ago
#10753 closed defect (fixed)
Widgets don't have unique ID's in multi-version environment
Reported by: | Bryan Forbes | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 1.4.2 |
Component: | Dijit | Version: | 1.4.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
In a multi-version environment, Dijit's ID generation routine will generate duplicate ID's. I'm attaching a test-case to highlight this.
Attachments (1)
Change History (5)
Changed 12 years ago by
Attachment: | multiversion.html added |
---|
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Yes, modifying dijit.getUniqueId() solves one of the problems, avoiding clashes in generated id's.
I thought scopeMap could also solve the issue with portlets, where two widgets on the same page (but in different portlets) both have the same explicitly specified id, ie: id="foo". Like how iframes have a unique scope. That's a much bigger change though that needs more investigation, and wouldn't go into 1.4.2.
My original thought was to introduce a new (readonly) widget attribute:
this.scopeId = (dojo._scopeName == "dojo" ? "" : dojo._scopeName) + this.id
and then use scopeId rather than id for anytime the widget id is read/written into the DOM. For example, use ${scopeId} rather than ${id} in templates, and then have code to strip dojo._scopeName in dijit.byNode().
It reminds me of the ContentPane issue where two ContentPane's load the same URL and start to get id clashes.
Note that there's a case for ComboBox where the id is used twice, applied to both the ComboBox.domNode (as "widget_foo") and the ComboBox.focusNode (as "foo"). And there's a case where the id from a ContentPane is used to generate the id of the corresponding TabButton. It's complicated.
comment:3 Changed 12 years ago by
OK, I'll checkin the fix for generated id's for 1.4, and leave the issue of specified id's for another day.
comment:4 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Using dijit._scopeName in dijit.getUniqueId would fix it, although makes the ids longer.