I updated http://bugs.dojotoolkit.org/browser/dojo/trunk/tests/_base/fx.htmlto
the recommended style from the meeting, as I understand it:

require(["dojo", "doh", "domReady!"], function(dojo, doh){
...
doh.run();
});

Rawld, does that look OK?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20110512/a4180a1a/attachment.htm

Search Discussions

  • Bill Keese at May 11, 2011 at 10:30 pm
    PS: I realized that there's an issue with modules that call
    dojo.addOnLoad(), and expect the addOnLoad() callback to execute before any
    application code executes.

    ----
    For example, behavior.js does:

    dojo.addOnLoad(dojo.behavior, "apply");

    Probably, that module should be changed to:

    define(["./main", "domReady!"], function(dojo) {
    ...
    dojo.behavior.apply();
    return dojo.behavior;
    });

    What do you think?
    ---

    dijit/hccss.js also registers code via dojo.ready() and I think that module
    too should be changed as above.


    On Thu, May 12, 2011 at 8:51 AM, Bill Keese wrote:

    I updated
    http://bugs.dojotoolkit.org/browser/dojo/trunk/tests/_base/fx.html to the
    recommended style from the meeting, as I understand it:

    require(["dojo", "doh", "domReady!"], function(dojo, doh){
    ...
    doh.run();
    });

    Rawld, does that look OK?
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20110512/7b8164f2/attachment.htm
  • Bill Keese at May 12, 2011 at 6:26 am
    Argh, using domReady! breaks compatibility mode (ie, apps still using
    dojo.require()).

    I tried changing uacss.js etc. to use domReady! instead of require.ready(),
    but then dojo.require("dijit._Widget") no longer executes synchronously.
    In retrospect this isn't surprising since it's impossible to simultaneously
    execute synchronously and wait for the DOM to load.

    The broken test file was _Templated-widgetsInTemplate1.x.html, with the
    salient code:

    <html>
    <head>
    ...
    <script type="text/javascript">
    ...
    dojo.require("dijit._Widget");
    ...
    </script>
    </head>
    <body class="claro">
    ...
    <script>
    dojo.declare('Test3Widget',
    [dijit._Widget, dijit._Templated],
    ...

    When the dojo.declare() executes, dijit._Widget (which depends on uacss.js)
    isn't defined yet, or technically speaking, it's an Object (a plain hash
    object) rather than a Function.

    So I guess we are stuck with using dojo.ready() with priorities, and
    continue telling app writers to use dojo.ready() (or require.ready()),
    rather than using domReady! ?

    On Thu, May 12, 2011 at 11:30 AM, Bill Keese wrote:

    PS: I realized that there's an issue with modules that call
    dojo.addOnLoad(), and expect the addOnLoad() callback to execute before any
    application code executes.

    ----
    For example, behavior.js does:

    dojo.addOnLoad(dojo.behavior, "apply");

    Probably, that module should be changed to:

    define(["./main", "domReady!"], function(dojo) {
    ...
    dojo.behavior.apply();
    return dojo.behavior;
    });

    What do you think?
    ---

    dijit/hccss.js also registers code via dojo.ready() and I think that module
    too should be changed as above.


    On Thu, May 12, 2011 at 8:51 AM, Bill Keese wrote:

    I updated
    http://bugs.dojotoolkit.org/browser/dojo/trunk/tests/_base/fx.html to the
    recommended style from the meeting, as I understand it:

    require(["dojo", "doh", "domReady!"], function(dojo, doh){
    ...
    doh.run();
    });

    Rawld, does that look OK?
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20110512/9ec81de6/attachment-0001.htm
  • Rawld Gill at May 12, 2011 at 7:19 am

    On Wednesday 11 May 2011 19:30:44 Bill Keese wrote:
    PS: I realized that there's an issue with modules that call
    dojo.addOnLoad(), and expect the addOnLoad() callback to execute before any
    application code executes.

    ----
    For example, behavior.js does:

    dojo.addOnLoad(dojo.behavior, "apply");

    Probably, that module should be changed to:

    define(["./main", "domReady!"], function(dojo) {
    ...
    dojo.behavior.apply();
    return dojo.behavior;
    });

    What do you think?
    ---
    This is a little trickier. To recap:

    The domReady! plugin won't signal the loader (by calling loaded) until the DOM
    is ready. Therefore, when domReady! is in a deps vector, the callback (in the
    case of require) or the factory (in the case of define) won't be executed
    until the dom is ready (and all other modules in the deps vector have been
    defined, if any).

    otoh, dojo.ready/require.ready won't execute the callback until the loader
    reaches a state where all requested modules have been defined and the dom is
    ready.

    dojo.ready/require.ready is much "looser" in that the caller is basically
    saying, "I don't know exactly what's been requested but is not yet defined;
    And I certainly don't know if the outstanding requests will generate yet more
    requests; but whatever the case, don't do anything until the loader has
    completely defined every single request." I think this is the kind of behavior
    you probably want with the parser.

    One example is the parser, uacss, and wai interaction. It was my understanding
    that we couldn't completely predict during the parser factory execution if
    either of both of uacss or wai would eventually be defined (or visa-versa).
    But if they were, they needed to run before the parser. That was the idea
    behind the priority ready queue. If you know exactly what is going to be
    defined, then you can ensure order with deps vectors and domReady!.

    I think you might not always know with dojo.behavior...but I'm not an expert
    on that.

    Hope that helps.
  • Rawld Gill at May 12, 2011 at 6:55 am

    On Wednesday 11 May 2011 16:51:05 Bill Keese wrote:
    I updated
    http://bugs.dojotoolkit.org/browser/dojo/trunk/tests/_base/fx.htmlto the
    recommended style from the meeting, as I understand it:

    require(["dojo", "doh", "domReady!"], function(dojo, doh){
    ...
    doh.run();
    });

    Rawld, does that look OK?
    Looks good.
  • Bill Keese at May 14, 2011 at 3:55 am
    I guess the syntax below is good for dojo/core. Sadly it won't work
    for anything using dijit because the parser/uacss/hccss code doesn't
    run until dojo.ready() fires the handlers in it's priority queue. I
    could update the core tests to use the syntax below although, maybe
    it's not worth it.
    On Thu, May 12, 2011 at 7:55 PM, Rawld Gill wrote:
    On Wednesday 11 May 2011 16:51:05 Bill Keese wrote:
    I updated
    http://bugs.dojotoolkit.org/browser/dojo/trunk/tests/_base/fx.htmlto the
    recommended style from the meeting, as I understand it:

    require(["dojo", "doh", "domReady!"], function(dojo, doh){
    ...
    doh.run();
    });

    Rawld, does that look OK?
    Looks good.
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdojo-contributors @
categoriesdojo
postedMay 11, '11 at 7:51p
activeMay 14, '11 at 3:55a
posts6
users2
websitedojotoolkit.org

2 users in discussion

Bill Keese: 4 posts Rawld Gill: 2 posts

People

Translate

site design / logo © 2022 Grokbase