Opened 10 years ago
Closed 10 years ago
#11720 closed defect (invalid)
onLoad is never called if content is specified when creating a Dialog
Reported by: | liucougar | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | Dijit | Version: | 1.5 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
try the following code with dijit trunk (r22861 atm)
<html> <head> <script src="../dojo/dojo.js"></script> <script> dojo.require("dijit.Dialog"); dojo.declare('mydialog', dijit.Dialog,{ content:"content is here", onLoad: function(){ console.log('onLoad is called'); this.inherited(arguments); } }) dojo.addOnLoad(function(){ var d = new mydialog(); d.show(); }); </script> <link href="../dijit/themes/tundra/tundra.css" type="text/css" rel="stylesheet"/> </head> <body class="tundra"> </body> </html>
the console does not print 'onLoad is called'. While using r22770, that line is printed. This is a change of behavior, is it intended? (it can be easily workaround by moving the code from onLoad to postCreate, I just want to file this ticket to make sure the change of behavior is as expected)
Note: See
TracTickets for help on using
tickets.
This is from [22835], and the behavior change is intentional. Note that
never called onLoad(), so the equivalent programmatic construct:
shouldn't either. Calling onLoad() in either of the above test cases seems useless, like calling onChange() when a TextBox is initially created.
In ContentPane I wrote the comment:
Note that technically the new behavior matches the spec of onLoad() in Dialog better:
... although it doesn't match it exactly since onLoad() is also called when data is set via set("content", ...).
Let me know if there's something I'm missing.