features.js revision b13fa92174ae8a0c808a88984ae029a542b6dd7d
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt SweeneyYUI.add('features', function(Y) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyvar feature_tests = {};
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney/**
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt SweeneyContains the core of YUI's feature test architecture.
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney@module features
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney*/
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney/**
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney* Feature detection
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney* @class Features
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney* @static
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney*/
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt SweeneyY.mix(Y.namespace('Features'), {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney /**
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * Object hash of all registered feature tests
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @property tests
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @type Object
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney */
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney tests: feature_tests,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney /**
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * Add a test to the system
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney *
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * ```
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * Y.Features.add("load", "1", {});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * ```
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney *
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @method add
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @param {String} cat The category, right now only 'load' is supported
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @param {String} name The number sequence of the test, how it's reported in the URL or config: 1, 2, 3
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @param {Object} o Object containing test properties
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @param {String} o.name The name of the test
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @param {Function} o.test The test function to execute, the only argument to the function is the `Y` instance
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @param {String} o.trigger The module that triggers this test.
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney */
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney add: function(cat, name, o) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney feature_tests[cat] = feature_tests[cat] || {};
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney feature_tests[cat][name] = o;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney },
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney /**
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * Execute all tests of a given category and return the serialized results
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney *
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * ```
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * caps=1:1;2:1;3:0
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * ```
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @method all
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @param {String} cat The category to execute
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @param {Array} args The arguments to pass to the test function
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @return {String} A semi-colon separated string of tests and their success/failure: 1:1;2:1;3:0
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney */
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney all: function(cat, args) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var cat_o = feature_tests[cat],
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney // results = {};
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney result = [];
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney if (cat_o) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney Y.Object.each(cat_o, function(v, k) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney result.push(k + ':' + (Y.Features.test(cat, k, args) ? 1 : 0));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney });
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney }
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return (result.length) ? result.join(';') : '';
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney },
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney /**
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * Run a sepecific test and return a Boolean response.
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney *
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * ```
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * Y.Features.test("load", "1");
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * ```
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney *
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @method test
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @param {String} cat The category of the test to run
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @param {String} name The name of the test to run
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @param {Array} args The arguments to pass to the test function
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney * @return {Boolean} True or false if the test passed/failed.
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney */
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney test: function(cat, name, args) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney args = args || [];
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var result, ua, test,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney cat_o = feature_tests[cat],
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney feature = cat_o && cat_o[name];
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney if (!feature) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney } else {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney result = feature.result;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney if (Y.Lang.isUndefined(result)) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney ua = feature.ua;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney if (ua) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney result = (Y.UA[ua]);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney }
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney test = feature.test;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney if (test && ((!ua) || result)) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney result = test.apply(Y, args);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney }
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney feature.result = result;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney }
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney }
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return result;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney }
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// Y.Features.add("load", "1", {});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// Y.Features.test("load", "1");
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// caps=1:1;2:0;3:1;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney/* This file is auto-generated by src/loader/scripts/meta_join.py */
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyvar add = Y.Features.add;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// graphics-canvas-default
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyadd('load', '0', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "name": "graphics-canvas-default",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "test": function(Y) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var DOCUMENT = Y.config.doc,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney canvas = DOCUMENT && DOCUMENT.createElement("canvas");
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (canvas && canvas.getContext && canvas.getContext("2d")));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney},
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "trigger": "graphics"
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// autocomplete-list-keys
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyadd('load', '1', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "name": "autocomplete-list-keys",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "test": function (Y) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney // Only add keyboard support to autocomplete-list if this doesn't appear to
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney // be an iOS or Android-based mobile device.
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney //
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney // There's currently no feasible way to actually detect whether a device has
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney // a hardware keyboard, so this sniff will have to do. It can easily be
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney // overridden by manually loading the autocomplete-list-keys module.
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney //
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney // doesn't fire the keyboard events used by AutoCompleteList, so there's
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney // no point loading the -keys module even when a bluetooth keyboard may be
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney // available.
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return !(Y.UA.ios || Y.UA.android);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney},
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "trigger": "autocomplete-list"
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// dd-gestures
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyadd('load', '2', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "name": "dd-gestures",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "test": function(Y) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return (Y.config.win && ('ontouchstart' in Y.config.win && !Y.UA.chrome));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney},
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "trigger": "dd-drag"
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// history-hash-ie
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyadd('load', '3', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "name": "history-hash-ie",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "test": function (Y) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var docMode = Y.config.doc && Y.config.doc.documentMode;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return Y.UA.ie && (!('onhashchange' in Y.config.win) ||
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney !docMode || docMode < 8);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney},
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "trigger": "history-hash"
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// transition-timer
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyadd('load', '4', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "name": "transition-timer",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "test": function (Y) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var DOCUMENT = Y.config.doc,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney node = (DOCUMENT) ? DOCUMENT.documentElement: null,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney ret = true;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney if (node && node.style) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney }
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return ret;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney},
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "trigger": "transition"
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// graphics-svg-default
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyadd('load', '5', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "name": "graphics-svg-default",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "test": function(Y) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var DOCUMENT = Y.config.doc;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney},
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "trigger": "graphics"
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// scrollview-base-ie
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyadd('load', '6', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "name": "scrollview-base-ie",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "trigger": "scrollview-base",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "ua": "ie"
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// widget-base-ie
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyadd('load', '7', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "name": "widget-base-ie",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "trigger": "widget-base",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "ua": "ie"
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// dom-style-ie
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyadd('load', '8', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "name": "dom-style-ie",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "test": function (Y) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var testFeature = Y.Features.test,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney addFeature = Y.Features.add,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney WINDOW = Y.config.win,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney DOCUMENT = Y.config.doc,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney DOCUMENT_ELEMENT = 'documentElement',
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney ret = false;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney addFeature('style', 'computedStyle', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney test: function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return WINDOW && 'getComputedStyle' in WINDOW;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney }
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney });
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney addFeature('style', 'opacity', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney test: function() {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney }
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney });
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney ret = (!testFeature('style', 'opacity') &&
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney !testFeature('style', 'computedStyle'));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return ret;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney},
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "trigger": "dom-style"
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// selector-css2
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyadd('load', '9', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "name": "selector-css2",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "test": function (Y) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var DOCUMENT = Y.config.doc,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney ret = DOCUMENT && !('querySelectorAll' in DOCUMENT);
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return ret;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney},
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "trigger": "selector"
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// event-base-ie
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyadd('load', '10', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "name": "event-base-ie",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "test": function(Y) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var imp = Y.config.doc && Y.config.doc.implementation;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return (imp && (!imp.hasFeature('Events', '2.0')));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney},
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "trigger": "node-base"
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// graphics-svg
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyadd('load', '11', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "name": "graphics-svg",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "test": function(Y) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var DOCUMENT = Y.config.doc;
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney},
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "trigger": "graphics"
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// graphics-vml-default
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyadd('load', '12', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "name": "graphics-vml-default",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "test": function(Y) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var DOCUMENT = Y.config.doc,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney canvas = DOCUMENT && DOCUMENT.createElement("canvas");
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney},
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "trigger": "graphics"
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// graphics-canvas
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyadd('load', '13', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "name": "graphics-canvas",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "test": function(Y) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var DOCUMENT = Y.config.doc,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney canvas = DOCUMENT && DOCUMENT.createElement("canvas");
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (canvas && canvas.getContext && canvas.getContext("2d")));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney},
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "trigger": "graphics"
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney// graphics-vml
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeneyadd('load', '14', {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "name": "graphics-vml",
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "test": function(Y) {
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney var DOCUMENT = Y.config.doc,
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney canvas = DOCUMENT && DOCUMENT.createElement("canvas");
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney},
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney "trigger": "graphics"
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney}, '@VERSION@' ,{requires:['yui-base']});
fdfbb58f76522ce41b2c8af7f0a9274dcf82cd4aMatt Sweeney