Changes between Initial Version and Version 33 of Ticket #13779


Ignore:
Timestamp:
Jan 19, 2012, 11:26:40 AM (9 years ago)
Author:
bill
Comment:

OK, I'm going to close this until/unless we come up with a plan for globals that we all like. The ticket has gotten really long too.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13779

    • Property Cc ben hockey cjolif added
    • Property Status changed from new to closed
    • Property Resolution changed from to wontfix
  • Ticket #13779 – Description

    initial v33  
    1 The AMD conversion tries to eliminate all globals, but the parser still needs them for three cases:
     1The AMD conversion tries to eliminate all globals, but the parser still needs them for two cases:
    22
    3 '''1) data-dojo-type'''
    4 
    5 The value of data-dojo-type/dojoType currently must be a global, ex: data-dojo-type="dijit.form.Button"
    6 
    7 Should be able to specify it as a locale variable or perhaps an MID.
    8 
    9 The local variable solution is the most versatile but rather wordy, for example:
    10 
    11 {{{
    12 require(["dojo/parser", "dijit/form/Button", "dijit/layout/ContentPane"],
    13 function(parser, Button, ContentPane){
    14    parser.parse(dojo.body(), {
    15        scope: {
    16           Button: Button,
    17           ContentPane: ContentPane
    18       }
    19    });
    20 });
    21 
    22 <button data-dojo-type="Button">
    23 <div data-dojo-type="ContentPane">
    24 }}}
    25 
    26 The MID approach (see also #13778) avoids having to pass a map into the parser:
    27 
    28 {{{
    29 require(["dojo/parser", "dijit/form/Button", "dijit/layout/ContentPane"],
    30 function(parser){
    31    parser.parse();
    32 });
    33 
    34 <button data-dojo-type="dijit/form/Button">
    35 <div data-dojo-type="dijit/layout/ContentPane">
    36 }}}
    37 
    38 However, it doesn't support classes created on-the-fly that don't have an MID.   Perhaps both API's should be supported.
    39 
    40 (Note that the above example is different than #13778 since it requires pre-loading of the relevant modules.)
    41 
    42 
    43 '''2) data-dojo-props'''
     3'''1) data-dojo-props'''
    444
    455data-dojo-props, and also individual widget attributes like onClick, often reference globals:
     
    499}}}
    5010
    51 Like above, this could be handled by passing a scope/map to the parser.
     11This could be handled by passing a scope/map to the parser.
    5212
    5313'''3) data-dojo-id'''
     
    6828}}}
    6929
    70 Note that {{{#1}}} and {{{#2}}} could be done today via with:
     30----
    7131
    72 {{{
    73 with({
    74     ComboBox: ComboBox,
    75     myStore: myStore
    76 }){
    77     parser.parse();
    78 }
    79 }}}
    80 
    81 However, it would be nicer to add a feature to the parser to handle it.
     32NOTE: this description was modified from it's original to remove work already done as part of #13778.