#15117 closed enhancement (fixed)
Add dojo/aspect for declarative scripting.
Reported by: | Kitson Kelly | Owned by: | bill |
---|---|---|---|
Priority: | undecided | Milestone: | 1.8 |
Component: | Parser | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
The parser should support declarative scripts that leverage dojo/aspect
.
For example, the parser should support the following markup:
<div data-dojo-type="package/module"> <script type="dojo/aspect" data-dojo-advice="after" data-dojo-method="method1"> console.log("I ran after method1"); </script> <script type="dojo/aspect" data-dojo-advice="around" data-dojo-method="method2" data-dojo-args="origFn"> return function(){ console.log("this runs before method2"); origFn.call(this); console.log("this runs after method2"); }); </script> <script type="dojo/aspect" data-dojo-advice="before" data-dojo-method="method3"> console.log("this run before method3"); return ["arg1", "arg2"]; </div>
I have a patch for this, but it is co-mingled with some other code and need to separate it out into a discreet patch. I will then attach it to this ticket.
Attachments (1)
Change History (7)
Changed 9 years ago by
Attachment: | parser_aspect.patch added |
---|
comment:1 Changed 9 years ago by
I have added the patch to support dojo/aspect
in declarative scripting, plus appropriate additions to the unit test case.
comment:2 Changed 9 years ago by
Milestone: | tbd → 1.8 |
---|
Thanks, looks good, I'll check that in. (After I do that please update the reference doc to add info on the new syntax, and remove the section on the deprecated dojo/connect syntax if I didn't remove it already.)
comment:4 Changed 9 years ago by
Change to documentation made in this commit: https://github.com/dojo/docs/commit/8c6da6e01ba92cf2bff3805e66ff24257bf46183
comment:5 Changed 9 years ago by
Thanks for the doc update. The only thing is that I wouldn't say that <script type="dojo/method"> is deprecated. Occasionally you need to use it, when you are defining a method that returns a value, such as (IIRC) onSubmit for dijit/form/Form, which returns true or false to approve or cancel the form submission.
(I guess technically you could use around advice for that, but it's strange to use that if you aren't calling the original function at any point.)
Patch to add dojo/aspect declarative scripting support