#1019 closed defect (fixed)
createWidget() with node parameter doesnt work
Reported by: | Owned by: | dylan | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Widgets | Version: | 0.2 |
Keywords: | createWidget | Cc: | |
Blocked By: | Blocking: |
Description
speaking with dmachi on IRC I got the impression that createWidget method should be able to take one parameter - DOM node and create widget out of it (parse it)
Looking into the code I got even bigger impression that authors tried to achieve that functionality, unfortunately it doesn't work. First line of createWidget calls:
var lowerCaseName = name.toLowerCase();
that of course fails if the name is node.
as a quick fix I would suggest something like
if (dojo.dom.isNode(name) && (arguments.length==1)){ // we got a DOM node var xp = new dojo.xml.Parse(); return dojo.widget.getParser().createComponents(xp.parseElement(name, null, true))[0]; }
in the very beginning of the method.
Another widgetCreating related issue that I have is that creating widget out of node using
dojo.widget.createWidget("MyWidgetType",{},this.myNode);
will not parse atributes of node into widget parameters and I think it should.
Change History (4)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
Component: | Core → Widgets |
---|---|
Owner: | changed from anonymous to dylan |
Status: | new → assigned |
comment:3 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I think this is already resolved. If not, please reopen.
var lowerCaseName = name.toLowerCase();
This is the first line from fromScript, not from createWidget.