]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - jssource/src_files/include/javascript/yui3/build/yui/features.js
Release 6.5.0
[Github/sugarcrm.git] / jssource / src_files / include / javascript / yui3 / build / yui / features.js
1 /*
2 Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3 Code licensed under the BSD License:
4 http://developer.yahoo.com/yui/license.html
5 version: 3.3.0
6 build: 3167
7 */
8 YUI.add('features', function(Y) {
9
10 var feature_tests = {};
11
12 Y.mix(Y.namespace('Features'), {
13
14     tests: feature_tests,
15
16     add: function(cat, name, o) {
17         feature_tests[cat] = feature_tests[cat] || {};
18         feature_tests[cat][name] = o;
19     },
20
21     all: function(cat, args) {
22         var cat_o = feature_tests[cat],
23             // results = {};
24             result = '';
25         if (cat_o) {
26             Y.Object.each(cat_o, function(v, k) {
27                 // results[k] = Y.Features.test(cat, k, args);
28                 result += k + ':' +
29                        (Y.Features.test(cat, k, args) ? 1 : 0) + ';';
30             });
31         }
32
33         return result;
34     },
35
36     test: function(cat, name, args) {
37         args = args || [];
38         var result, ua, test,
39             cat_o = feature_tests[cat],
40             feature = cat_o && cat_o[name];
41
42         if (!feature) {
43         } else {
44
45             result = feature.result;
46
47             if (Y.Lang.isUndefined(result)) {
48
49                 ua = feature.ua;
50                 if (ua) {
51                     result = (Y.UA[ua]);
52                 }
53
54                 test = feature.test;
55                 if (test && ((!ua) || result)) {
56                     result = test.apply(Y, args);
57                 }
58
59                 feature.result = result;
60             }
61         }
62
63         return result;
64     }
65 });
66
67 // Y.Features.add("load", "1", {});
68 // Y.Features.test("load", "1");
69 // caps=1:1;2:0;3:1;
70
71 /* This file is auto-generated by src/loader/meta_join.py */
72 var add = Y.Features.add;
73 // autocomplete-list-keys-sniff.js
74 add('load', '0', {
75     "test": function (Y) {
76     // Only add keyboard support to autocomplete-list if this doesn't appear to
77     // be an iOS or Android-based mobile device.
78     //
79     // There's currently no feasible way to actually detect whether a device has
80     // a hardware keyboard, so this sniff will have to do. It can easily be
81     // overridden by manually loading the autocomplete-list-keys module.
82     //
83     // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari
84     // doesn't fire the keyboard events used by AutoCompleteList, so there's
85     // no point loading the -keys module even when a bluetooth keyboard may be
86     // available.
87     return !(Y.UA.ios || Y.UA.android);
88 }, 
89     "trigger": "autocomplete-list"
90 });
91 // ie-style-test.js
92 add('load', '1', {
93     "test": function (Y) {
94
95     var testFeature = Y.Features.test,
96         addFeature = Y.Features.add,
97         WINDOW = Y.config.win,
98         DOCUMENT = Y.config.doc,
99         DOCUMENT_ELEMENT = 'documentElement',
100         ret = false;
101
102     addFeature('style', 'computedStyle', {
103         test: function() {
104             return WINDOW && 'getComputedStyle' in WINDOW;
105         }
106     });
107
108     addFeature('style', 'opacity', {
109         test: function() {
110             return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style;
111         }
112     });
113
114     ret =  (!testFeature('style', 'opacity') &&
115             !testFeature('style', 'computedStyle'));
116
117     return ret;
118 }, 
119     "trigger": "dom-style"
120 });
121 // 0
122 add('load', '2', {
123     "trigger": "widget-base", 
124     "ua": "ie"
125 });
126 // ie-base-test.js
127 add('load', '3', {
128     "test": function(Y) {
129     var imp = Y.config.doc && Y.config.doc.implementation;
130     return (imp && (!imp.hasFeature('Events', '2.0')));
131 }, 
132     "trigger": "node-base"
133 });
134 // dd-gestures-test.js
135 add('load', '4', {
136     "test": function(Y) {
137     return (Y.config.win && ('ontouchstart' in Y.config.win && !Y.UA.chrome));
138 }, 
139     "trigger": "dd-drag"
140 });
141 // history-hash-ie-test.js
142 add('load', '5', {
143     "test": function (Y) {
144     var docMode = Y.config.doc.documentMode;
145
146     return Y.UA.ie && (!('onhashchange' in Y.config.win) ||
147             !docMode || docMode < 8);
148 }, 
149     "trigger": "history-hash"
150 });
151
152
153 }, '3.3.0' ,{requires:['yui-base']});