Opened 7 years ago

Closed 7 years ago

#16855 closed defect (wontfix)

1.6 with AMD multiversion impossible - defineQuery scope is wrong

Reported by: lee Owned by: Rawld Gill
Priority: undecided Milestone: tbd
Component: Loader Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:

Description

Sorry this is long but I'm documenting several use cases our company might need to use if we need to co-exist legacy and AMD versions. Unfortunately the legacy versions are licensed builds and provide functionality we may still need to use.

Co-existing AMD with legacy versions is fine as long as it's not 1.6 (an example of what I was doing is at http://mail.dojotoolkit.org/pipermail/dojo-interest/2013-March/074879.html, a bug I raised against 1.8 for co-existing legacy less than 1.6 is at http://bugs.dojotoolkit.org/ticket/15539 - this works fine as long as AMD is noGlobals:true)

1.6 was the transition to AMD therefore it's not possible to use 1.6 source with 1.7/1.8 as define is already defined. So I create a built version of 1.6 using scopeMap to move global dojo/dijit/dojox 1.6 out of the way - this may not actually be necessary if noGlobals:true are used for AMD packages. It's interesting to note it's fine using source versions less than 1.6 with AMD source.

Anyway, I found a problem with scoping dojo 1.6 and dojo.query where defineQuery is called. The error is dojo.query is undefined (Object has no method 'query') where a widget (dijit.form.DropDownButton?) calls dojo.query in it's _fillContent method.

In the attached build dojo.js.uncompressed.js it's at line 9723.

this["dojo"]

Is undefined however

dojo and this["dojo16"]

are defined

Reading this makes me realise I shouldn't really need to move 1.6 out of the way if noGlobals:true and maybe it won't be a problem, I'll re-run another build to test this.

I hacked the built 1.6 dojo.js.uncompressed.js at line 9723 to make it work (you'll see the comments) and have a test running which looks good so far.

I realise it's difficult to provide tests for this as you need to run a build with the scopeMap config, profile and associated code so I've attached the 1.6 dojo.js.uncompressed.js.
So I've attached my build profile and the test file (which is using dojo, dijit and dojox for enough coverage though I still think I should test more modules to feel more comfortable). However this test works as I'd expect, if you comment out dojo.js.uncompressed.js at line 9713 and uncomment the original code at line 9721 you'll see the problem.

If you need me to explain this better let me know, I've spent a couple of days debugging this so I may be going off on a tangent. The test html file (legacyandamd1.html) should provide enough explanation though and the mailing list references I used

Attachments (4)

legacyandamd1.html (10.4 KB) - added by lee 7 years ago.
leetestscope.profile.js (2.2 KB) - added by lee 7 years ago.
dojo.js.uncompressed.js.tar.bz2 (226.3 KB) - added by lee 7 years ago.
dojo 1.6 built layer (bzip compressed)
testjson.json (112 bytes) - added by lee 7 years ago.

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by lee

Attachment: legacyandamd1.html added

Changed 7 years ago by lee

Attachment: leetestscope.profile.js added

Changed 7 years ago by lee

dojo 1.6 built layer (bzip compressed)

Changed 7 years ago by lee

Attachment: testjson.json added

comment:1 Changed 7 years ago by lee

Please close this defect, this is a defect in 1.6 but I can work round it by not needing to use scopeMap, instead using packageMap to rename 1.8 packages. Considering I won't be multi-versioning with any other legacy versions it's not a problem.

comment:2 Changed 7 years ago by bill

Resolution: wontfix
Status: newclosed

Closing as per reporter's request.

Last edited 7 years ago by bill (previous) (diff)
Note: See TracTickets for help on using tickets.