6db6adb9f9397a1e04135f64aa9e5bcf1e265663
[platform/framework/web/crosswalk-tizen.git] /
1 /** Used for native method references. */
2 var objectProto = Object.prototype;
3
4 /** Used to detect DOM support. */
5 var document = (document = global.window) && document.document;
6
7 /** Native method references. */
8 var propertyIsEnumerable = objectProto.propertyIsEnumerable;
9
10 /**
11  * An object environment feature flags.
12  *
13  * @static
14  * @memberOf _
15  * @type Object
16  */
17 var support = {};
18
19 (function(x) {
20   var Ctor = function() { this.x = x; },
21       object = { '0': x, 'length': x },
22       props = [];
23
24   Ctor.prototype = { 'valueOf': x, 'y': x };
25   for (var key in new Ctor) { props.push(key); }
26
27   /**
28    * Detect if functions can be decompiled by `Function#toString`
29    * (all but Firefox OS certified apps, older Opera mobile browsers, and
30    * the PlayStation 3; forced `false` for Windows 8 apps).
31    *
32    * @memberOf _.support
33    * @type boolean
34    */
35   support.funcDecomp = /\bthis\b/.test(function() { return this; });
36
37   /**
38    * Detect if `Function#name` is supported (all but IE).
39    *
40    * @memberOf _.support
41    * @type boolean
42    */
43   support.funcNames = typeof Function.name == 'string';
44
45   /**
46    * Detect if the DOM is supported.
47    *
48    * @memberOf _.support
49    * @type boolean
50    */
51   try {
52     support.dom = document.createDocumentFragment().nodeType === 11;
53   } catch(e) {
54     support.dom = false;
55   }
56
57   /**
58    * Detect if `arguments` object indexes are non-enumerable.
59    *
60    * In Firefox < 4, IE < 9, PhantomJS, and Safari < 5.1 `arguments` object
61    * indexes are non-enumerable. Chrome < 25 and Node.js < 0.11.0 treat
62    * `arguments` object indexes as non-enumerable and fail `hasOwnProperty`
63    * checks for indexes that exceed the number of function parameters and
64    * whose associated argument values are `0`.
65    *
66    * @memberOf _.support
67    * @type boolean
68    */
69   try {
70     support.nonEnumArgs = !propertyIsEnumerable.call(arguments, 1);
71   } catch(e) {
72     support.nonEnumArgs = true;
73   }
74 }(1, 0));
75
76 module.exports = support;