Opened 10 years ago
Closed 10 years ago
#13768 closed defect (fixed)
scrollable.js incompatible with AMD, breaks load
Reported by: | bill | Owned by: | ykami |
---|---|---|---|
Priority: | high | Milestone: | 1.7 |
Component: | DojoX Mobile | Version: | 1.6.1 |
Keywords: | 1.7-mobile | Cc: | Rawld Gill |
Blocked By: | Blocking: |
Description
The problem in #13688 can be more simply and consistently reproduced with the attached demo.html file, which simply requires _ScrollableMixin.js. The problem is in scrollable.js, which has this strange code:
if(typeof dojo === "undefined"){ dojo = {doc:document, global:window}; dojox = {mobile:{}}; dojo.has = function(name){ var ua = navigator.userAgent; if(name === "webkit"){ return ua.indexOf("WebKit") != -1; } if(name === "android"){ return parseFloat(ua.split("Android ")[1]) || undefined; } if(name === "ie"){ return parseFloat(ua.split("MSIE ")[1]) || undefined; } if(name === "touch"){ return (typeof dojo.doc.documentElement.ontouchstart != "undefined" && navigator.appVersion.indexOf("Mobile") != -1) || !!dojo.has("android"); } }; ...
That code is meant to only run when dojo.js doesn't exist, but it's running in the AMD case, apparently due to a race condition. Probably it's running before kernel.js.
Attachments (2)
Change History (4)
Changed 10 years ago by
Changed 10 years ago by
Attachment: | _ScrollableMixin.js added |
---|
simplified _ScrollableMixin.js that still reproduces problem
comment:1 Changed 10 years ago by
Keywords: | 1.7-mobile added |
---|---|
Status: | new → assigned |
Thank you for finding this. As you suggested, checking the global 'define' instead of 'dojo' seems to solve the problem.
Note: See
TracTickets for help on using
tickets.
test file