Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#16303 closed defect (fixed)

Declaration: bug using data-dojo-args attribute

Reported by: gorgoroth Owned by: bill
Priority: undecided Milestone: 1.9
Component: Dijit Version: 1.8.1
Keywords: Cc:
Blocked By: Blocking:

Description

Using Declaration module to create a widget class declaratively and adding a dojo/method which accepts arguments, fails if arguments are defined using the data-dojo-args attribute. It works using the old args attribute.

This bug is caused by the buildRendering() method in Declaration.js which calls parser._functionFromScript() passing only the script but no the attrData.

A possible and simple solution could be to pass "data-dojo-" as the second argument to parser._functionFromScript() because Declaration seems to use general data-dojo-XXX attributes (particularly "data-dojo-event").

A better solution could be taking into account the parser scope name: so the Declaration module could, in some way, ask the parser the scope name and use it in his internal code and pass it to parser._functionFromScript(). This would allow to use custom HTML5 attributes with Declaration (es data-mywidget-args instead of data-dojo-args).

Change History (4)

comment:1 Changed 6 years ago by bill

Resolution: fixed
Status: newclosed

In [29910]:

Fix data-dojo-args usage with Declaration, fixes #16303 !strict.

comment:2 Changed 6 years ago by bill

Milestone: tbd1.9

Thanks, I did the simple fix for now.

As you said, Declaration is hardcoded to data-dojo-* attribute names. Scope is something that was needed for multi-version support, specifically for aliasing dojoType (dojo16Type vs dojo17Type). I don't see a reason to use scope in other attribute names like data-dojo-args. As an aside, I'm not sure scope is even important for dojoType, as that implies that one would run the 1.6 parser over the entire page, rather than just the section containing 1.6 widgets.

comment:3 Changed 6 years ago by bill

Component: ParserDijit
Summary: Bug in Declaration module using data-dojo-args attributeDeclaration: bug using data-dojo-args attribute

comment:4 Changed 6 years ago by bill

#16998 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.