1 | define([ |
---|
2 | "dojo/_base/lang", |
---|
3 | "dojo/sniff" |
---|
4 | ], function(lang, has){ |
---|
5 | // module: |
---|
6 | // dojox/mobile/compat |
---|
7 | |
---|
8 | var dm = lang.getObject("dojox.mobile", true); |
---|
9 | // TODO: Use feature detection instead, but this would require a major rewrite of _compat |
---|
10 | // to detect each feature and plug the corresponding compat code if needed. |
---|
11 | // Currently the compat code is a workaround for too many different things to be able to |
---|
12 | // decide based on feature detection. So for now we just disable _compat on the mobile browsers |
---|
13 | // that are known to support enough CSS3: all webkit-based browsers, IE10 (Windows [Phone] 8) and IE11+. |
---|
14 | if(!(has("webkit") || has("ie") === 10) || (!has("ie") && has("trident") > 6)){ |
---|
15 | var s = "dojox/mobile/_compat"; // assign to a variable so as not to be picked up by the build tool |
---|
16 | require([s]); |
---|
17 | } |
---|
18 | |
---|
19 | /*===== |
---|
20 | return { |
---|
21 | // summary: |
---|
22 | // CSS3 compatibility module. |
---|
23 | // description: |
---|
24 | // This module provides to dojox/mobile support for some of the CSS3 features |
---|
25 | // in non-CSS3 browsers, such as IE or Firefox. |
---|
26 | // If you require this module, when running in a non-CSS3 browser it directly |
---|
27 | // replaces some of the methods of dojox/mobile classes, without any subclassing. |
---|
28 | // This way, HTML pages remain the same regardless of whether this compatibility |
---|
29 | // module is used or not. |
---|
30 | // |
---|
31 | // Example of usage: |
---|
32 | // | require([ |
---|
33 | // | "dojox/mobile", |
---|
34 | // | "dojox/mobile/compat", |
---|
35 | // | ... |
---|
36 | // | ], function(...){ |
---|
37 | // | ... |
---|
38 | // | }); |
---|
39 | // |
---|
40 | // This module also loads compatibility CSS files, which have a -compat.css |
---|
41 | // suffix. You can use either the `<link>` tag or `@import` to load theme |
---|
42 | // CSS files. Then, this module searches for the loaded CSS files and loads |
---|
43 | // compatibility CSS files. For example, if you load dojox/mobile/themes/iphone/iphone.css |
---|
44 | // in a page, this module automatically loads dojox/mobile/themes/iphone/iphone-compat.css. |
---|
45 | // If you explicitly load iphone-compat.css with `<link>` or `@import`, |
---|
46 | // this module will not load again the already loaded file. |
---|
47 | // |
---|
48 | // Note that, by default, compatibility CSS files are only loaded for CSS files located |
---|
49 | // in a directory containing a "mobile/themes" path. For that, a matching is done using |
---|
50 | // the default pattern "/\/mobile\/themes\/.*\.css$/". If a custom theme is not located |
---|
51 | // in a directory containing this path, the data-dojo-config needs to specify a custom |
---|
52 | // pattern using the "mblLoadCompatPattern" configuration parameter, for instance: |
---|
53 | // | data-dojo-config="mblLoadCompatPattern: /\/mycustomtheme\/.*\.css$/" |
---|
54 | }; |
---|
55 | =====*/ |
---|
56 | return dm; |
---|
57 | }); |
---|