Opened 8 years ago
Closed 8 years ago
#15812 closed defect (wontfix)
_WidgetBase.placeAt(): Widget Id can no longer be the same as a DOM Id.
Reported by: | Peter Jekel | Owned by: | Peter Jekel |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Dijit | Version: | 1.8.0rc1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Prior to dojo 1.8 a widget id could be the same as a DOM id. As of dojo 1.8 the following error is reported in Firebug:
[Exception... "Node cannot be inserted at the specified point in the hierarchy" code: "3" nsresult: "0x80530003 (HierarchyRequestError?)" location: "http://localhost/js/dojotoolkit/dojo/dom-construct.js Line: 191"]
For example:
<div id="myTree"> var tree = new Tree({id="myTree", ... }}; tree.placeAt("myTree"); </div>
If this is by design I would highly recommend to include a note in the 1.8 release notes.
Attachments (1)
Change History (5)
comment:1 Changed 8 years ago by
Owner: | changed from bill to Peter Jekel |
---|---|
Status: | new → pending |
comment:2 Changed 8 years ago by
Status: | pending → new |
---|
Attachment (widgetId.html) added by ticket reporter.
Changed 8 years ago by
Attachment: | widgetId.html added |
---|
Demonstrate failure when widget Id is same as a DOM id in dojo 1.8rc
comment:3 Changed 8 years ago by
OK, thanks for pointing out the problem, and for the test case. It's strange that you have the <script> block in the middle of the <body> section, and without using dojo/ready, but that's not the issue.
Looks like it's fallout from #14946 ([28251]), allowing the ability to do:
childWidget.placeAt(parentWidgetId)
The other strange thing about your test case is that IIUC it's designed to end up with two nodes with the same id:
<div id=myTree> <div data-dojo-type=dijit/Tree id=myTree> ...
That's bad because id's are supposed to be unique. Maybe you wanted to call myTreeWidget.placeAt("myTree", "replace")
? Although it's simpler (and standard) in that case to just do:
new Tree( { model: model, id: "myTree" }, "myTree");
comment:4 Changed 8 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Summary: | Widget Id can no longer be the same as a DOM Id. → _WidgetBase.placeAt(): Widget Id can no longer be the same as a DOM Id. |
In any case, it is by design, so I guess (as you suggested) I'll just need to document this. I added the info to the 1.8 release notes.
Your code snippet has a number of syntax errors, can you attach a running full test case using the attach file button? Thanks.