Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#9832 closed task (fixed)

Use dojo.cache() rather than templatePath

Reported by: bill Owned by: bill
Priority: high Milestone: 1.4
Component: Dijit Version: 1.3.2
Keywords: Cc:
Blocked By: Blocking:

Description

Convert the widgets to use templateString and dojo.cache(), like this:

templateString: dojo.cache("dijit", "templates/Calendar.html"),

instead of using templatePath:

templatePath: dojo.moduleUrl("dijit", "templates/Calendar.html"),

templatePath will still be supported for backwards-compatibility, but switching to use templateString across dijit will make it easier to subclass widgets since developers won't need to worry about the templatePath/templateString duality where code like

dojo.declare("myWidget", [superclass],
   templatePath: dojo.moduleUrl("dijit", "templates/Calendar.html"),
   ...

will fail if the superclass either directly defines templateString, or it's part of a build layer. In other words, using dojo.cache() eliminates the need for widgets to define both templatePath and templateString:

templatePath: dojo.moduleUrl("acme", "templates/MyCalendar.html"),
templateString: null

See #9341 about dojo.cache() itself.

Change History (2)

comment:1 Changed 10 years ago by bill

Resolution: fixed
Status: newclosed

(In [20022]) Convert widget code to use templateString: dojo.cache(...) rather than templatePath. Fixes #9832 !strict.

comment:2 Changed 10 years ago by bill

(In [20749]) Remove duplicate templateString declaration, refs #9832 !strict.

Note: See TracTickets for help on using tickets.