Hi Rawld Gill,

While working on migrating our company code to use dojo 1.7 trunk, I noticed
our frontend functional tests (using both selenium-rc and dojo.robot)
starts to fail very frequently in IE: the symptom is onload never fires in
IE (dojo is loaded in an iframe, and due to IE HTA security model, the
iframe can't see anything outside of the iframe thus considers itself as the
top window).

I finally tracked down the problem:

in the trunk dojo.js, we have this:

if(!has("dom-addeventlistener")){
// note: this code courtesy of James
Burke (https://github.com/jrburke/requirejs)
// DOMContentLoaded approximation, as
found by Diego Perini: http://javascript.nwbox.com/IEContentLoaded/
if(self === self.top){
scrollIntervalId =setInterval(function
(){
try{
// From this ticket:
http://bugs.dojotoolkit.org/ticket/11106. In IE HTML Application (HTA),
// such as in a
selenium test, javascript in the iframe can't see anything outside of it,
// so self===self.top
is true, but the iframe is not the top window and doScroll will be
// available before
document.body is set. Test document.body before trying the doScroll trick.
if(doc.body){

doc.documentElement.doScroll("left");
detectPageLoaded();
}
}catch(e){}
}, 30);
}
}

in selenium case (which is HTA), self===self.top is true (while dojo is
actually loaded in an iframe), and the DOMContentLoaded approximation is
triggered. If I comment out this block, then I don't see the loading problem
in IE any more.

In dojo 1.6, this block can actually be disabled if
dojo.config.skipIeDomLoaded is set to true.

Is it ok to change 'if(!has("dom-addeventlistener")){' in the above block to

''if(!has("dom-addeventlistener") && !req.rawConfig.skipIeDomLoaded){'

or is there someway to disable that block via some features in "has"?

regards,
cougar

(BTW: I sent this email twice directly to your email address @altoviso.comand @
earthlink.net but it seems they were never delivered to your inbox somehow)

--
Frontend Lead, teampatent.com
?????????
"People's characters are strengthened through struggle against difficulties;
they are weakened by comfort."
- Old Chinese adage
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20110528/75849a33/attachment.htm

Search Discussions

  • Bryan Forbes at May 28, 2011 at 5:41 pm

    LiuCougar wrote:
    Hi Rawld Gill,

    While working on migrating our company code to use dojo 1.7 trunk, I
    noticed our frontend functional tests (using both selenium-rc and
    dojo.robot) starts to fail very frequently in IE: the symptom is onload
    never fires in IE (dojo is loaded in an iframe, and due to IE HTA
    security model, the iframe can't see anything outside of the iframe thus
    considers itself as the top window).
    I took a look at this today because I'm working on a more accurate
    DOMContentLoaded approximation for Dojo. I wasn't able to reproduce the
    problem, but I think we can avoid the skipIeDomLoaded check. Rather than
    check `self === self.top` which can potentially hang the browser and
    also is true within iframes, why not check `global.frameElement ===
    null`? Something to this effect:

    if(!has("dom-addeventlistener")){
    try{
    // Wrap this in a try/catch because accessing frameElement
    // can throw
    var doScrollCheck = global.frameElement === null;
    }catch(e){}
    if(doScrollCheck){
    /* set up interval here */
    }
    }

    This sets all iframes to use the `onload` event in our code. The patch
    I'm working on will also hook up `onreadystatechange` for better
    detection. Is this an acceptable solution?

    The errors you're seeing also might be triggered by some incorrect calls
    to `win.doc()` in the new dom-geometry.js which was causing
    `dojo._docScroll`, `dojo._getIeDocumentElementOffset`, and
    `dojo._fixIeBiDiScrollLeft` to error out. I've submitted a patch to fix
    it, so that should land soon.

    - --
    Bryan Forbes
    http://www.reigndropsfall.net

    GPG Fingerprint
    3D7D B728 713A BB7B B8B1 5B61 3888 17E0 70CA 0F3D
  • Rawld Gill at May 28, 2011 at 5:51 pm

    On Saturday 28 May 2011 14:41:48 Bryan Forbes wrote:
    LiuCougar wrote:
    Hi Rawld Gill,

    While working on migrating our company code to use dojo 1.7 trunk, I
    noticed our frontend functional tests (using both selenium-rc and
    dojo.robot) starts to fail very frequently in IE: the symptom is onload
    never fires in IE (dojo is loaded in an iframe, and due to IE HTA
    security model, the iframe can't see anything outside of the iframe thus
    considers itself as the top window).
    I took a look at this today because I'm working on a more accurate
    DOMContentLoaded approximation for Dojo. I wasn't able to reproduce the
    problem, but I think we can avoid the skipIeDomLoaded check. Rather than
    check `self === self.top` which can potentially hang the browser and
    also is true within iframes, why not check `global.frameElement ===
    null`? Something to this effect:

    if(!has("dom-addeventlistener")){
    try{
    // Wrap this in a try/catch because accessing frameElement
    // can throw
    var doScrollCheck = global.frameElement === null;
    }catch(e){}
    if(doScrollCheck){
    /* set up interval here */
    }
    }

    This sets all iframes to use the `onload` event in our code. The patch
    I'm working on will also hook up `onreadystatechange` for better
    detection. Is this an acceptable solution?

    The errors you're seeing also might be triggered by some incorrect calls
    to `win.doc()` in the new dom-geometry.js which was causing
    `dojo._docScroll`, `dojo._getIeDocumentElementOffset`, and
    `dojo._fixIeBiDiScrollLeft` to error out. I've submitted a patch to fix
    it, so that should land soon.
    I just committed a fix to dom-geometry for this issue + a missing dependency.
  • Bryan Forbes at May 30, 2011 at 3:42 pm

    Bryan Forbes wrote:
    if(!has("dom-addeventlistener")){
    try{
    // Wrap this in a try/catch because accessing frameElement
    // can throw
    var doScrollCheck = global.frameElement === null;
    }catch(e){}
    if(doScrollCheck){
    /* set up interval here */
    }
    }
    After thinking about this and adding a "readystatechange" poller in
    certain situations in the domReady module I'm devising, I came up with a
    much better solution:

    ======
    var div = document.createElement("div"),
    detectDoScroll = function(){
    try{
    div.doScroll('left');
    return 1;
    }catch(e){}
    };

    if(div.doScroll && !detectDoScroll()){
    /* add to interval checks here */
    }
    ======

    This way we test if `div.doScroll` actually throws and only set up the
    test if it does. This way we're not relying on an inference that could
    fail for some browsers or in iframes (like `self === self.top` or
    `global.frameElement === null`), but rather testing for the condition
    we're checking. What do you think?

    - --
    Bryan Forbes
    http://www.reigndropsfall.net

    GPG Fingerprint
    3D7D B728 713A BB7B B8B1 5B61 3888 17E0 70CA 0F3D
  • LiuCougar at May 30, 2011 at 6:01 pm

    On Mon, May 30, 2011 at 12:42, Bryan Forbes wrote:

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Bryan Forbes wrote:
    if(!has("dom-addeventlistener")){
    try{
    // Wrap this in a try/catch because accessing frameElement
    // can throw
    var doScrollCheck = global.frameElement === null;
    }catch(e){}
    if(doScrollCheck){
    /* set up interval here */
    }
    }
    After thinking about this and adding a "readystatechange" poller in
    certain situations in the domReady module I'm devising, I came up with a
    much better solution:

    ======
    var div = document.createElement("div"),
    even if div is not attached to the document, doScroll on it will still work
    as expected?


    detectDoScroll = function(){
    try{
    div.doScroll('left');
    return 1;
    }catch(e){}
    };

    if(div.doScroll && !detectDoScroll()){
    /* add to interval checks here */
    }
    ======

    This way we test if `div.doScroll` actually throws and only set up the
    test if it does. This way we're not relying on an inference that could
    fail for some browsers or in iframes (like `self === self.top` or
    `global.frameElement === null`), but rather testing for the condition
    we're checking. What do you think?

    - --
    Bryan Forbes
    http://www.reigndropsfall.net

    GPG Fingerprint
    3D7D B728 713A BB7B B8B1 5B61 3888 17E0 70CA 0F3D
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.11 (Darwin)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iEYEARECAAYFAk3j8z4ACgkQOIgX4HDKDz1WxACbBETHeO6LzwgukKDa8qvRuajY
    scUAoLp6zdX1oAyOszMOtFFV5bXGjH+M
    =FkV3
    -----END PGP SIGNATURE-----
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors


    --
    Frontend Lead, teampatent.com
    ?????????
    "People's characters are strengthened through struggle against difficulties;
    they are weakened by comfort."
    - Old Chinese adage
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20110530/dc812d0e/attachment.htm
  • Bryan Forbes at May 30, 2011 at 6:34 pm

    LiuCougar wrote:
    even if div is not attached to the document, doScroll on it will still
    work as expected?
    Yes.

    http://msdn.microsoft.com/en-us/library/ms531426.aspx#Component_Initialization

    The sentence I want to point out is this:
    "A few methods, such as doScroll, require the primary document to be
    completely loaded. If these methods are part of an initialization
    function, they should be handled when the ondocumentready event fires."

    This is in reference to components which define behaviors for elements.
    Even though this is a bit ambiguous, I just tested it and it does throw
    until the document is ready.

    - --
    Bryan Forbes
    http://www.reigndropsfall.net

    GPG Fingerprint
    3D7D B728 713A BB7B B8B1 5B61 3888 17E0 70CA 0F3D
  • LiuCougar at May 30, 2011 at 6:40 pm
    cool, good to know.

    so in iframe case, doScroll will fail until ondocumentready event fires in
    the iframe, independent of the parent document containing the iframe?

    the problem with dojo loading in HTA iframes is that: doScroll actually does
    not throw any error before the DOM is ready within the iframe (I guess it
    just checks whether parent document DOM is ready), which causes dojo to
    trigger ready event too early (that leads to failed initialization of all
    widgets on the page)
    On Mon, May 30, 2011 at 15:34, Bryan Forbes wrote:

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    LiuCougar wrote:
    even if div is not attached to the document, doScroll on it will still
    work as expected?
    Yes.


    http://msdn.microsoft.com/en-us/library/ms531426.aspx#Component_Initialization

    The sentence I want to point out is this:
    "A few methods, such as doScroll, require the primary document to be
    completely loaded. If these methods are part of an initialization
    function, they should be handled when the ondocumentready event fires."

    This is in reference to components which define behaviors for elements.
    Even though this is a bit ambiguous, I just tested it and it does throw
    until the document is ready.

    - --
    Bryan Forbes
    http://www.reigndropsfall.net

    GPG Fingerprint
    3D7D B728 713A BB7B B8B1 5B61 3888 17E0 70CA 0F3D
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.11 (Darwin)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iEYEARECAAYFAk3kG4IACgkQOIgX4HDKDz2MFgCeNy+e/xEPH07BZMtzi8olDRvV
    M7UAoIWAOSvUkM6UnlmTs6Y7IAQCBT6q
    =U09Y
    -----END PGP SIGNATURE-----
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors


    --
    Frontend Lead, teampatent.com
    ?????????
    "People's characters are strengthened through struggle against difficulties;
    they are weakened by comfort."
    - Old Chinese adage
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20110530/bdf758f7/attachment-0001.htm
  • Bryan Forbes at May 30, 2011 at 6:51 pm

    LiuCougar wrote:
    cool, good to know.

    so in iframe case, doScroll will fail until ondocumentready event fires
    in the iframe, independent of the parent document containing the iframe?

    the problem with dojo loading in HTA iframes is that: doScroll actually
    does not throw any error before the DOM is ready within the iframe (I
    guess it just checks whether parent document DOM is ready), which causes
    dojo to trigger ready event too early (that leads to failed
    initialization of all widgets on the page)
    Right. So what the code does is run the `doScroll` check once to see if
    it throws. It goes something like this:

    ======
    var tests = [],
    ready = 0,
    div = document.createElement('div'),
    detectDoScroll = function(){
    try{
    div.doScroll();
    return 1;
    }catch(e){}
    };

    if(div.doScroll && !detectDoScroll()){
    tests.push(detectDoScroll);
    }

    /* set up some listeners and possibly a few more things in tests here */

    if(tests.length){
    poller = function(){
    if(ready){ return; }
    var i = tests.length;
    while(i--){
    if(tests[i]()){
    triggerDomReady();
    return;
    }
    }
    setTimeout(poller, 30);
    };
    poller();
    }
    ======

    As you can see, if `detectDoScroll()` returns true (meaning `doScroll`
    didn't throw), it completely skips trying to poll for it which will keep
    it from triggering the ready state to soon in HTA iframes in IE.

    - --
    Bryan Forbes
    http://www.reigndropsfall.net

    GPG Fingerprint
    3D7D B728 713A BB7B B8B1 5B61 3888 17E0 70CA 0F3D
  • LiuCougar at May 30, 2011 at 7:01 pm
    I see, that sounds like it should work in HTA mode properly
    On Mon, May 30, 2011 at 15:51, Bryan Forbes wrote:

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    LiuCougar wrote:
    cool, good to know.

    so in iframe case, doScroll will fail until ondocumentready event fires
    in the iframe, independent of the parent document containing the iframe?

    the problem with dojo loading in HTA iframes is that: doScroll actually
    does not throw any error before the DOM is ready within the iframe (I
    guess it just checks whether parent document DOM is ready), which causes
    dojo to trigger ready event too early (that leads to failed
    initialization of all widgets on the page)
    Right. So what the code does is run the `doScroll` check once to see if
    it throws. It goes something like this:

    ======
    var tests = [],
    ready = 0,
    div = document.createElement('div'),
    detectDoScroll = function(){
    try{
    div.doScroll();
    return 1;
    }catch(e){}
    };

    if(div.doScroll && !detectDoScroll()){
    tests.push(detectDoScroll);
    }

    /* set up some listeners and possibly a few more things in tests here */

    if(tests.length){
    poller = function(){
    if(ready){ return; }
    var i = tests.length;
    while(i--){
    if(tests[i]()){
    triggerDomReady();
    return;
    }
    }
    setTimeout(poller, 30);
    };
    poller();
    }
    ======

    As you can see, if `detectDoScroll()` returns true (meaning `doScroll`
    didn't throw), it completely skips trying to poll for it which will keep
    it from triggering the ready state to soon in HTA iframes in IE.

    - --
    Bryan Forbes
    http://www.reigndropsfall.net

    GPG Fingerprint
    3D7D B728 713A BB7B B8B1 5B61 3888 17E0 70CA 0F3D
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.11 (Darwin)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iEYEARECAAYFAk3kH3wACgkQOIgX4HDKDz28tACgrLX2dEW8nohvZp3lPYndV+WK
    qtUAniAjYvAuE//Pl/YeZZC3C2w1zK79
    =w0Pl
    -----END PGP SIGNATURE-----
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors


    --
    Frontend Lead, teampatent.com
    ?????????
    "People's characters are strengthened through struggle against difficulties;
    they are weakened by comfort."
    - Old Chinese adage
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20110530/863743f0/attachment.htm
  • Rawld Gill at May 30, 2011 at 7:49 pm
    With [25266] all of Bryan's work on DOMContentLoaded is checked in and
    operational. See http://trac.dojotoolkit.org/ticket/13113 for details.

    Cougar: could you update your trunk and let us know what you see.

    Thanks,
    Rawld

    On Monday 30 May 2011 16:01:18 LiuCougar wrote:
    I see, that sounds like it should work in HTA mode properly
    On Mon, May 30, 2011 at 15:51, Bryan Forbes wrote:
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    LiuCougar wrote:
    cool, good to know.

    so in iframe case, doScroll will fail until ondocumentready event fires
    in the iframe, independent of the parent document containing the
    iframe?

    the problem with dojo loading in HTA iframes is that: doScroll actually
    does not throw any error before the DOM is ready within the iframe (I
    guess it just checks whether parent document DOM is ready), which
    causes dojo to trigger ready event too early (that leads to failed
    initialization of all widgets on the page)
    Right. So what the code does is run the `doScroll` check once to see if
    it throws. It goes something like this:

    ======
    var tests = [],

    ready = 0,
    div = document.createElement('div'),
    detectDoScroll = function(){

    try{

    div.doScroll();

    return 1;

    }catch(e){}

    };

    if(div.doScroll && !detectDoScroll()){

    tests.push(detectDoScroll);

    }

    /* set up some listeners and possibly a few more things in tests here */

    if(tests.length){

    poller = function(){

    if(ready){ return; }
    var i = tests.length;
    while(i--){

    if(tests[i]()){

    triggerDomReady();
    return;

    }

    }
    setTimeout(poller, 30);

    };
    poller();

    }
    ======

    As you can see, if `detectDoScroll()` returns true (meaning `doScroll`
    didn't throw), it completely skips trying to poll for it which will keep
    it from triggering the ready state to soon in HTA iframes in IE.

    - --
    Bryan Forbes
    http://www.reigndropsfall.net

    GPG Fingerprint
    3D7D B728 713A BB7B B8B1 5B61 3888 17E0 70CA 0F3D
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.11 (Darwin)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iEYEARECAAYFAk3kH3wACgkQOIgX4HDKDz28tACgrLX2dEW8nohvZp3lPYndV+WK
    qtUAniAjYvAuE//Pl/YeZZC3C2w1zK79
    =w0Pl
    -----END PGP SIGNATURE-----
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
  • Chris Mitchell at May 31, 2011 at 12:37 am
    many dojox/mobile tests and most mobile demos are broken as of
    25266... gfx seems to be working ok, but need platform tests rerun.
    I'm guessing the init logic in dojox/mobile.js and
    dojox/mobile/compat.js, dojox/mobile/parser.js may need to be looked
    at to see if there's an obvious fix.
    On Mon, May 30, 2011 at 7:49 PM, Rawld Gill wrote:
    With [25266] all of Bryan's work on DOMContentLoaded is checked in and
    operational. See http://trac.dojotoolkit.org/ticket/13113 for details.

    Cougar: could you update your trunk and let us know what you see.

    Thanks,
    Rawld

    On Monday 30 May 2011 16:01:18 LiuCougar wrote:
    I see, that sounds like it should work in HTA mode properly
    On Mon, May 30, 2011 at 15:51, Bryan Forbes wrote:
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    LiuCougar wrote:
    cool, good to know.

    so in iframe case, doScroll will fail until ondocumentready event fires
    in the iframe, independent of the parent document containing the
    iframe?

    the problem with dojo loading in HTA iframes is that: doScroll actually
    does not throw any error before the DOM is ready within the iframe (I
    guess it just checks whether parent document DOM is ready), which
    causes dojo to trigger ready event too early (that leads to failed
    initialization of all widgets on the page)
    Right. So what the code does is run the `doScroll` check once to see if
    it throws. It goes something like this:

    ======
    var tests = [],

    ? ?ready = 0,
    ? ?div = document.createElement('div'),
    ? ?detectDoScroll = function(){

    ? ? ? ?try{

    ? ? ? ? ? ?div.doScroll();

    ? ? ? ? ? ? return 1;

    ? ? ? ?}catch(e){}

    ? ?};

    if(div.doScroll && !detectDoScroll()){

    ? ? tests.push(detectDoScroll);

    }

    /* set up some listeners and possibly a few more things in tests here */

    if(tests.length){

    ? ?poller = function(){

    ? ? ? ?if(ready){ return; }
    ? ? ? ?var i = tests.length;
    ? ? ? ?while(i--){

    ? ? ? ? ? ?if(tests[i]()){

    ? ? ? ? ? ? ? ?triggerDomReady();
    ? ? ? ? ? ? ? ?return;

    ? ? ? ? ? ?}

    ? ? ? ?}
    ? ? ? ?setTimeout(poller, 30);

    ? ?};
    ? ?poller();

    }
    ======

    As you can see, if `detectDoScroll()` returns true (meaning `doScroll`
    didn't throw), it completely skips trying to poll for it which will keep
    it from triggering the ready state to soon in HTA iframes in IE.

    - --
    Bryan Forbes
    http://www.reigndropsfall.net

    GPG Fingerprint
    3D7D B728 713A BB7B B8B1 ?5B61 3888 17E0 70CA 0F3D
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.11 (Darwin)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iEYEARECAAYFAk3kH3wACgkQOIgX4HDKDz28tACgrLX2dEW8nohvZp3lPYndV+WK
    qtUAniAjYvAuE//Pl/YeZZC3C2w1zK79
    =w0Pl
    -----END PGP SIGNATURE-----
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
  • Chris Mitchell at May 31, 2011 at 12:51 am
    still broken as of r25274. appears to be any of our mobile tests and
    demos that are using async
    rather than sync loader.
    dojox/mobile/tests/*-async.html and demos/mobile*

    On Tue, May 31, 2011 at 12:37 AM, Chris Mitchell
    wrote:
    many dojox/mobile tests and most mobile demos are broken as of
    25266... gfx seems to be working ok, but need platform tests rerun.
    I'm guessing the init logic in dojox/mobile.js and
    dojox/mobile/compat.js, dojox/mobile/parser.js may need to be looked
    at to see if there's an obvious fix.
    On Mon, May 30, 2011 at 7:49 PM, Rawld Gill wrote:
    With [25266] all of Bryan's work on DOMContentLoaded is checked in and
    operational. See http://trac.dojotoolkit.org/ticket/13113 for details.

    Cougar: could you update your trunk and let us know what you see.

    Thanks,
    Rawld

    On Monday 30 May 2011 16:01:18 LiuCougar wrote:
    I see, that sounds like it should work in HTA mode properly
    On Mon, May 30, 2011 at 15:51, Bryan Forbes wrote:
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    LiuCougar wrote:
    cool, good to know.

    so in iframe case, doScroll will fail until ondocumentready event fires
    in the iframe, independent of the parent document containing the
    iframe?

    the problem with dojo loading in HTA iframes is that: doScroll actually
    does not throw any error before the DOM is ready within the iframe (I
    guess it just checks whether parent document DOM is ready), which
    causes dojo to trigger ready event too early (that leads to failed
    initialization of all widgets on the page)
    Right. So what the code does is run the `doScroll` check once to see if
    it throws. It goes something like this:

    ======
    var tests = [],

    ? ?ready = 0,
    ? ?div = document.createElement('div'),
    ? ?detectDoScroll = function(){

    ? ? ? ?try{

    ? ? ? ? ? ?div.doScroll();

    ? ? ? ? ? ? return 1;

    ? ? ? ?}catch(e){}

    ? ?};

    if(div.doScroll && !detectDoScroll()){

    ? ? tests.push(detectDoScroll);

    }

    /* set up some listeners and possibly a few more things in tests here */

    if(tests.length){

    ? ?poller = function(){

    ? ? ? ?if(ready){ return; }
    ? ? ? ?var i = tests.length;
    ? ? ? ?while(i--){

    ? ? ? ? ? ?if(tests[i]()){

    ? ? ? ? ? ? ? ?triggerDomReady();
    ? ? ? ? ? ? ? ?return;

    ? ? ? ? ? ?}

    ? ? ? ?}
    ? ? ? ?setTimeout(poller, 30);

    ? ?};
    ? ?poller();

    }
    ======

    As you can see, if `detectDoScroll()` returns true (meaning `doScroll`
    didn't throw), it completely skips trying to poll for it which will keep
    it from triggering the ready state to soon in HTA iframes in IE.

    - --
    Bryan Forbes
    http://www.reigndropsfall.net

    GPG Fingerprint
    3D7D B728 713A BB7B B8B1 ?5B61 3888 17E0 70CA 0F3D
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.11 (Darwin)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iEYEARECAAYFAk3kH3wACgkQOIgX4HDKDz28tACgrLX2dEW8nohvZp3lPYndV+WK
    qtUAniAjYvAuE//Pl/YeZZC3C2w1zK79
    =w0Pl
    -----END PGP SIGNATURE-----
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
  • Bill Keese at May 31, 2011 at 12:55 am
    Yes, looks like require.ready() is undefined.
    On Tue, May 31, 2011 at 1:51 PM, Chris Mitchell wrote:

    still broken as of r25274. appears to be any of our mobile tests and
    demos that are using async
    rather than sync loader.
    dojox/mobile/tests/*-async.html and demos/mobile*

    On Tue, May 31, 2011 at 12:37 AM, Chris Mitchell
    wrote:
    many dojox/mobile tests and most mobile demos are broken as of
    25266... gfx seems to be working ok, but need platform tests rerun.
    I'm guessing the init logic in dojox/mobile.js and
    dojox/mobile/compat.js, dojox/mobile/parser.js may need to be looked
    at to see if there's an obvious fix.
    On Mon, May 30, 2011 at 7:49 PM, Rawld Gill wrote:
    With [25266] all of Bryan's work on DOMContentLoaded is checked in and
    operational. See http://trac.dojotoolkit.org/ticket/13113 for details.

    Cougar: could you update your trunk and let us know what you see.

    Thanks,
    Rawld

    On Monday 30 May 2011 16:01:18 LiuCougar wrote:
    I see, that sounds like it should work in HTA mode properly

    On Mon, May 30, 2011 at 15:51, Bryan Forbes <bryan at reigndropsfall.net
    wrote:
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    LiuCougar wrote:
    cool, good to know.

    so in iframe case, doScroll will fail until ondocumentready event
    fires
    in the iframe, independent of the parent document containing the
    iframe?

    the problem with dojo loading in HTA iframes is that: doScroll
    actually
    does not throw any error before the DOM is ready within the iframe
    (I
    guess it just checks whether parent document DOM is ready), which
    causes dojo to trigger ready event too early (that leads to failed
    initialization of all widgets on the page)
    Right. So what the code does is run the `doScroll` check once to see
    if
    it throws. It goes something like this:

    ======
    var tests = [],

    ready = 0,
    div = document.createElement('div'),
    detectDoScroll = function(){

    try{

    div.doScroll();

    return 1;

    }catch(e){}

    };

    if(div.doScroll && !detectDoScroll()){

    tests.push(detectDoScroll);

    }

    /* set up some listeners and possibly a few more things in tests here
    */
    if(tests.length){

    poller = function(){

    if(ready){ return; }
    var i = tests.length;
    while(i--){

    if(tests[i]()){

    triggerDomReady();
    return;

    }

    }
    setTimeout(poller, 30);

    };
    poller();

    }
    ======

    As you can see, if `detectDoScroll()` returns true (meaning
    `doScroll`
    didn't throw), it completely skips trying to poll for it which will
    keep
    it from triggering the ready state to soon in HTA iframes in IE.

    - --
    Bryan Forbes
    http://www.reigndropsfall.net

    GPG Fingerprint
    3D7D B728 713A BB7B B8B1 5B61 3888 17E0 70CA 0F3D
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.11 (Darwin)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iEYEARECAAYFAk3kH3wACgkQOIgX4HDKDz28tACgrLX2dEW8nohvZp3lPYndV+WK
    qtUAniAjYvAuE//Pl/YeZZC3C2w1zK79
    =w0Pl
    -----END PGP SIGNATURE-----
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20110531/391bff7f/attachment.htm
  • Rawld Gill at May 31, 2011 at 1:37 am
    Repaired in r25274 and r25275
    On Monday 30 May 2011 21:55:14 Bill Keese wrote:
    Yes, looks like require.ready() is undefined.

    On Tue, May 31, 2011 at 1:51 PM, Chris Mitchell
    wrote:
    still broken as of r25274. appears to be any of our mobile tests and
    demos that are using async
    rather than sync loader.
    dojox/mobile/tests/*-async.html and demos/mobile*

    On Tue, May 31, 2011 at 12:37 AM, Chris Mitchell
  • Chris Mitchell at May 31, 2011 at 1:50 am
    Looks good, thx rawld!
    On Tue, May 31, 2011 at 1:37 AM, Rawld Gill wrote:
    Repaired in r25274 and r25275
    On Monday 30 May 2011 21:55:14 Bill Keese wrote:
    Yes, looks like require.ready() is undefined.

    On Tue, May 31, 2011 at 1:51 PM, Chris Mitchell
    wrote:
    still broken as of r25274. appears to be any of our mobile tests and
    demos that are using async
    rather than sync loader.
    dojox/mobile/tests/*-async.html and demos/mobile*

    On Tue, May 31, 2011 at 12:37 AM, Chris Mitchell
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
  • LiuCougar at May 31, 2011 at 2:54 pm
    tried r25267 with our selenium tests, it works fine (no loading issues)

    thanks
    On Mon, May 30, 2011 at 16:49, Rawld Gill wrote:

    With [25266] all of Bryan's work on DOMContentLoaded is checked in and
    operational. See http://trac.dojotoolkit.org/ticket/13113 for details.

    Cougar: could you update your trunk and let us know what you see.

    Thanks,
    Rawld

    On Monday 30 May 2011 16:01:18 LiuCougar wrote:
    I see, that sounds like it should work in HTA mode properly

    On Mon, May 30, 2011 at 15:51, Bryan Forbes <bryan at reigndropsfall.net
    wrote:
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    LiuCougar wrote:
    cool, good to know.

    so in iframe case, doScroll will fail until ondocumentready event
    fires
    in the iframe, independent of the parent document containing the
    iframe?

    the problem with dojo loading in HTA iframes is that: doScroll
    actually
    does not throw any error before the DOM is ready within the iframe (I
    guess it just checks whether parent document DOM is ready), which
    causes dojo to trigger ready event too early (that leads to failed
    initialization of all widgets on the page)
    Right. So what the code does is run the `doScroll` check once to see if
    it throws. It goes something like this:

    ======
    var tests = [],

    ready = 0,
    div = document.createElement('div'),
    detectDoScroll = function(){

    try{

    div.doScroll();

    return 1;

    }catch(e){}

    };

    if(div.doScroll && !detectDoScroll()){

    tests.push(detectDoScroll);

    }

    /* set up some listeners and possibly a few more things in tests here
    */
    if(tests.length){

    poller = function(){

    if(ready){ return; }
    var i = tests.length;
    while(i--){

    if(tests[i]()){

    triggerDomReady();
    return;

    }

    }
    setTimeout(poller, 30);

    };
    poller();

    }
    ======

    As you can see, if `detectDoScroll()` returns true (meaning `doScroll`
    didn't throw), it completely skips trying to poll for it which will
    keep
    it from triggering the ready state to soon in HTA iframes in IE.

    - --
    Bryan Forbes
    http://www.reigndropsfall.net

    GPG Fingerprint
    3D7D B728 713A BB7B B8B1 5B61 3888 17E0 70CA 0F3D
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.11 (Darwin)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iEYEARECAAYFAk3kH3wACgkQOIgX4HDKDz28tACgrLX2dEW8nohvZp3lPYndV+WK
    qtUAniAjYvAuE//Pl/YeZZC3C2w1zK79
    =w0Pl
    -----END PGP SIGNATURE-----
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors


    --
    Frontend Lead, teampatent.com
    ?????????
    "People's characters are strengthened through struggle against difficulties;
    they are weakened by comfort."
    - Old Chinese adage
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20110531/050796e1/attachment-0001.htm

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdojo-contributors @
categoriesdojo
postedMay 28, '11 at 2:29p
activeMay 31, '11 at 2:54p
posts16
users5
websitedojotoolkit.org

People

Translate

site design / logo © 2022 Grokbase