Opened 7 years ago

Closed 7 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)

widgetId.html (4.3 KB) - added by Peter Jekel 7 years ago.
Demonstrate failure when widget Id is same as a DOM id in dojo 1.8rc

Download all attachments as: .zip

Change History (5)

comment:1 Changed 7 years ago by bill

Owner: changed from bill to Peter Jekel
Status: newpending

Your code snippet has a number of syntax errors, can you attach a running full test case using the attach file button? Thanks.

comment:2 Changed 7 years ago by Peter Jekel

Status: pendingnew

Attachment (widgetId.html) added by ticket reporter.

Changed 7 years ago by Peter Jekel

Attachment: widgetId.html added

Demonstrate failure when widget Id is same as a DOM id in dojo 1.8rc

comment:3 Changed 7 years ago by bill

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");
Last edited 7 years ago by bill (previous) (diff)

comment:4 Changed 7 years ago by bill

Resolution: wontfix
Status: newclosed
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.

Note: See TracTickets for help on using tickets.