Hi,

Another regression I just noticed with the trunk. Not sure what is the
exact revision where the problem appeared (maybe 24185 ?), but it used
to work until recently.

The dojo parser fails to parse declarations like the following on IE:

<button dojoType="dijit.form.Button" onClick="buttonClicked">Click me</button>

It seems it could be solved (in parser.js, l.160) by calling
node.getAttributeNode(lcName).value instead of
node.getAttribute(lcName)when the attribute value is a function:
getAttribute returns an invalid function, whereas
getAttributeNode().value returns the function name as a string.

Let me know if you need a test case, or if you prefer I open a ticket.

--
Patrick

Search Discussions

  • Bill Keese at Apr 28, 2011 at 9:07 am
    Oh that's not good, I'll fix, thanks for catching it. Probably your
    suggestion to use getAttributeNode() would be an improvement, but note the
    parser does have code to deal with that "invalid function" thing:

    if(d.isFunction(value)){
    // IE gives us a function, even when we say something like onClick="foo"
    // (in which case it gives us an invalid function "function(){ foo }").
    // Therefore, convert to string
    value=value.toString();
    value=d.trim(value.substring(value.indexOf('{')+1, value.length-1));
    }


    Not sure why it's suddenly not working.
    On Thu, Apr 28, 2011 at 9:49 PM, Patrick Ruzand wrote:

    Hi,

    Another regression I just noticed with the trunk. Not sure what is the
    exact revision where the problem appeared (maybe 24185 ?), but it used
    to work until recently.

    The dojo parser fails to parse declarations like the following on IE:

    <button dojoType="dijit.form.Button" onClick="buttonClicked">Click
    me</button>

    It seems it could be solved (in parser.js, l.160) by calling
    node.getAttributeNode(lcName).value instead of
    node.getAttribute(lcName)when the attribute value is a function:
    getAttribute returns an invalid function, whereas
    getAttributeNode().value returns the function name as a string.

    Let me know if you need a test case, or if you prefer I open a ticket.

    --
    Patrick
    _______________________________________________
    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/20110428/9b21c284/attachment-0001.htm
  • Patrick Ruzand at Apr 28, 2011 at 9:38 am
    Thanks Bill. Do you want me to enter a ticket or is it ok like that ?

    Patrick

    2011/4/28 Bill Keese <bill at dojotoolkit.org>:
    Oh that's not good, I'll fix, thanks for catching it. ? Probably your
    suggestion to use getAttributeNode() would be an improvement, but note the
    parser does have code to deal with that "invalid function" thing:
    if(d.isFunction(value)){
    // IE gives us a function, even when we say something like onClick="foo"
    // (in which case it gives us an invalid function "function(){ foo }").
    // Therefore, convert to string
    value=value.toString();
    value=d.trim(value.substring(value.indexOf('{')+1, value.length-1));
    }

    Not sure why it's suddenly not working.
    On Thu, Apr 28, 2011 at 9:49 PM, Patrick Ruzand wrote:

    Hi,

    Another regression I just noticed with the trunk. Not sure what is the
    exact revision where the problem appeared (maybe 24185 ?), but it used
    to work until recently.

    The dojo parser fails to parse declarations like the following on IE:

    ? ? ? ? <button dojoType="dijit.form.Button" onClick="buttonClicked">Click
    me</button>

    It seems it could be solved (in parser.js, l.160) by calling
    node.getAttributeNode(lcName).value instead of
    node.getAttribute(lcName)when the attribute value is a function:
    getAttribute returns an invalid function, whereas
    getAttributeNode().value returns the function name as a string.

    Let me know if you need a test case, or if you prefer I open a ticket.

    --
    Patrick
    _______________________________________________
    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


    --
    --
    Patrick
  • Bill Keese at Apr 29, 2011 at 12:18 am
    Oh you could just reopen that other ticket. The thing is though that we
    have tests for this, see this code (particularly funcProp2) in
    tests/parser.html.

    <div dojoType="tests.parser.Class1" data-dojo-id="obj"
    strProp1="text" strProp2=""
    intProp="5"
    arrProp="foo, bar, baz"
    arrProp2=""
    boolProp1="true" boolProp2="false"
    dateProp1="2006-01-01" dateProp2="" dateProp3="now"
    funcProp2="foo" funcProp3="this.func3Called=true;"
    >


    So, can you make a test case where this is failing, or even better, update
    dojot/tests/parser.html to display the bug? Or... is
    dojo/tests/parser.html failing for you?

    On Thu, Apr 28, 2011 at 10:38 PM, Patrick Ruzand wrote:

    Thanks Bill. Do you want me to enter a ticket or is it ok like that ?

    Patrick

    2011/4/28 Bill Keese <bill at dojotoolkit.org>:
    Oh that's not good, I'll fix, thanks for catching it. Probably your
    suggestion to use getAttributeNode() would be an improvement, but note the
    parser does have code to deal with that "invalid function" thing:
    if(d.isFunction(value)){
    // IE gives us a function, even when we say something like onClick="foo"
    // (in which case it gives us an invalid function "function(){ foo }").
    // Therefore, convert to string
    value=value.toString();
    value=d.trim(value.substring(value.indexOf('{')+1, value.length-1));
    }

    Not sure why it's suddenly not working.
    On Thu, Apr 28, 2011 at 9:49 PM, Patrick Ruzand wrote:

    Hi,

    Another regression I just noticed with the trunk. Not sure what is the
    exact revision where the problem appeared (maybe 24185 ?), but it used
    to work until recently.

    The dojo parser fails to parse declarations like the following on IE:

    <button dojoType="dijit.form.Button"
    onClick="buttonClicked">Click
    me</button>

    It seems it could be solved (in parser.js, l.160) by calling
    node.getAttributeNode(lcName).value instead of
    node.getAttribute(lcName)when the attribute value is a function:
    getAttribute returns an invalid function, whereas
    getAttributeNode().value returns the function name as a string.

    Let me know if you need a test case, or if you prefer I open a ticket.

    --
    Patrick
    _______________________________________________
    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


    --
    --
    Patrick
    _______________________________________________
    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/20110429/32d69736/attachment-0001.htm
  • Patrick Ruzand at Apr 29, 2011 at 4:41 am
    Hi Bill,
    Oh you could just reopen that other ticket.
    Sorry, which ticket exactly do you have in mind ?
    So, can you make a test case where this is failing, or even better, update
    dojot/tests/parser.html to display the bug? ? Or... is
    dojo/tests/parser.html failing for you?
    dojo/tests/parser.html is not failing.
    The bug actually happens in ie7 compat mode (I mean, ie8 with ie7
    compat. mode enabled, I have not tested under true ie7) with the
    simple case: a handler on a dijit.form.Button onClick (ie "dijit"
    event) handler

    <script type="text/javascript">
    dojo.require("dojo.parser");
    dojo.require('dijit.form.Button');

    function buttonClicked(){
    alert("Button Clicked!");
    }
    </script>

    </head>
    <body class='tundra'>
    <h1>Dojo Function Parsing Test</h1>
    <button dojoType="dijit.form.Button"
    onClick="buttonClicked">Click me</button>
    </body>

    It works as expected under IE8 mode.
    Let me know if you need more info,

    Patrick
  • Bill Keese at May 2, 2011 at 12:08 am
    OK thanks, I'll check in a fix based on your suggestion to use
    getAttributeNode(). There are a few cases where I need to use
    getAttribute() instead but getAttributeNode() seems to work well for the
    common case and for functions.

    FYI, I meant to reopen http://trac.dojotoolkit.org/ticket/12476, since the
    problem started in [24185], but nevermind, I'll just check in a fix.
    On Fri, Apr 29, 2011 at 5:41 PM, Patrick Ruzand wrote:

    Hi Bill,
    Oh you could just reopen that other ticket.
    Sorry, which ticket exactly do you have in mind ?
    So, can you make a test case where this is failing, or even better, update
    dojot/tests/parser.html to display the bug? Or... is
    dojo/tests/parser.html failing for you?
    dojo/tests/parser.html is not failing.
    The bug actually happens in ie7 compat mode (I mean, ie8 with ie7
    compat. mode enabled, I have not tested under true ie7) with the
    simple case: a handler on a dijit.form.Button onClick (ie "dijit"
    event) handler

    <script type="text/javascript">
    dojo.require("dojo.parser");
    dojo.require('dijit.form.Button');

    function buttonClicked(){
    alert("Button Clicked!");
    }
    </script>

    </head>
    <body class='tundra'>
    <h1>Dojo Function Parsing Test</h1>
    <button dojoType="dijit.form.Button"
    onClick="buttonClicked">Click me</button>
    </body>

    It works as expected under IE8 mode.
    Let me know if you need more info,

    Patrick
    _______________________________________________
    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/20110502/8c2f2419/attachment.htm
  • Colin Snover at May 2, 2011 at 2:58 pm
    I just wanted to drop a note to make sure that folks are aware that
    getAttributeNode is between 40% and 97% slower than getAttribute in
    every browser, so it would probably be a good idea to only use it in
    those cases where it is really, really necessary.
    <http://jsperf.com/getattributenode-vs-getattribute/3>
    On 02/05/2011 11:00, dojo-contributors-request at mail.dojotoolkit.org wrote:
    Message: 1
    Date: Mon, 2 May 2011 13:08:08 +0900
    From: Bill Keese<bill at dojotoolkit.org>
    Subject: Re: [dojo-contributors] regression: Dojo parser fails to
    parse single function name declarations on IE
    To: "dojo dev."<dojo-contributors at mail.dojotoolkit.org>
    Message-ID:<BANLkTi=n9APrmhC5mVDZibT8Qm-NioToMg at mail.gmail.com>
    Content-Type: text/plain; charset="iso-8859-1"

    OK thanks, I'll check in a fix based on your suggestion to use
    getAttributeNode(). There are a few cases where I need to use
    getAttribute() instead but getAttributeNode() seems to work well for the
    common case and for functions.
    --
    Colin Snover
    http://zetafleet.com
  • Bill Keese at May 4, 2011 at 12:47 am
    Thanks for the tip. The change was for the parser's IE6/7 only path, and
    I just benchmarked themeTester-orig.html on IE6 before and after; there
    wasn't a significant change, presumably the bulk of the time is spent
    instantiating widgets rather than querying attributes specified in markup:

    *before: 9938, 9234*

    *after: 9484, 9360*

    (That's for two runs each, clearing the cache for the first run only.)

    On modern browsers it's using node.attributes to get the attributes.
    On Tue, May 3, 2011 at 3:58 AM, Colin Snover wrote:

    I just wanted to drop a note to make sure that folks are aware that
    getAttributeNode is between 40% and 97% slower than getAttribute in
    every browser, so it would probably be a good idea to only use it in
    those cases where it is really, really necessary.
    <http://jsperf.com/getattributenode-vs-getattribute/3>
    On 02/05/2011 11:00, dojo-contributors-request at mail.dojotoolkit.org wrote:
    Message: 1
    Date: Mon, 2 May 2011 13:08:08 +0900
    From: Bill Keese<bill at dojotoolkit.org>
    Subject: Re: [dojo-contributors] regression: Dojo parser fails to
    parse single function name declarations on IE
    To: "dojo dev."<dojo-contributors at mail.dojotoolkit.org>
    Message-ID:<BANLkTi=n9APrmhC5mVDZibT8Qm-NioToMg at mail.gmail.com>
    Content-Type: text/plain; charset="iso-8859-1"

    OK thanks, I'll check in a fix based on your suggestion to use
    getAttributeNode(). There are a few cases where I need to use
    getAttribute() instead but getAttributeNode() seems to work well for the
    common case and for functions.
    --
    Colin Snover
    http://zetafleet.com

    _______________________________________________
    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/20110504/b3c69a61/attachment.htm

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdojo-contributors @
categoriesdojo
postedApr 28, '11 at 8:49a
activeMay 4, '11 at 12:47a
posts8
users3
websitedojotoolkit.org

People

Translate

site design / logo © 2022 Grokbase