Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#1019 closed defect (fixed)

createWidget() with node parameter doesnt work

Reported by: klinec7@… 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 13 years ago by Dustin Machi

var lowerCaseName = name.toLowerCase();

This is the first line from fromScript, not from createWidget.

comment:2 Changed 13 years ago by dylan

Component: CoreWidgets
Owner: changed from anonymous to dylan
Status: newassigned

comment:3 Changed 13 years ago by dylan

Resolution: fixed
Status: assignedclosed

I think this is already resolved. If not, please reopen.

comment:4 Changed 12 years ago by (none)

Milestone: 0.4

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.