Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#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:


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 type="dojo/aspect" data-dojo-advice="around" data-dojo-method="method2" 
    return function(){
      console.log("this runs before method2");;
      console.log("this runs after method2");
  <script type="dojo/aspect" data-dojo-advice="before" data-dojo-method="method3">
    console.log("this run before method3");
    return ["arg1", "arg2"];

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)

parser_aspect.patch (6.1 KB) - added by Kitson Kelly 10 years ago.
Patch to add dojo/aspect declarative scripting support

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by Kitson Kelly

Attachment: parser_aspect.patch added

Patch to add dojo/aspect declarative scripting support

comment:1 Changed 10 years ago by Kitson Kelly

I have added the patch to support dojo/aspect in declarative scripting, plus appropriate additions to the unit test case.

comment:2 Changed 10 years ago by bill

Milestone: tbd1.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:3 Changed 10 years ago by bill

Resolution: fixed
Status: newclosed

In [28280]:

Add <script type="dojo/aspect" ...> support to parser, fixes #15117 !strict.

Changes are reduced version of patch from kitsonk (CLA on file), thanks! Also fixed a few lingering dojo.* references.

comment:4 Changed 10 years ago by Kitson Kelly

comment:5 Changed 10 years ago by bill

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 around advice if you aren't calling the original function at all.)

Last edited 10 years ago by bill (previous) (diff)

comment:6 Changed 10 years ago by Kitson Kelly

Ok, I will update... Thanks.

Note: See TracTickets for help on using tickets.