Skip to content

Commit

Permalink
FLUID-4568: Reformatting and relabelling
Browse files Browse the repository at this point in the history
  • Loading branch information
amb26 committed Dec 13, 2011
1 parent d361c85 commit 0803301
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 136 deletions.
245 changes: 110 additions & 135 deletions src/webapp/framework/core/js/jquery.standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,162 +5,137 @@
* http://jquery.com/
*
* Copyright 2011, John Resig
* Copyright 2011- OCAD University
*
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Thu May 12 15:04:36 2011 -0400
*/

var fluid_1_5 = fluid_1_5 || {};
var fluid = fluid || fluid_1_5;

(function (fluid) {

// Save a reference to some core methods
var toString = Object.prototype.toString;
var hasOwn = Object.prototype.hasOwnProperty;
var indexOf = Array.prototype.indexOf;
// Map over jQuery in case of overwrite
// Map over jQuery in case of overwrite
var _jQuery = window.jQuery;

// Map over the $ in case of overwrite
// Map over the $ in case of overwrite
var _$ = window.$;

var jQuery = fluid.jQueryStandalone = {

// The current version of jQuery being used
jquery: "1.6.1-fluidStandalone",

noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}

if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}

return jQuery;
},

isArray: Array.isArray || function( obj ) {
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
if ( 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.

var key;
for ( key in obj ) {}

return key === undefined || hasOwn.call( obj, key );
},

inArray: function( elem, array ) {

if ( indexOf ) {
return indexOf.call( array, elem );
}

for ( var i = 0, length = array.length; i < length; i++ ) {
if ( array[ i ] === elem ) {
return i;
var jQuery = fluid.jQueryStandalone = {

// The current version of jQuery being used
jquery: "1.6.1-fluidStandalone",

noConflict: function (deep) {
if (window.$ === jQuery) {
window.$ = _$;
}
}

return -1;
},

extend: function() {
var options, name, src, copy, copyIsArray, clone,
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)
if ( typeof target !== "object" && !typeof(target) === "function" ) {
target = {};
}

// extend jQuery itself if only one argument is passed
if ( length === i ) {
target = this;
--i;
}

for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];

// Prevent never-ending loop
if ( target === copy ) {
continue;
if (deep && window.jQuery === jQuery) {
window.jQuery = _jQuery;
}

// 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 );

// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
return jQuery;
},

isArray: Array.isArray || function (obj) {
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
if ( 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) {}
return key === undefined || hasOwn.call( obj, key );
},

inArray: function (elem, array) {
if (indexOf) {
return indexOf.call( array, elem );
}
for (var i = 0, length = array.length; i < length; i++) {
if (array[i] === elem) {
return i;
}
}
}
return -1;
},

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)
if (typeof target !== "object" && !typeof(target) === "function") {
target = {};
}

for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (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
if ( 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;
}
}

// Return the modified object
return target;
}
}


})(fluid_1_5);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

</head>
<body>
<h1 id="qunit-header">Fluid JS Test Suite</h1>
<h1 id="qunit-header">Fluid JS Standalone Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
Expand Down

0 comments on commit 0803301

Please sign in to comment.