all files / framework/core/js/ jquery.standalone.js

84.91% Statements 45/53
79.69% Branches 51/64
75% Functions 6/8
84.91% Lines 45/53
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153                                                                                            44348×             67404× 23056×       44348×                 44348× 44348×       284×                       37372× 37372× 37372× 37372×     37372× 27430× 27430×   27430×       37372×       37372×   41228×   41228× 112430× 112430×     112430×         112430× 24382× 18× 18×   24364×     24382× 88048×   77494×         37372×            
/*
 * Definitions in this file taken from:
 *
 * jQuery JavaScript Library v1.6.1
 * http://jquery.com/
 *
 * This implementation is only intended to be used in contexts where the Fluid Infusion framework
 * is required to be used without a functioning DOM being available (node.js or other standalone contexts).
 * It includes the minimum definitions taken from jQuery required to operate the core of Fluid.js
 * without FluidView.js. Consult http://issues.fluidproject.org/browse/FLUID-4568 for more details.
 *
 * Copyright 2011, John Resig
 * Copyright 2011- OCAD University
 *
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 * Date: Thu May 12 15:04:36 2011 -0400
 */
 
/* global jQuery:true, global */
/* exported jQuery */
 
var fluid_3_0_0 = fluid_3_0_0 || {};
var fluid = fluid || fluid_3_0_0;
 
(function (fluid) {
    "use strict";
 
    // Save a reference to some core methods
    var toString = Object.prototype.toString;
    var hasOwn = Object.prototype.hasOwnProperty;
    var globalScope = typeof window !== "undefined" ? window :
        typeof self !== "undefined" ? self : global;
    // Map over jQuery in case of overwrite
    var _jQuery = globalScope.jQuery;
    // Map over the $ in case of overwrite
    var _$ = globalScope.$;
 
    var jQuery = fluid.jQueryStandalone = {
 
        // The current version of jQuery being used
        jquery: "1.6.1-fluidStandalone",
 
        noConflict: function (deep) {
            Iif (globalScope.$ === jQuery) {
                globalScope.$ = _$;
            }
            Eif (deep && globalScope.jQuery === jQuery) {
                globalScope.jQuery = _jQuery;
            }
            return jQuery;
        },
 
        isArray: Array.isArray || function (obj) {
            return toString.call(obj) === "[object Array]";
        },
 
        // A crude way of determining if an object is a window
        isWindow: function (obj) {
            return obj && typeof obj === "object" && "setInterval" in obj;
        },
 
        isPlainObject: function (obj) {
            // Must be an Object.
            // Because of IE, we also have to check the presence of the constructor property.
            // Make sure that DOM nodes and window objects don't pass through, as well
            if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || jQuery.isWindow( obj ) ) {
                return false;
            }
 
            // Not own constructor property must be Object
            Iif ( obj.constructor &&
                !hasOwn.call(obj, "constructor") &&
                !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
                return false;
            }
            // Own properties are enumerated firstly, so to speed up,
            // if last one is own, then all properties are own.
            // TODO: Isn't this enormously expensive?
            var key;
            for (key in obj) {} // eslint-disable-line no-empty
            return key === undefined || hasOwn.call( obj, key );
        },
 
        trim: function (str) {
            return str.trim();
        },
 
        isEmptyObject: function (obj) {
            for ( var name in obj ) { // eslint-disable-line no-unused-vars
                return false;
            }
            return true;
        },
 
        extend: function () {
            var options,
                target = arguments[0] || {},
                i = 1,
                length = arguments.length,
                deep = false;
 
            // Handle a deep copy situation
            if (typeof target === "boolean") {
                deep = target;
                target = arguments[1] || {};
                // skip the boolean and the target
                i = 2;
            }
 
            // Handle case when target is a string or something (possible in deep copy)
            Iif (typeof target !== "object" && typeof(target) !== "function") {
                target = {};
            }
 
            for ( ; i < length; i++ ) {
                // Only deal with non-null/undefined values
                Eif ( (options = arguments[ i ]) !== null ) {
                    // Extend the base object
                    for (var name in options) {
                        var src = target[ name ];
                        var copy = options[ name ];
 
                        // Prevent never-ending loop
                        Iif ( target === copy ) {
                            continue;
                        }
                        var copyIsArray, clone;
                        // Recurse if we're merging plain objects or arrays
                        if (deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy))) ) {
                            if (copyIsArray) {
                                copyIsArray = false;
                                clone = src && jQuery.isArray(src) ? src : [];
                            } else {
                                clone = src && jQuery.isPlainObject(src) ? src : {};
                            }
                            // Never move original objects, clone them
                            target[name] = jQuery.extend( deep, clone, copy );
                        } else if (copy !== undefined) {
                            // Don't bring in undefined values
                            target[name] = copy;
                        }
                    }
                }
            }
            return target;
        }
    };
 
})(fluid_3_0_0);
 
var jQuery = fluid.jQueryStandalone;