Permalink
Browse files

More natural argument syntax for callbacks, refs #11741.

  • Loading branch information...
1 parent 471f8c6 commit f6a208c1443ad8a92a4eba9530a7788302101967 @wkeese wkeese committed Dec 27, 2010
Showing with 15 additions and 26 deletions.
  1. +4 −4 tests/test_Dialog.html
  2. +7 −18 tests/test_InlineEditBox.html
  3. +2 −2 tests/test_Menu.html
  4. +1 −1 tests/test_Toolbar.html
  5. +1 −1 tests/test_Tooltip.html
View
@@ -72,7 +72,7 @@ <h1 class="testTitle">Dijit layout.Dialog tests</h1>
"aria-describedby":"intro",
onFocus:function(){ console.log("user focus handler") },
onBlur:function(){ console.log("user blur handler") },
- execute:function(){ console.log("submitted w/args:\n" + dojo.toJson(arguments[0], true)); }'>
+ execute:function(args){ console.log("submitted w/args:\n" + dojo.toJson(args, true)); }'>
<div id="intro" style="width:30em;">Introductory information spoken by screen reader if aria-describedby is
added to the declaration of dialog above with value equal to the id of the container element for this text. This technique
will work in Dojo 1.4. </div>
@@ -191,7 +191,7 @@ <h1 class="testTitle">Dijit layout.Dialog tests</h1>
<div id="dialog6" data-dojo-type="dijit.Dialog" data-dojo-props='title:"File Dialog",
onFocus:function(){ console.log("user focus handler") },
onBlur:function(){ console.log("user blur handler") },
- execute:function(){ alert("submitted w/args:\n" + dojo.toJson(arguments[0], true)); }, style:"min-width: 350px"'>
+ execute:function(args){ alert("submitted w/args:\n" + dojo.toJson(args, true)); }, style:"min-width: 350px"'>
<!-- note: style="min-width: 350px" to workaround FF bug where width is too short, see http://bugs.dojotoolkit.org/ticket/5976 -->
<label for="afile">ID File: </label>
<input id="afile" data-dojo-type="dijit.form.TextBox" data-dojo-props='type:"file", name:"afile" '/>
@@ -300,7 +300,7 @@ <h1 class="testTitle">Dijit layout.Dialog tests</h1>
onExecute:function(){ console.log("OK button pressed") },
onCancel:function(){ console.log("Cancel button pressed") },
"aria-describedby":"intro",
- execute:function(){ console.log("submitted w/args:\n" + dojo.toJson(arguments[0], true)); }'>
+ execute:function(args){ console.log("submitted w/args:\n" + dojo.toJson(args, true)); }'>
<div class="dijitDialogPaneContentArea">
<div id="ABintro1" style="width:30em;">Introductory information spoken by screen reader if aria-describedby is
added to the declaration of dialog above with value equal to the id of the container element for this text. This technique
@@ -320,7 +320,7 @@ <h1 class="testTitle">Dijit layout.Dialog tests</h1>
"aria-describedby":"intro",
onFocus:function(){ console.log("user focus handler") },
onBlur:function(){ console.log("user blur handler") },
- execute:function(){ console.log("submitted w/args:\n" + dojo.toJson(arguments[0], true)); }'>
+ execute:function(args){ console.log("submitted w/args:\n" + dojo.toJson(args, true)); }'>
<div class="dijitDialogPaneContentArea">
<div id="NABintro" style="width:30em;">Introductory information spoken by screen reader if aria-describedby is
@@ -44,21 +44,10 @@
dojo.require("dojo.parser"); // scan page for widgets and instantiate them
- function myHandler(widget, newValue){
- widget._onChangeValue = newValue;
- console.debug("onChange for id = " + widget.id + ", value: " + newValue);
- };
- /*
- dojo.addOnLoad(function(){
- dojo.subscribe("widgetFocus", function(widget){
- console.log("focused on widget " + (widget?widget:"nothing"));
- });
- dojo.subscribe("widgetBlur", function(widget){
- console.log("blurred widget " + (widget?widget:"nothing"));
- });
- dojo.subscribe("focusNode", function(node){ console.log("focused on node " + (node?(node.id||node.tagName):"nothing"));});
- });
- */
+ function myHandler(newValue){
+ this._onChangeValue = newValue; // used by robot test file
+ console.debug("onChange for id = " + this.id + ", value: " + newValue);
+ }
</script>
</head>
<body class="claro">
@@ -82,7 +71,7 @@ <h1 class="testTitle">Dijit InlineEditBox Test</h1>
<h2>Form Letter with blanks</h2>
<div class="letter">
- <h3 id="editable" data-dojo-type="dijit.InlineEditBox" data-dojo-props='value:"markup value", onChange:function(){ myHandler(this,arguments[0]) }, autoSave:true, title:"company name"'></h3>
+ <h3 id="editable" data-dojo-type="dijit.InlineEditBox" data-dojo-props='value:"markup value", onChange:myHandler, autoSave:true, title:"company name"'></h3>
<p>
Dear <span id="MrSmith" data-dojo-type="dijit.InlineEditBox" data-dojo-props='width:"200px", title:"recipient name"'></span>,
</p>
@@ -110,7 +99,7 @@ <h3 id="editable" data-dojo-type="dijit.InlineEditBox" data-dojo-props='value:"m
<h2>Form Letter with <span id="predefined">predefined values</span>, and no auto-save</h2>
<div class="letter">
- <h3 id="editable2" data-dojo-type="dijit.InlineEditBox" data-dojo-props='onChange:function(){ myHandler(this,arguments[0]) }, autoSave:false, title:"company name"'>
+ <h3 id="editable2" data-dojo-type="dijit.InlineEditBox" data-dojo-props='onChange:myHandler, autoSave:false, title:"company name"'>
Bob Vance Refrigeration
</h3>
<p>
@@ -162,7 +151,7 @@ <h2>Inline-block Text (of 400px width)</h2>
(before plain inline) <fieldset class="dijitInline"><div style="width: 400px;">hello world</div></fieldset> (after plain inline)
<br>
(before editable inline)
- <fieldset class="dijitInline"><div data-dojo-type="dijit.InlineEditBox" data-dojo-props='onChange:function(){ myHandler(this,arguments[0]) }, width:"400px", style:"width: 400px;"'>
+ <fieldset class="dijitInline"><div data-dojo-type="dijit.InlineEditBox" data-dojo-props='onChange:myHandler, width:"400px", style:"width: 400px;"'>
hello world
</div></fieldset>
(after editable inline)
View
@@ -145,7 +145,7 @@
<div data-dojo-type="dijit.ColorPalette"></div>
</div>
<div data-dojo-type="dijit.MenuSeparator"></div>
- <div data-dojo-type="dijit.CheckedMenuItem" data-dojo-props='checked:true, onChange:function(){ console.log("Now set to " + arguments[0]) }'>Checked</div>
+ <div data-dojo-type="dijit.CheckedMenuItem" data-dojo-props='checked:true, onChange:function(val){ console.log("Now set to " + val); }'>Checked</div>
<div data-dojo-type="dijit.CheckedMenuItem">Not Checked</div>
<div data-dojo-type="dijit.CheckedMenuItem" data-dojo-props='checked:true, disabled:true'>Checked Disabled</div>
<div data-dojo-type="dijit.MenuSeparator"></div>
@@ -318,7 +318,7 @@ <h3 style="margin-bottom: 2em;">Navigation menu:</h3>
<div data-dojo-type="dijit.ColorPalette"></div>
</div>
<div data-dojo-type="dijit.MenuSeparator"></div>
- <div data-dojo-type="dijit.CheckedMenuItem" data-dojo-props='checked:true, onChange:function(){ console.log("Now set to " + arguments[0]) }'>Checked</div>
+ <div data-dojo-type="dijit.CheckedMenuItem" data-dojo-props='checked:true, onChange:function(val){ console.log("Now set to " + val); }'>Checked</div>
<div id="checked2" data-dojo-type="dijit.CheckedMenuItem" >Not Checked</div>
<div data-dojo-type="dijit.CheckedMenuItem" data-dojo-props='checked:true, disabled:true'>Checked Disabled</div>
</div>
View
@@ -91,7 +91,7 @@ <h2>Toolbar from markup</h2>
><div id="toolbar1.dialog" data-dojo-type="dijit.form.DropDownButton" data-dojo-props='iconClass:"plusIcon", showLabel:true'>
<span>TooltipDialog</span>
<div id="tooltipDlg" data-dojo-type="dijit.TooltipDialog" data-dojo-props='title:"Enter Login information",
- execute:function(){ console.log("submitted w/args:\n" + dojo.toJson(arguments[0], true)); }'>
+ execute:function(args){ console.log("submitted w/args:\n" + dojo.toJson(args, true)); }'>
<table>
<tr>
<td><label for="user">User:</label></td>
View
@@ -83,7 +83,7 @@ <h1 class="testTitle">Tooltip test</h1>
</div>
</td>
<td>
- <div data-dojo-type="dijit.ColorPalette" data-dojo-props='onChange:function(){ dojo.query("body").style("background", arguments[0]); }'></div>
+ <div data-dojo-type="dijit.ColorPalette" data-dojo-props='onChange:function(val){ dojo.query("body").style("background", val); }'></div>
</td>
<td>
<input data-dojo-type="dijit.form.DateTextBox" data-dojo-props='id: "dtb", value: "2010-12-15", promptMessage: "Please Enter a date in dd/MM/yyyy format", style:"width: 8em;"'>

0 comments on commit f6a208c

Please sign in to comment.