Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#11325 closed enhancement (invalid)

Allow "data-" attributes in dijit widgets

Reported by: peirix Owned by: bill
Priority: high Milestone: tbd
Component: Parser Version: 1.4.2
Keywords: dijit html5 data attribute Cc:
Blocked by: Blocking:


When creating a dijit widget with some custom HTML5 "data-" attributes, they are removed in the widget, which is really unlucky as I have javascript that uses these "data-" attributes for hooks and information.

Change History (5)

comment:1 Changed 7 years ago by markwubben

Dijits replace the original DOM node by that in the template, so typically custom attributes (unless defined on the Dijit class) don't survive.

Personally I prefer to treat data-* attributes as regular custom attributes which Dijit picks up, rather than as special attributes that are re-added to the rendered Dijit's domNode.

What is your JavaScript doing that needs these attributes on the domNode, and are you perhaps better served by creating a subclass of the widget in question?

comment:2 Changed 7 years ago by peirix

Right now I'm using it to store a url inside a button that sits in a form. The url is used to do a AJAX call to somewhere else than the form action url.

comment:3 Changed 7 years ago by bill

  • Component changed from Dijit to Parser
  • Owner set to bill
  • severity changed from major to normal
  • Type changed from defect to enhancement

I don't understand your description, please attach a test case.

It seems like you've defined a custom widget with attributes like

// widget's URL parameter
"data-url": ""

and then you are using the parser in conjunction with markup like this?

<div dojoType="myButton" data-url="my url">

comment:4 Changed 7 years ago by bill

  • Resolution set to invalid
  • Status changed from new to closed

Closing for lack of test case, please reopen after attaching one.

comment:5 Changed 7 years ago by bill

See also #11490.

Note: See TracTickets for help on using tickets.