Opened 10 years ago

Closed 10 years ago

#10060 closed enhancement (invalid)

Carry over attributes from markup to templated widgets

Reported by: Adam Peller Owned by:
Priority: high Milestone: 1.4
Component: Dijit Version: 1.3.2
Keywords: Cc: jferrai@…
Blocked By: Blocking:

Description

When declared programmatically, arguments to the constructor are mapped to attributes in the widget's DOM according to attribute map. The unit test "attributeMap" in _Widget-attr demonstrates this.

It would be useful to allow attributes in markup to also have the same behavior and get mapped into the widget's DOM, for example:

<div dojoType="dijit.form.Button" class="myClass"></div>

Should retain 'myClass' on this.domNode, or wherever attributeMap says it should go, and be combined with any other classes declared by the template. Right now, "myClass" is clobbered by the template.

This would be useful, particularly for tools which wish to construct and consume widgets from markup.

Attachments (1)

Widget-attr.patch (1.4 KB) - added by Adam Peller 10 years ago.
apply to dijit/tests/_Widget-attr.html

Download all attachments as: .zip

Change History (2)

Changed 10 years ago by Adam Peller

Attachment: Widget-attr.patch added

apply to dijit/tests/_Widget-attr.html

comment:1 Changed 10 years ago by Adam Peller

Resolution: invalid
Status: newclosed

the parser is required for this behavior. attributes don't get carried over when the widget constructor is used directly on a domnode.

Note: See TracTickets for help on using tickets.