Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#15018 closed defect (fixed)

aspect.after discard "false" return values

Reported by: ID Owned by: Kris Zyp
Priority: undecided Milestone: 1.8
Component: Events Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:


In the test below the submit should be blocked by the blockSubmit function but it doesn't work. The error lies within aspect.after which only replace the return value if it is true-ish instead of testing it being different then undefined.

		<script src="dojo/dojo.js" data-dojo-config="async: true"></script>
			require(["dojo/parser", "dijit/registry", "dijit/form/Form", "dojo/domReady!"], function(parser, registry){
				var blockSubmit = function() {
					// Should block the submit action of the form
					return false;
				var form = registry.byId("myForm");
				form.on("submit", blockSubmit);
		<form data-dojo-type="dijit.form.Form" id="myForm">
			<input type="submit" value="Click me" />
		<script>document.write("<span>Random number: "+Math.round(Math.random()*10000)+"</span>");</script>

I've attached a patch which solve this problem.

Attachments (1)

dojo_aspect.patch (936 bytes) - added by ID 10 years ago.
Test for different than undefined instead of true-ish

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by ID

Attachment: dojo_aspect.patch added

Test for different than undefined instead of true-ish

comment:1 Changed 10 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

In [29001]:

Change return value when after advice returns any (non-undefined) value, fixes #15018 !strict

comment:2 Changed 10 years ago by bill

Milestone: tbd1.8
Note: See TracTickets for help on using tickets.