Opened 9 years ago

Closed 9 years ago

#12613 closed defect (wontfix)

Dynamically loaded form does not connect event in IE8

Reported by: nicola.besagni Owned by:
Priority: high Milestone: tbd
Component: Parser Version: 1.6.0
Keywords: dojox.html.set Cc:
Blocked By: Blocking:

Description (last modified by bill)

I want dinamically load dom tree with a dijit.form.Form from a string (actually a server response); I use dojox.html.set. Also I want connect a function to the onReset event. This example work fine:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html dir="ltr">
    <head>
        <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css"/>
        <style type="text/css"> body, html { font-family:helvetica,arial,sans-serif; font-size:90%; } </style>
        <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js" djConfig="parseOnLoad: true"> </script>
        <script type="text/javascript"> dojo.require("dijit.form.Form"); dojo.require("dijit.form.Button"); dojo.require("dojox.html._base"); dojo.addOnLoad(function() { var content = ''; content += '<button type="button">'; content += '</button>'; content += '<div dojoType="dijit.form.Form">'; content += ' <script type="dojo/method" event="onReset">'; content += ' return confirm("Press OK to reset widget values");'; content += ' <' + '/script>'; content += ' <button dojoType="dijit.form.Button" type="reset">'; content += ' Reset'; content += ' </button>'; content += '</div>'; var node = dojo.byId("target"); dojox.html.set(node, content, { parseContent: true, renderStyles: true }); }); </script>
    </head>
   
    <body class=" claro ">
                <div id="target">
                </div>
   </body>
</html>

But, if I remove the first useless button from the content (the first two line after declaring var contente = ;), this code don't work in IE8 (event onReset not connected)

Change History (1)

comment:1 Changed 9 years ago by bill

Component: EventsParser
Description: modified (diff)
Resolution: wontfix
Status: newclosed
Summary: Dinamically loaded form does not connect event in IE8Dynamically loaded form does not connect event in IE8

Yes, there's an annoying bug with IE that it tends to swallow <script type="dojo/method" ... declarations towards the beginning of the document, you just need to add some workaround like you did. Presumably a comment or something else invisible, rather than a button, will do the trick.

Note: See TracTickets for help on using tickets.