| @@ -0,0 +1,9 @@ | ||
| { | ||
| "name": "angular-resource", | ||
| "version": "1.4.1", | ||
| "main": "./angular-resource.js", | ||
| "ignore": [], | ||
| "dependencies": { | ||
| "angular": "1.4.1" | ||
| } | ||
| } |
| @@ -0,0 +1,2 @@ | ||
| require('./angular-resource'); | ||
| module.exports = 'ngResource'; |
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "name": "angular-resource", | ||
| "version": "1.4.1", | ||
| "description": "AngularJS module for interacting with RESTful server-side data sources", | ||
| "main": "index.js", | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/angular/angular.js.git" | ||
| }, | ||
| "keywords": [ | ||
| "angular", | ||
| "framework", | ||
| "browser", | ||
| "rest", | ||
| "client-side" | ||
| ], | ||
| "author": "Angular Core Team <angular-core+npm@google.com>", | ||
| "license": "MIT", | ||
| "bugs": { | ||
| "url": "https://github.com/angular/angular.js/issues" | ||
| }, | ||
| "homepage": "http://angularjs.org" | ||
| } |
| @@ -0,0 +1,38 @@ | ||
| { | ||
| "name": "jquery", | ||
| "version": "2.1.4", | ||
| "main": "dist/jquery.js", | ||
| "license": "MIT", | ||
| "ignore": [ | ||
| "**/.*", | ||
| "build", | ||
| "dist/cdn", | ||
| "speed", | ||
| "test", | ||
| "*.md", | ||
| "AUTHORS.txt", | ||
| "Gruntfile.js", | ||
| "package.json" | ||
| ], | ||
| "devDependencies": { | ||
| "sizzle": "2.1.1-jquery.2.1.2", | ||
| "requirejs": "2.1.10", | ||
| "qunit": "1.14.0", | ||
| "sinon": "1.8.1" | ||
| }, | ||
| "keywords": [ | ||
| "jquery", | ||
| "javascript", | ||
| "library" | ||
| ], | ||
| "homepage": "https://github.com/jquery/jquery", | ||
| "_release": "2.1.4", | ||
| "_resolution": { | ||
| "type": "version", | ||
| "tag": "2.1.4", | ||
| "commit": "7751e69b615c6eca6f783a81e292a55725af6b85" | ||
| }, | ||
| "_source": "git://github.com/jquery/jquery.git", | ||
| "_target": ">=2.1.1", | ||
| "_originalSource": "jquery" | ||
| } |
| @@ -0,0 +1,21 @@ | ||
| Copyright 2014 jQuery Foundation and other contributors | ||
| http://jquery.com/ | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining | ||
| a copy of this software and associated documentation files (the | ||
| "Software"), to deal in the Software without restriction, including | ||
| without limitation the rights to use, copy, modify, merge, publish, | ||
| distribute, sublicense, and/or sell copies of the Software, and to | ||
| permit persons to whom the Software is furnished to do so, subject to | ||
| the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be | ||
| included in all copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
| LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
| OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
| WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "name": "jquery", | ||
| "version": "2.1.4", | ||
| "main": "dist/jquery.js", | ||
| "license": "MIT", | ||
| "ignore": [ | ||
| "**/.*", | ||
| "build", | ||
| "dist/cdn", | ||
| "speed", | ||
| "test", | ||
| "*.md", | ||
| "AUTHORS.txt", | ||
| "Gruntfile.js", | ||
| "package.json" | ||
| ], | ||
| "devDependencies": { | ||
| "sizzle": "2.1.1-jquery.2.1.2", | ||
| "requirejs": "2.1.10", | ||
| "qunit": "1.14.0", | ||
| "sinon": "1.8.1" | ||
| }, | ||
| "keywords": [ | ||
| "jquery", | ||
| "javascript", | ||
| "library" | ||
| ] | ||
| } |
| @@ -0,0 +1,89 @@ | ||
| define([ | ||
| "../core", | ||
| "./var/nonce", | ||
| "./var/rquery", | ||
| "../ajax" | ||
| ], function( jQuery, nonce, rquery ) { | ||
|
|
||
| var oldCallbacks = [], | ||
| rjsonp = /(=)\?(?=&|$)|\?\?/; | ||
|
|
||
| // Default jsonp settings | ||
| jQuery.ajaxSetup({ | ||
| jsonp: "callback", | ||
| jsonpCallback: function() { | ||
| var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); | ||
| this[ callback ] = true; | ||
| return callback; | ||
| } | ||
| }); | ||
|
|
||
| // Detect, normalize options and install callbacks for jsonp requests | ||
| jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { | ||
|
|
||
| var callbackName, overwritten, responseContainer, | ||
| jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? | ||
| "url" : | ||
| typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" | ||
| ); | ||
|
|
||
| // Handle iff the expected data type is "jsonp" or we have a parameter to set | ||
| if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { | ||
|
|
||
| // Get callback name, remembering preexisting value associated with it | ||
| callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? | ||
| s.jsonpCallback() : | ||
| s.jsonpCallback; | ||
|
|
||
| // Insert callback into url or form data | ||
| if ( jsonProp ) { | ||
| s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); | ||
| } else if ( s.jsonp !== false ) { | ||
| s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; | ||
| } | ||
|
|
||
| // Use data converter to retrieve json after script execution | ||
| s.converters["script json"] = function() { | ||
| if ( !responseContainer ) { | ||
| jQuery.error( callbackName + " was not called" ); | ||
| } | ||
| return responseContainer[ 0 ]; | ||
| }; | ||
|
|
||
| // force json dataType | ||
| s.dataTypes[ 0 ] = "json"; | ||
|
|
||
| // Install callback | ||
| overwritten = window[ callbackName ]; | ||
| window[ callbackName ] = function() { | ||
| responseContainer = arguments; | ||
| }; | ||
|
|
||
| // Clean-up function (fires after converters) | ||
| jqXHR.always(function() { | ||
| // Restore preexisting value | ||
| window[ callbackName ] = overwritten; | ||
|
|
||
| // Save back as free | ||
| if ( s[ callbackName ] ) { | ||
| // make sure that re-using the options doesn't screw things around | ||
| s.jsonpCallback = originalSettings.jsonpCallback; | ||
|
|
||
| // save the callback name for future use | ||
| oldCallbacks.push( callbackName ); | ||
| } | ||
|
|
||
| // Call if it was a function and we have a response | ||
| if ( responseContainer && jQuery.isFunction( overwritten ) ) { | ||
| overwritten( responseContainer[ 0 ] ); | ||
| } | ||
|
|
||
| responseContainer = overwritten = undefined; | ||
| }); | ||
|
|
||
| // Delegate to script | ||
| return "script"; | ||
| } | ||
| }); | ||
|
|
||
| }); |
| @@ -0,0 +1,75 @@ | ||
| define([ | ||
| "../core", | ||
| "../core/parseHTML", | ||
| "../ajax", | ||
| "../traversing", | ||
| "../manipulation", | ||
| "../selector", | ||
| // Optional event/alias dependency | ||
| "../event/alias" | ||
| ], function( jQuery ) { | ||
|
|
||
| // Keep a copy of the old load method | ||
| var _load = jQuery.fn.load; | ||
|
|
||
| /** | ||
| * Load a url into a page | ||
| */ | ||
| jQuery.fn.load = function( url, params, callback ) { | ||
| if ( typeof url !== "string" && _load ) { | ||
| return _load.apply( this, arguments ); | ||
| } | ||
|
|
||
| var selector, type, response, | ||
| self = this, | ||
| off = url.indexOf(" "); | ||
|
|
||
| if ( off >= 0 ) { | ||
| selector = jQuery.trim( url.slice( off ) ); | ||
| url = url.slice( 0, off ); | ||
| } | ||
|
|
||
| // If it's a function | ||
| if ( jQuery.isFunction( params ) ) { | ||
|
|
||
| // We assume that it's the callback | ||
| callback = params; | ||
| params = undefined; | ||
|
|
||
| // Otherwise, build a param string | ||
| } else if ( params && typeof params === "object" ) { | ||
| type = "POST"; | ||
| } | ||
|
|
||
| // If we have elements to modify, make the request | ||
| if ( self.length > 0 ) { | ||
| jQuery.ajax({ | ||
| url: url, | ||
|
|
||
| // if "type" variable is undefined, then "GET" method will be used | ||
| type: type, | ||
| dataType: "html", | ||
| data: params | ||
| }).done(function( responseText ) { | ||
|
|
||
| // Save response for use in complete callback | ||
| response = arguments; | ||
|
|
||
| self.html( selector ? | ||
|
|
||
| // If a selector was specified, locate the right elements in a dummy div | ||
| // Exclude scripts to avoid IE 'Permission Denied' errors | ||
| jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : | ||
|
|
||
| // Otherwise use the full result | ||
| responseText ); | ||
|
|
||
| }).complete( callback && function( jqXHR, status ) { | ||
| self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); | ||
| }); | ||
| } | ||
|
|
||
| return this; | ||
| }; | ||
|
|
||
| }); |
| @@ -0,0 +1,13 @@ | ||
| define([ | ||
| "../core" | ||
| ], function( jQuery ) { | ||
|
|
||
| // Support: Android 2.3 | ||
| // Workaround failure to string-cast null input | ||
| jQuery.parseJSON = function( data ) { | ||
| return JSON.parse( data + "" ); | ||
| }; | ||
|
|
||
| return jQuery.parseJSON; | ||
|
|
||
| }); |
| @@ -0,0 +1,28 @@ | ||
| define([ | ||
| "../core" | ||
| ], function( jQuery ) { | ||
|
|
||
| // Cross-browser xml parsing | ||
| jQuery.parseXML = function( data ) { | ||
| var xml, tmp; | ||
| if ( !data || typeof data !== "string" ) { | ||
| return null; | ||
| } | ||
|
|
||
| // Support: IE9 | ||
| try { | ||
| tmp = new DOMParser(); | ||
| xml = tmp.parseFromString( data, "text/xml" ); | ||
| } catch ( e ) { | ||
| xml = undefined; | ||
| } | ||
|
|
||
| if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { | ||
| jQuery.error( "Invalid XML: " + data ); | ||
| } | ||
| return xml; | ||
| }; | ||
|
|
||
| return jQuery.parseXML; | ||
|
|
||
| }); |
| @@ -0,0 +1,64 @@ | ||
| define([ | ||
| "../core", | ||
| "../ajax" | ||
| ], function( jQuery ) { | ||
|
|
||
| // Install script dataType | ||
| jQuery.ajaxSetup({ | ||
| accepts: { | ||
| script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" | ||
| }, | ||
| contents: { | ||
| script: /(?:java|ecma)script/ | ||
| }, | ||
| converters: { | ||
| "text script": function( text ) { | ||
| jQuery.globalEval( text ); | ||
| return text; | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| // Handle cache's special case and crossDomain | ||
| jQuery.ajaxPrefilter( "script", function( s ) { | ||
| if ( s.cache === undefined ) { | ||
| s.cache = false; | ||
| } | ||
| if ( s.crossDomain ) { | ||
| s.type = "GET"; | ||
| } | ||
| }); | ||
|
|
||
| // Bind script tag hack transport | ||
| jQuery.ajaxTransport( "script", function( s ) { | ||
| // This transport only deals with cross domain requests | ||
| if ( s.crossDomain ) { | ||
| var script, callback; | ||
| return { | ||
| send: function( _, complete ) { | ||
| script = jQuery("<script>").prop({ | ||
| async: true, | ||
| charset: s.scriptCharset, | ||
| src: s.url | ||
| }).on( | ||
| "load error", | ||
| callback = function( evt ) { | ||
| script.remove(); | ||
| callback = null; | ||
| if ( evt ) { | ||
| complete( evt.type === "error" ? 404 : 200, evt.type ); | ||
| } | ||
| } | ||
| ); | ||
| document.head.appendChild( script[ 0 ] ); | ||
| }, | ||
| abort: function() { | ||
| if ( callback ) { | ||
| callback(); | ||
| } | ||
| } | ||
| }; | ||
| } | ||
| }); | ||
|
|
||
| }); |
| @@ -0,0 +1,5 @@ | ||
| define([ | ||
| "../../core" | ||
| ], function( jQuery ) { | ||
| return jQuery.now(); | ||
| }); |
| @@ -0,0 +1,3 @@ | ||
| define(function() { | ||
| return (/\?/); | ||
| }); |
| @@ -0,0 +1,136 @@ | ||
| define([ | ||
| "../core", | ||
| "../var/support", | ||
| "../ajax" | ||
| ], function( jQuery, support ) { | ||
|
|
||
| jQuery.ajaxSettings.xhr = function() { | ||
| try { | ||
| return new XMLHttpRequest(); | ||
| } catch( e ) {} | ||
| }; | ||
|
|
||
| var xhrId = 0, | ||
| xhrCallbacks = {}, | ||
| xhrSuccessStatus = { | ||
| // file protocol always yields status code 0, assume 200 | ||
| 0: 200, | ||
| // Support: IE9 | ||
| // #1450: sometimes IE returns 1223 when it should be 204 | ||
| 1223: 204 | ||
| }, | ||
| xhrSupported = jQuery.ajaxSettings.xhr(); | ||
|
|
||
| // Support: IE9 | ||
| // Open requests must be manually aborted on unload (#5280) | ||
| // See https://support.microsoft.com/kb/2856746 for more info | ||
| if ( window.attachEvent ) { | ||
| window.attachEvent( "onunload", function() { | ||
| for ( var key in xhrCallbacks ) { | ||
| xhrCallbacks[ key ](); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); | ||
| support.ajax = xhrSupported = !!xhrSupported; | ||
|
|
||
| jQuery.ajaxTransport(function( options ) { | ||
| var callback; | ||
|
|
||
| // Cross domain only allowed if supported through XMLHttpRequest | ||
| if ( support.cors || xhrSupported && !options.crossDomain ) { | ||
| return { | ||
| send: function( headers, complete ) { | ||
| var i, | ||
| xhr = options.xhr(), | ||
| id = ++xhrId; | ||
|
|
||
| xhr.open( options.type, options.url, options.async, options.username, options.password ); | ||
|
|
||
| // Apply custom fields if provided | ||
| if ( options.xhrFields ) { | ||
| for ( i in options.xhrFields ) { | ||
| xhr[ i ] = options.xhrFields[ i ]; | ||
| } | ||
| } | ||
|
|
||
| // Override mime type if needed | ||
| if ( options.mimeType && xhr.overrideMimeType ) { | ||
| xhr.overrideMimeType( options.mimeType ); | ||
| } | ||
|
|
||
| // X-Requested-With header | ||
| // For cross-domain requests, seeing as conditions for a preflight are | ||
| // akin to a jigsaw puzzle, we simply never set it to be sure. | ||
| // (it can always be set on a per-request basis or even using ajaxSetup) | ||
| // For same-domain requests, won't change header if already provided. | ||
| if ( !options.crossDomain && !headers["X-Requested-With"] ) { | ||
| headers["X-Requested-With"] = "XMLHttpRequest"; | ||
| } | ||
|
|
||
| // Set headers | ||
| for ( i in headers ) { | ||
| xhr.setRequestHeader( i, headers[ i ] ); | ||
| } | ||
|
|
||
| // Callback | ||
| callback = function( type ) { | ||
| return function() { | ||
| if ( callback ) { | ||
| delete xhrCallbacks[ id ]; | ||
| callback = xhr.onload = xhr.onerror = null; | ||
|
|
||
| if ( type === "abort" ) { | ||
| xhr.abort(); | ||
| } else if ( type === "error" ) { | ||
| complete( | ||
| // file: protocol always yields status 0; see #8605, #14207 | ||
| xhr.status, | ||
| xhr.statusText | ||
| ); | ||
| } else { | ||
| complete( | ||
| xhrSuccessStatus[ xhr.status ] || xhr.status, | ||
| xhr.statusText, | ||
| // Support: IE9 | ||
| // Accessing binary-data responseText throws an exception | ||
| // (#11426) | ||
| typeof xhr.responseText === "string" ? { | ||
| text: xhr.responseText | ||
| } : undefined, | ||
| xhr.getAllResponseHeaders() | ||
| ); | ||
| } | ||
| } | ||
| }; | ||
| }; | ||
|
|
||
| // Listen to events | ||
| xhr.onload = callback(); | ||
| xhr.onerror = callback("error"); | ||
|
|
||
| // Create the abort callback | ||
| callback = xhrCallbacks[ id ] = callback("abort"); | ||
|
|
||
| try { | ||
| // Do send the request (this may raise an exception) | ||
| xhr.send( options.hasContent && options.data || null ); | ||
| } catch ( e ) { | ||
| // #14683: Only rethrow if this hasn't been notified as an error yet | ||
| if ( callback ) { | ||
| throw e; | ||
| } | ||
| } | ||
| }, | ||
|
|
||
| abort: function() { | ||
| if ( callback ) { | ||
| callback(); | ||
| } | ||
| } | ||
| }; | ||
| } | ||
| }); | ||
|
|
||
| }); |
| @@ -0,0 +1,11 @@ | ||
| define([ | ||
| "./core", | ||
| "./attributes/attr", | ||
| "./attributes/prop", | ||
| "./attributes/classes", | ||
| "./attributes/val" | ||
| ], function( jQuery ) { | ||
|
|
||
| // Return jQuery for attributes-only inclusion | ||
| return jQuery; | ||
| }); |
| @@ -0,0 +1,141 @@ | ||
| define([ | ||
| "../core", | ||
| "../var/rnotwhite", | ||
| "../var/strundefined", | ||
| "../core/access", | ||
| "./support", | ||
| "../selector" | ||
| ], function( jQuery, rnotwhite, strundefined, access, support ) { | ||
|
|
||
| var nodeHook, boolHook, | ||
| attrHandle = jQuery.expr.attrHandle; | ||
|
|
||
| jQuery.fn.extend({ | ||
| attr: function( name, value ) { | ||
| return access( this, jQuery.attr, name, value, arguments.length > 1 ); | ||
| }, | ||
|
|
||
| removeAttr: function( name ) { | ||
| return this.each(function() { | ||
| jQuery.removeAttr( this, name ); | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| jQuery.extend({ | ||
| attr: function( elem, name, value ) { | ||
| var hooks, ret, | ||
| nType = elem.nodeType; | ||
|
|
||
| // don't get/set attributes on text, comment and attribute nodes | ||
| if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { | ||
| return; | ||
| } | ||
|
|
||
| // Fallback to prop when attributes are not supported | ||
| if ( typeof elem.getAttribute === strundefined ) { | ||
| return jQuery.prop( elem, name, value ); | ||
| } | ||
|
|
||
| // All attributes are lowercase | ||
| // Grab necessary hook if one is defined | ||
| if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { | ||
| name = name.toLowerCase(); | ||
| hooks = jQuery.attrHooks[ name ] || | ||
| ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); | ||
| } | ||
|
|
||
| if ( value !== undefined ) { | ||
|
|
||
| if ( value === null ) { | ||
| jQuery.removeAttr( elem, name ); | ||
|
|
||
| } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { | ||
| return ret; | ||
|
|
||
| } else { | ||
| elem.setAttribute( name, value + "" ); | ||
| return value; | ||
| } | ||
|
|
||
| } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { | ||
| return ret; | ||
|
|
||
| } else { | ||
| ret = jQuery.find.attr( elem, name ); | ||
|
|
||
| // Non-existent attributes return null, we normalize to undefined | ||
| return ret == null ? | ||
| undefined : | ||
| ret; | ||
| } | ||
| }, | ||
|
|
||
| removeAttr: function( elem, value ) { | ||
| var name, propName, | ||
| i = 0, | ||
| attrNames = value && value.match( rnotwhite ); | ||
|
|
||
| if ( attrNames && elem.nodeType === 1 ) { | ||
| while ( (name = attrNames[i++]) ) { | ||
| propName = jQuery.propFix[ name ] || name; | ||
|
|
||
| // Boolean attributes get special treatment (#10870) | ||
| if ( jQuery.expr.match.bool.test( name ) ) { | ||
| // Set corresponding property to false | ||
| elem[ propName ] = false; | ||
| } | ||
|
|
||
| elem.removeAttribute( name ); | ||
| } | ||
| } | ||
| }, | ||
|
|
||
| attrHooks: { | ||
| type: { | ||
| set: function( elem, value ) { | ||
| if ( !support.radioValue && value === "radio" && | ||
| jQuery.nodeName( elem, "input" ) ) { | ||
| var val = elem.value; | ||
| elem.setAttribute( "type", value ); | ||
| if ( val ) { | ||
| elem.value = val; | ||
| } | ||
| return value; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| // Hooks for boolean attributes | ||
| boolHook = { | ||
| set: function( elem, value, name ) { | ||
| if ( value === false ) { | ||
| // Remove boolean attributes when set to false | ||
| jQuery.removeAttr( elem, name ); | ||
| } else { | ||
| elem.setAttribute( name, name ); | ||
| } | ||
| return name; | ||
| } | ||
| }; | ||
| jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { | ||
| var getter = attrHandle[ name ] || jQuery.find.attr; | ||
|
|
||
| attrHandle[ name ] = function( elem, name, isXML ) { | ||
| var ret, handle; | ||
| if ( !isXML ) { | ||
| // Avoid an infinite loop by temporarily removing this function from the getter | ||
| handle = attrHandle[ name ]; | ||
| attrHandle[ name ] = ret; | ||
| ret = getter( elem, name, isXML ) != null ? | ||
| name.toLowerCase() : | ||
| null; | ||
| attrHandle[ name ] = handle; | ||
| } | ||
| return ret; | ||
| }; | ||
| }); | ||
|
|
||
| }); |
| @@ -0,0 +1,158 @@ | ||
| define([ | ||
| "../core", | ||
| "../var/rnotwhite", | ||
| "../var/strundefined", | ||
| "../data/var/data_priv", | ||
| "../core/init" | ||
| ], function( jQuery, rnotwhite, strundefined, data_priv ) { | ||
|
|
||
| var rclass = /[\t\r\n\f]/g; | ||
|
|
||
| jQuery.fn.extend({ | ||
| addClass: function( value ) { | ||
| var classes, elem, cur, clazz, j, finalValue, | ||
| proceed = typeof value === "string" && value, | ||
| i = 0, | ||
| len = this.length; | ||
|
|
||
| if ( jQuery.isFunction( value ) ) { | ||
| return this.each(function( j ) { | ||
| jQuery( this ).addClass( value.call( this, j, this.className ) ); | ||
| }); | ||
| } | ||
|
|
||
| if ( proceed ) { | ||
| // The disjunction here is for better compressibility (see removeClass) | ||
| classes = ( value || "" ).match( rnotwhite ) || []; | ||
|
|
||
| for ( ; i < len; i++ ) { | ||
| elem = this[ i ]; | ||
| cur = elem.nodeType === 1 && ( elem.className ? | ||
| ( " " + elem.className + " " ).replace( rclass, " " ) : | ||
| " " | ||
| ); | ||
|
|
||
| if ( cur ) { | ||
| j = 0; | ||
| while ( (clazz = classes[j++]) ) { | ||
| if ( cur.indexOf( " " + clazz + " " ) < 0 ) { | ||
| cur += clazz + " "; | ||
| } | ||
| } | ||
|
|
||
| // only assign if different to avoid unneeded rendering. | ||
| finalValue = jQuery.trim( cur ); | ||
| if ( elem.className !== finalValue ) { | ||
| elem.className = finalValue; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return this; | ||
| }, | ||
|
|
||
| removeClass: function( value ) { | ||
| var classes, elem, cur, clazz, j, finalValue, | ||
| proceed = arguments.length === 0 || typeof value === "string" && value, | ||
| i = 0, | ||
| len = this.length; | ||
|
|
||
| if ( jQuery.isFunction( value ) ) { | ||
| return this.each(function( j ) { | ||
| jQuery( this ).removeClass( value.call( this, j, this.className ) ); | ||
| }); | ||
| } | ||
| if ( proceed ) { | ||
| classes = ( value || "" ).match( rnotwhite ) || []; | ||
|
|
||
| for ( ; i < len; i++ ) { | ||
| elem = this[ i ]; | ||
| // This expression is here for better compressibility (see addClass) | ||
| cur = elem.nodeType === 1 && ( elem.className ? | ||
| ( " " + elem.className + " " ).replace( rclass, " " ) : | ||
| "" | ||
| ); | ||
|
|
||
| if ( cur ) { | ||
| j = 0; | ||
| while ( (clazz = classes[j++]) ) { | ||
| // Remove *all* instances | ||
| while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { | ||
| cur = cur.replace( " " + clazz + " ", " " ); | ||
| } | ||
| } | ||
|
|
||
| // Only assign if different to avoid unneeded rendering. | ||
| finalValue = value ? jQuery.trim( cur ) : ""; | ||
| if ( elem.className !== finalValue ) { | ||
| elem.className = finalValue; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return this; | ||
| }, | ||
|
|
||
| toggleClass: function( value, stateVal ) { | ||
| var type = typeof value; | ||
|
|
||
| if ( typeof stateVal === "boolean" && type === "string" ) { | ||
| return stateVal ? this.addClass( value ) : this.removeClass( value ); | ||
| } | ||
|
|
||
| if ( jQuery.isFunction( value ) ) { | ||
| return this.each(function( i ) { | ||
| jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); | ||
| }); | ||
| } | ||
|
|
||
| return this.each(function() { | ||
| if ( type === "string" ) { | ||
| // Toggle individual class names | ||
| var className, | ||
| i = 0, | ||
| self = jQuery( this ), | ||
| classNames = value.match( rnotwhite ) || []; | ||
|
|
||
| while ( (className = classNames[ i++ ]) ) { | ||
| // Check each className given, space separated list | ||
| if ( self.hasClass( className ) ) { | ||
| self.removeClass( className ); | ||
| } else { | ||
| self.addClass( className ); | ||
| } | ||
| } | ||
|
|
||
| // Toggle whole class name | ||
| } else if ( type === strundefined || type === "boolean" ) { | ||
| if ( this.className ) { | ||
| // store className if set | ||
| data_priv.set( this, "__className__", this.className ); | ||
| } | ||
|
|
||
| // If the element has a class name or if we're passed `false`, | ||
| // then remove the whole classname (if there was one, the above saved it). | ||
| // Otherwise bring back whatever was previously saved (if anything), | ||
| // falling back to the empty string if nothing was stored. | ||
| this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || ""; | ||
| } | ||
| }); | ||
| }, | ||
|
|
||
| hasClass: function( selector ) { | ||
| var className = " " + selector + " ", | ||
| i = 0, | ||
| l = this.length; | ||
| for ( ; i < l; i++ ) { | ||
| if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
| }); | ||
|
|
||
| }); |
| @@ -0,0 +1,94 @@ | ||
| define([ | ||
| "../core", | ||
| "../core/access", | ||
| "./support" | ||
| ], function( jQuery, access, support ) { | ||
|
|
||
| var rfocusable = /^(?:input|select|textarea|button)$/i; | ||
|
|
||
| jQuery.fn.extend({ | ||
| prop: function( name, value ) { | ||
| return access( this, jQuery.prop, name, value, arguments.length > 1 ); | ||
| }, | ||
|
|
||
| removeProp: function( name ) { | ||
| return this.each(function() { | ||
| delete this[ jQuery.propFix[ name ] || name ]; | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| jQuery.extend({ | ||
| propFix: { | ||
| "for": "htmlFor", | ||
| "class": "className" | ||
| }, | ||
|
|
||
| prop: function( elem, name, value ) { | ||
| var ret, hooks, notxml, | ||
| nType = elem.nodeType; | ||
|
|
||
| // Don't get/set properties on text, comment and attribute nodes | ||
| if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { | ||
| return; | ||
| } | ||
|
|
||
| notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); | ||
|
|
||
| if ( notxml ) { | ||
| // Fix name and attach hooks | ||
| name = jQuery.propFix[ name ] || name; | ||
| hooks = jQuery.propHooks[ name ]; | ||
| } | ||
|
|
||
| if ( value !== undefined ) { | ||
| return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? | ||
| ret : | ||
| ( elem[ name ] = value ); | ||
|
|
||
| } else { | ||
| return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? | ||
| ret : | ||
| elem[ name ]; | ||
| } | ||
| }, | ||
|
|
||
| propHooks: { | ||
| tabIndex: { | ||
| get: function( elem ) { | ||
| return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ? | ||
| elem.tabIndex : | ||
| -1; | ||
| } | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| if ( !support.optSelected ) { | ||
| jQuery.propHooks.selected = { | ||
| get: function( elem ) { | ||
| var parent = elem.parentNode; | ||
| if ( parent && parent.parentNode ) { | ||
| parent.parentNode.selectedIndex; | ||
| } | ||
| return null; | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| jQuery.each([ | ||
| "tabIndex", | ||
| "readOnly", | ||
| "maxLength", | ||
| "cellSpacing", | ||
| "cellPadding", | ||
| "rowSpan", | ||
| "colSpan", | ||
| "useMap", | ||
| "frameBorder", | ||
| "contentEditable" | ||
| ], function() { | ||
| jQuery.propFix[ this.toLowerCase() ] = this; | ||
| }); | ||
|
|
||
| }); |
| @@ -0,0 +1,35 @@ | ||
| define([ | ||
| "../var/support" | ||
| ], function( support ) { | ||
|
|
||
| (function() { | ||
| var input = document.createElement( "input" ), | ||
| select = document.createElement( "select" ), | ||
| opt = select.appendChild( document.createElement( "option" ) ); | ||
|
|
||
| input.type = "checkbox"; | ||
|
|
||
| // Support: iOS<=5.1, Android<=4.2+ | ||
| // Default value for a checkbox should be "on" | ||
| support.checkOn = input.value !== ""; | ||
|
|
||
| // Support: IE<=11+ | ||
| // Must access selectedIndex to make default options select | ||
| support.optSelected = opt.selected; | ||
|
|
||
| // Support: Android<=2.3 | ||
| // Options inside disabled selects are incorrectly marked as disabled | ||
| select.disabled = true; | ||
| support.optDisabled = !opt.disabled; | ||
|
|
||
| // Support: IE<=11+ | ||
| // An input loses its value after becoming a radio | ||
| input = document.createElement( "input" ); | ||
| input.value = "t"; | ||
| input.type = "radio"; | ||
| support.radioValue = input.value === "t"; | ||
| })(); | ||
|
|
||
| return support; | ||
|
|
||
| }); |
| @@ -0,0 +1,161 @@ | ||
| define([ | ||
| "../core", | ||
| "./support", | ||
| "../core/init" | ||
| ], function( jQuery, support ) { | ||
|
|
||
| var rreturn = /\r/g; | ||
|
|
||
| jQuery.fn.extend({ | ||
| val: function( value ) { | ||
| var hooks, ret, isFunction, | ||
| elem = this[0]; | ||
|
|
||
| if ( !arguments.length ) { | ||
| if ( elem ) { | ||
| hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; | ||
|
|
||
| if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { | ||
| return ret; | ||
| } | ||
|
|
||
| ret = elem.value; | ||
|
|
||
| return typeof ret === "string" ? | ||
| // Handle most common string cases | ||
| ret.replace(rreturn, "") : | ||
| // Handle cases where value is null/undef or number | ||
| ret == null ? "" : ret; | ||
| } | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| isFunction = jQuery.isFunction( value ); | ||
|
|
||
| return this.each(function( i ) { | ||
| var val; | ||
|
|
||
| if ( this.nodeType !== 1 ) { | ||
| return; | ||
| } | ||
|
|
||
| if ( isFunction ) { | ||
| val = value.call( this, i, jQuery( this ).val() ); | ||
| } else { | ||
| val = value; | ||
| } | ||
|
|
||
| // Treat null/undefined as ""; convert numbers to string | ||
| if ( val == null ) { | ||
| val = ""; | ||
|
|
||
| } else if ( typeof val === "number" ) { | ||
| val += ""; | ||
|
|
||
| } else if ( jQuery.isArray( val ) ) { | ||
| val = jQuery.map( val, function( value ) { | ||
| return value == null ? "" : value + ""; | ||
| }); | ||
| } | ||
|
|
||
| hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; | ||
|
|
||
| // If set returns undefined, fall back to normal setting | ||
| if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { | ||
| this.value = val; | ||
| } | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| jQuery.extend({ | ||
| valHooks: { | ||
| option: { | ||
| get: function( elem ) { | ||
| var val = jQuery.find.attr( elem, "value" ); | ||
| return val != null ? | ||
| val : | ||
| // Support: IE10-11+ | ||
| // option.text throws exceptions (#14686, #14858) | ||
| jQuery.trim( jQuery.text( elem ) ); | ||
| } | ||
| }, | ||
| select: { | ||
| get: function( elem ) { | ||
| var value, option, | ||
| options = elem.options, | ||
| index = elem.selectedIndex, | ||
| one = elem.type === "select-one" || index < 0, | ||
| values = one ? null : [], | ||
| max = one ? index + 1 : options.length, | ||
| i = index < 0 ? | ||
| max : | ||
| one ? index : 0; | ||
|
|
||
| // Loop through all the selected options | ||
| for ( ; i < max; i++ ) { | ||
| option = options[ i ]; | ||
|
|
||
| // IE6-9 doesn't update selected after form reset (#2551) | ||
| if ( ( option.selected || i === index ) && | ||
| // Don't return options that are disabled or in a disabled optgroup | ||
| ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) && | ||
| ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { | ||
|
|
||
| // Get the specific value for the option | ||
| value = jQuery( option ).val(); | ||
|
|
||
| // We don't need an array for one selects | ||
| if ( one ) { | ||
| return value; | ||
| } | ||
|
|
||
| // Multi-Selects return an array | ||
| values.push( value ); | ||
| } | ||
| } | ||
|
|
||
| return values; | ||
| }, | ||
|
|
||
| set: function( elem, value ) { | ||
| var optionSet, option, | ||
| options = elem.options, | ||
| values = jQuery.makeArray( value ), | ||
| i = options.length; | ||
|
|
||
| while ( i-- ) { | ||
| option = options[ i ]; | ||
| if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) { | ||
| optionSet = true; | ||
| } | ||
| } | ||
|
|
||
| // Force browsers to behave consistently when non-matching value is set | ||
| if ( !optionSet ) { | ||
| elem.selectedIndex = -1; | ||
| } | ||
| return values; | ||
| } | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| // Radios and checkboxes getter/setter | ||
| jQuery.each([ "radio", "checkbox" ], function() { | ||
| jQuery.valHooks[ this ] = { | ||
| set: function( elem, value ) { | ||
| if ( jQuery.isArray( value ) ) { | ||
| return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); | ||
| } | ||
| } | ||
| }; | ||
| if ( !support.checkOn ) { | ||
| jQuery.valHooks[ this ].get = function( elem ) { | ||
| return elem.getAttribute("value") === null ? "on" : elem.value; | ||
| }; | ||
| } | ||
| }); | ||
|
|
||
| }); |
| @@ -0,0 +1,205 @@ | ||
| define([ | ||
| "./core", | ||
| "./var/rnotwhite" | ||
| ], function( jQuery, rnotwhite ) { | ||
|
|
||
| // String to Object options format cache | ||
| var optionsCache = {}; | ||
|
|
||
| // Convert String-formatted options into Object-formatted ones and store in cache | ||
| function createOptions( options ) { | ||
| var object = optionsCache[ options ] = {}; | ||
| jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { | ||
| object[ flag ] = true; | ||
| }); | ||
| return object; | ||
| } | ||
|
|
||
| /* | ||
| * Create a callback list using the following parameters: | ||
| * | ||
| * options: an optional list of space-separated options that will change how | ||
| * the callback list behaves or a more traditional option object | ||
| * | ||
| * By default a callback list will act like an event callback list and can be | ||
| * "fired" multiple times. | ||
| * | ||
| * Possible options: | ||
| * | ||
| * once: will ensure the callback list can only be fired once (like a Deferred) | ||
| * | ||
| * memory: will keep track of previous values and will call any callback added | ||
| * after the list has been fired right away with the latest "memorized" | ||
| * values (like a Deferred) | ||
| * | ||
| * unique: will ensure a callback can only be added once (no duplicate in the list) | ||
| * | ||
| * stopOnFalse: interrupt callings when a callback returns false | ||
| * | ||
| */ | ||
| jQuery.Callbacks = function( options ) { | ||
|
|
||
| // Convert options from String-formatted to Object-formatted if needed | ||
| // (we check in cache first) | ||
| options = typeof options === "string" ? | ||
| ( optionsCache[ options ] || createOptions( options ) ) : | ||
| jQuery.extend( {}, options ); | ||
|
|
||
| var // Last fire value (for non-forgettable lists) | ||
| memory, | ||
| // Flag to know if list was already fired | ||
| fired, | ||
| // Flag to know if list is currently firing | ||
| firing, | ||
| // First callback to fire (used internally by add and fireWith) | ||
| firingStart, | ||
| // End of the loop when firing | ||
| firingLength, | ||
| // Index of currently firing callback (modified by remove if needed) | ||
| firingIndex, | ||
| // Actual callback list | ||
| list = [], | ||
| // Stack of fire calls for repeatable lists | ||
| stack = !options.once && [], | ||
| // Fire callbacks | ||
| fire = function( data ) { | ||
| memory = options.memory && data; | ||
| fired = true; | ||
| firingIndex = firingStart || 0; | ||
| firingStart = 0; | ||
| firingLength = list.length; | ||
| firing = true; | ||
| for ( ; list && firingIndex < firingLength; firingIndex++ ) { | ||
| if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { | ||
| memory = false; // To prevent further calls using add | ||
| break; | ||
| } | ||
| } | ||
| firing = false; | ||
| if ( list ) { | ||
| if ( stack ) { | ||
| if ( stack.length ) { | ||
| fire( stack.shift() ); | ||
| } | ||
| } else if ( memory ) { | ||
| list = []; | ||
| } else { | ||
| self.disable(); | ||
| } | ||
| } | ||
| }, | ||
| // Actual Callbacks object | ||
| self = { | ||
| // Add a callback or a collection of callbacks to the list | ||
| add: function() { | ||
| if ( list ) { | ||
| // First, we save the current length | ||
| var start = list.length; | ||
| (function add( args ) { | ||
| jQuery.each( args, function( _, arg ) { | ||
| var type = jQuery.type( arg ); | ||
| if ( type === "function" ) { | ||
| if ( !options.unique || !self.has( arg ) ) { | ||
| list.push( arg ); | ||
| } | ||
| } else if ( arg && arg.length && type !== "string" ) { | ||
| // Inspect recursively | ||
| add( arg ); | ||
| } | ||
| }); | ||
| })( arguments ); | ||
| // Do we need to add the callbacks to the | ||
| // current firing batch? | ||
| if ( firing ) { | ||
| firingLength = list.length; | ||
| // With memory, if we're not firing then | ||
| // we should call right away | ||
| } else if ( memory ) { | ||
| firingStart = start; | ||
| fire( memory ); | ||
| } | ||
| } | ||
| return this; | ||
| }, | ||
| // Remove a callback from the list | ||
| remove: function() { | ||
| if ( list ) { | ||
| jQuery.each( arguments, function( _, arg ) { | ||
| var index; | ||
| while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { | ||
| list.splice( index, 1 ); | ||
| // Handle firing indexes | ||
| if ( firing ) { | ||
| if ( index <= firingLength ) { | ||
| firingLength--; | ||
| } | ||
| if ( index <= firingIndex ) { | ||
| firingIndex--; | ||
| } | ||
| } | ||
| } | ||
| }); | ||
| } | ||
| return this; | ||
| }, | ||
| // Check if a given callback is in the list. | ||
| // If no argument is given, return whether or not list has callbacks attached. | ||
| has: function( fn ) { | ||
| return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); | ||
| }, | ||
| // Remove all callbacks from the list | ||
| empty: function() { | ||
| list = []; | ||
| firingLength = 0; | ||
| return this; | ||
| }, | ||
| // Have the list do nothing anymore | ||
| disable: function() { | ||
| list = stack = memory = undefined; | ||
| return this; | ||
| }, | ||
| // Is it disabled? | ||
| disabled: function() { | ||
| return !list; | ||
| }, | ||
| // Lock the list in its current state | ||
| lock: function() { | ||
| stack = undefined; | ||
| if ( !memory ) { | ||
| self.disable(); | ||
| } | ||
| return this; | ||
| }, | ||
| // Is it locked? | ||
| locked: function() { | ||
| return !stack; | ||
| }, | ||
| // Call all callbacks with the given context and arguments | ||
| fireWith: function( context, args ) { | ||
| if ( list && ( !fired || stack ) ) { | ||
| args = args || []; | ||
| args = [ context, args.slice ? args.slice() : args ]; | ||
| if ( firing ) { | ||
| stack.push( args ); | ||
| } else { | ||
| fire( args ); | ||
| } | ||
| } | ||
| return this; | ||
| }, | ||
| // Call all the callbacks with the given arguments | ||
| fire: function() { | ||
| self.fireWith( this, arguments ); | ||
| return this; | ||
| }, | ||
| // To know if the callbacks have already been called at least once | ||
| fired: function() { | ||
| return !!fired; | ||
| } | ||
| }; | ||
|
|
||
| return self; | ||
| }; | ||
|
|
||
| return jQuery; | ||
| }); |
| @@ -0,0 +1,60 @@ | ||
| define([ | ||
| "../core" | ||
| ], function( jQuery ) { | ||
|
|
||
| // Multifunctional method to get and set values of a collection | ||
| // The value/s can optionally be executed if it's a function | ||
| var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { | ||
| var i = 0, | ||
| len = elems.length, | ||
| bulk = key == null; | ||
|
|
||
| // Sets many values | ||
| if ( jQuery.type( key ) === "object" ) { | ||
| chainable = true; | ||
| for ( i in key ) { | ||
| jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); | ||
| } | ||
|
|
||
| // Sets one value | ||
| } else if ( value !== undefined ) { | ||
| chainable = true; | ||
|
|
||
| if ( !jQuery.isFunction( value ) ) { | ||
| raw = true; | ||
| } | ||
|
|
||
| if ( bulk ) { | ||
| // Bulk operations run against the entire set | ||
| if ( raw ) { | ||
| fn.call( elems, value ); | ||
| fn = null; | ||
|
|
||
| // ...except when executing function values | ||
| } else { | ||
| bulk = fn; | ||
| fn = function( elem, key, value ) { | ||
| return bulk.call( jQuery( elem ), value ); | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| if ( fn ) { | ||
| for ( ; i < len; i++ ) { | ||
| fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return chainable ? | ||
| elems : | ||
|
|
||
| // Gets | ||
| bulk ? | ||
| fn.call( elems ) : | ||
| len ? fn( elems[0], key ) : emptyGet; | ||
| }; | ||
|
|
||
| return access; | ||
|
|
||
| }); |
| @@ -0,0 +1,123 @@ | ||
| // Initialize a jQuery object | ||
| define([ | ||
| "../core", | ||
| "./var/rsingleTag", | ||
| "../traversing/findFilter" | ||
| ], function( jQuery, rsingleTag ) { | ||
|
|
||
| // A central reference to the root jQuery(document) | ||
| var rootjQuery, | ||
|
|
||
| // A simple way to check for HTML strings | ||
| // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) | ||
| // Strict HTML recognition (#11290: must start with <) | ||
| rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, | ||
|
|
||
| init = jQuery.fn.init = function( selector, context ) { | ||
| var match, elem; | ||
|
|
||
| // HANDLE: $(""), $(null), $(undefined), $(false) | ||
| if ( !selector ) { | ||
| return this; | ||
| } | ||
|
|
||
| // Handle HTML strings | ||
| if ( typeof selector === "string" ) { | ||
| if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) { | ||
| // Assume that strings that start and end with <> are HTML and skip the regex check | ||
| match = [ null, selector, null ]; | ||
|
|
||
| } else { | ||
| match = rquickExpr.exec( selector ); | ||
| } | ||
|
|
||
| // Match html or make sure no context is specified for #id | ||
| if ( match && (match[1] || !context) ) { | ||
|
|
||
| // HANDLE: $(html) -> $(array) | ||
| if ( match[1] ) { | ||
| context = context instanceof jQuery ? context[0] : context; | ||
|
|
||
| // Option to run scripts is true for back-compat | ||
| // Intentionally let the error be thrown if parseHTML is not present | ||
| jQuery.merge( this, jQuery.parseHTML( | ||
| match[1], | ||
| context && context.nodeType ? context.ownerDocument || context : document, | ||
| true | ||
| ) ); | ||
|
|
||
| // HANDLE: $(html, props) | ||
| if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { | ||
| for ( match in context ) { | ||
| // Properties of context are called as methods if possible | ||
| if ( jQuery.isFunction( this[ match ] ) ) { | ||
| this[ match ]( context[ match ] ); | ||
|
|
||
| // ...and otherwise set as attributes | ||
| } else { | ||
| this.attr( match, context[ match ] ); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return this; | ||
|
|
||
| // HANDLE: $(#id) | ||
| } else { | ||
| elem = document.getElementById( match[2] ); | ||
|
|
||
| // Support: Blackberry 4.6 | ||
| // gEBID returns nodes no longer in the document (#6963) | ||
| if ( elem && elem.parentNode ) { | ||
| // Inject the element directly into the jQuery object | ||
| this.length = 1; | ||
| this[0] = elem; | ||
| } | ||
|
|
||
| this.context = document; | ||
| this.selector = selector; | ||
| return this; | ||
| } | ||
|
|
||
| // HANDLE: $(expr, $(...)) | ||
| } else if ( !context || context.jquery ) { | ||
| return ( context || rootjQuery ).find( selector ); | ||
|
|
||
| // HANDLE: $(expr, context) | ||
| // (which is just equivalent to: $(context).find(expr) | ||
| } else { | ||
| return this.constructor( context ).find( selector ); | ||
| } | ||
|
|
||
| // HANDLE: $(DOMElement) | ||
| } else if ( selector.nodeType ) { | ||
| this.context = this[0] = selector; | ||
| this.length = 1; | ||
| return this; | ||
|
|
||
| // HANDLE: $(function) | ||
| // Shortcut for document ready | ||
| } else if ( jQuery.isFunction( selector ) ) { | ||
| return typeof rootjQuery.ready !== "undefined" ? | ||
| rootjQuery.ready( selector ) : | ||
| // Execute immediately if ready is not present | ||
| selector( jQuery ); | ||
| } | ||
|
|
||
| if ( selector.selector !== undefined ) { | ||
| this.selector = selector.selector; | ||
| this.context = selector.context; | ||
| } | ||
|
|
||
| return jQuery.makeArray( selector, this ); | ||
| }; | ||
|
|
||
| // Give the init function the jQuery prototype for later instantiation | ||
| init.prototype = jQuery.fn; | ||
|
|
||
| // Initialize central reference | ||
| rootjQuery = jQuery( document ); | ||
|
|
||
| return init; | ||
|
|
||
| }); |
| @@ -0,0 +1,39 @@ | ||
| define([ | ||
| "../core", | ||
| "./var/rsingleTag", | ||
| "../manipulation" // buildFragment | ||
| ], function( jQuery, rsingleTag ) { | ||
|
|
||
| // data: string of html | ||
| // context (optional): If specified, the fragment will be created in this context, defaults to document | ||
| // keepScripts (optional): If true, will include scripts passed in the html string | ||
| jQuery.parseHTML = function( data, context, keepScripts ) { | ||
| if ( !data || typeof data !== "string" ) { | ||
| return null; | ||
| } | ||
| if ( typeof context === "boolean" ) { | ||
| keepScripts = context; | ||
| context = false; | ||
| } | ||
| context = context || document; | ||
|
|
||
| var parsed = rsingleTag.exec( data ), | ||
| scripts = !keepScripts && []; | ||
|
|
||
| // Single tag | ||
| if ( parsed ) { | ||
| return [ context.createElement( parsed[1] ) ]; | ||
| } | ||
|
|
||
| parsed = jQuery.buildFragment( [ data ], context, scripts ); | ||
|
|
||
| if ( scripts && scripts.length ) { | ||
| jQuery( scripts ).remove(); | ||
| } | ||
|
|
||
| return jQuery.merge( [], parsed.childNodes ); | ||
| }; | ||
|
|
||
| return jQuery.parseHTML; | ||
|
|
||
| }); |
| @@ -0,0 +1,97 @@ | ||
| define([ | ||
| "../core", | ||
| "../core/init", | ||
| "../deferred" | ||
| ], function( jQuery ) { | ||
|
|
||
| // The deferred used on DOM ready | ||
| var readyList; | ||
|
|
||
| jQuery.fn.ready = function( fn ) { | ||
| // Add the callback | ||
| jQuery.ready.promise().done( fn ); | ||
|
|
||
| return this; | ||
| }; | ||
|
|
||
| jQuery.extend({ | ||
| // Is the DOM ready to be used? Set to true once it occurs. | ||
| isReady: false, | ||
|
|
||
| // A counter to track how many items to wait for before | ||
| // the ready event fires. See #6781 | ||
| readyWait: 1, | ||
|
|
||
| // Hold (or release) the ready event | ||
| holdReady: function( hold ) { | ||
| if ( hold ) { | ||
| jQuery.readyWait++; | ||
| } else { | ||
| jQuery.ready( true ); | ||
| } | ||
| }, | ||
|
|
||
| // Handle when the DOM is ready | ||
| ready: function( wait ) { | ||
|
|
||
| // Abort if there are pending holds or we're already ready | ||
| if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { | ||
| return; | ||
| } | ||
|
|
||
| // Remember that the DOM is ready | ||
| jQuery.isReady = true; | ||
|
|
||
| // If a normal DOM Ready event fired, decrement, and wait if need be | ||
| if ( wait !== true && --jQuery.readyWait > 0 ) { | ||
| return; | ||
| } | ||
|
|
||
| // If there are functions bound, to execute | ||
| readyList.resolveWith( document, [ jQuery ] ); | ||
|
|
||
| // Trigger any bound ready events | ||
| if ( jQuery.fn.triggerHandler ) { | ||
| jQuery( document ).triggerHandler( "ready" ); | ||
| jQuery( document ).off( "ready" ); | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| /** | ||
| * The ready event handler and self cleanup method | ||
| */ | ||
| function completed() { | ||
| document.removeEventListener( "DOMContentLoaded", completed, false ); | ||
| window.removeEventListener( "load", completed, false ); | ||
| jQuery.ready(); | ||
| } | ||
|
|
||
| jQuery.ready.promise = function( obj ) { | ||
| if ( !readyList ) { | ||
|
|
||
| readyList = jQuery.Deferred(); | ||
|
|
||
| // Catch cases where $(document).ready() is called after the browser event has already occurred. | ||
| // We once tried to use readyState "interactive" here, but it caused issues like the one | ||
| // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 | ||
| if ( document.readyState === "complete" ) { | ||
| // Handle it asynchronously to allow scripts the opportunity to delay ready | ||
| setTimeout( jQuery.ready ); | ||
|
|
||
| } else { | ||
|
|
||
| // Use the handy event callback | ||
| document.addEventListener( "DOMContentLoaded", completed, false ); | ||
|
|
||
| // A fallback to window.onload, that will always work | ||
| window.addEventListener( "load", completed, false ); | ||
| } | ||
| } | ||
| return readyList.promise( obj ); | ||
| }; | ||
|
|
||
| // Kick off the DOM ready check even if the user does not | ||
| jQuery.ready.promise(); | ||
|
|
||
| }); |
| @@ -0,0 +1,4 @@ | ||
| define(function() { | ||
| // Match a standalone tag | ||
| return (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); | ||
| }); |
| @@ -0,0 +1,22 @@ | ||
| define(function() { | ||
|
|
||
| function addGetHookIf( conditionFn, hookFn ) { | ||
| // Define the hook, we'll check on the first run if it's really needed. | ||
| return { | ||
| get: function() { | ||
| if ( conditionFn() ) { | ||
| // Hook not needed (or it's not possible to use it due | ||
| // to missing dependency), remove it. | ||
| delete this.get; | ||
| return; | ||
| } | ||
|
|
||
| // Hook needed; redefine it so that the support test is not executed again. | ||
| return (this.get = hookFn).apply( this, arguments ); | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| return addGetHookIf; | ||
|
|
||
| }); |
| @@ -0,0 +1,57 @@ | ||
| define([ | ||
| "../core", | ||
| "./var/rnumnonpx", | ||
| "./var/rmargin", | ||
| "./var/getStyles", | ||
| "../selector" // contains | ||
| ], function( jQuery, rnumnonpx, rmargin, getStyles ) { | ||
|
|
||
| function curCSS( elem, name, computed ) { | ||
| var width, minWidth, maxWidth, ret, | ||
| style = elem.style; | ||
|
|
||
| computed = computed || getStyles( elem ); | ||
|
|
||
| // Support: IE9 | ||
| // getPropertyValue is only needed for .css('filter') (#12537) | ||
| if ( computed ) { | ||
| ret = computed.getPropertyValue( name ) || computed[ name ]; | ||
| } | ||
|
|
||
| if ( computed ) { | ||
|
|
||
| if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { | ||
| ret = jQuery.style( elem, name ); | ||
| } | ||
|
|
||
| // Support: iOS < 6 | ||
| // A tribute to the "awesome hack by Dean Edwards" | ||
| // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels | ||
| // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values | ||
| if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { | ||
|
|
||
| // Remember the original values | ||
| width = style.width; | ||
| minWidth = style.minWidth; | ||
| maxWidth = style.maxWidth; | ||
|
|
||
| // Put in the new values to get a computed value out | ||
| style.minWidth = style.maxWidth = style.width = ret; | ||
| ret = computed.width; | ||
|
|
||
| // Revert the changed values | ||
| style.width = width; | ||
| style.minWidth = minWidth; | ||
| style.maxWidth = maxWidth; | ||
| } | ||
| } | ||
|
|
||
| return ret !== undefined ? | ||
| // Support: IE | ||
| // IE returns zIndex value as an integer. | ||
| ret + "" : | ||
| ret; | ||
| } | ||
|
|
||
| return curCSS; | ||
| }); |
| @@ -0,0 +1,70 @@ | ||
| define([ | ||
| "../core", | ||
| "../manipulation" // appendTo | ||
| ], function( jQuery ) { | ||
|
|
||
| var iframe, | ||
| elemdisplay = {}; | ||
|
|
||
| /** | ||
| * Retrieve the actual display of a element | ||
| * @param {String} name nodeName of the element | ||
| * @param {Object} doc Document object | ||
| */ | ||
| // Called only from within defaultDisplay | ||
| function actualDisplay( name, doc ) { | ||
| var style, | ||
| elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), | ||
|
|
||
| // getDefaultComputedStyle might be reliably used only on attached element | ||
| display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? | ||
|
|
||
| // Use of this method is a temporary fix (more like optimization) until something better comes along, | ||
| // since it was removed from specification and supported only in FF | ||
| style.display : jQuery.css( elem[ 0 ], "display" ); | ||
|
|
||
| // We don't have any data stored on the element, | ||
| // so use "detach" method as fast way to get rid of the element | ||
| elem.detach(); | ||
|
|
||
| return display; | ||
| } | ||
|
|
||
| /** | ||
| * Try to determine the default display value of an element | ||
| * @param {String} nodeName | ||
| */ | ||
| function defaultDisplay( nodeName ) { | ||
| var doc = document, | ||
| display = elemdisplay[ nodeName ]; | ||
|
|
||
| if ( !display ) { | ||
| display = actualDisplay( nodeName, doc ); | ||
|
|
||
| // If the simple way fails, read from inside an iframe | ||
| if ( display === "none" || !display ) { | ||
|
|
||
| // Use the already-created iframe if possible | ||
| iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement ); | ||
|
|
||
| // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse | ||
| doc = iframe[ 0 ].contentDocument; | ||
|
|
||
| // Support: IE | ||
| doc.write(); | ||
| doc.close(); | ||
|
|
||
| display = actualDisplay( nodeName, doc ); | ||
| iframe.detach(); | ||
| } | ||
|
|
||
| // Store the correct default display | ||
| elemdisplay[ nodeName ] = display; | ||
| } | ||
|
|
||
| return display; | ||
| } | ||
|
|
||
| return defaultDisplay; | ||
|
|
||
| }); |
| @@ -0,0 +1,15 @@ | ||
| define([ | ||
| "../core", | ||
| "../selector" | ||
| ], function( jQuery ) { | ||
|
|
||
| jQuery.expr.filters.hidden = function( elem ) { | ||
| // Support: Opera <= 12.12 | ||
| // Opera reports offsetWidths and offsetHeights less than zero on some elements | ||
| return elem.offsetWidth <= 0 && elem.offsetHeight <= 0; | ||
| }; | ||
| jQuery.expr.filters.visible = function( elem ) { | ||
| return !jQuery.expr.filters.hidden( elem ); | ||
| }; | ||
|
|
||
| }); |
| @@ -0,0 +1,96 @@ | ||
| define([ | ||
| "../core", | ||
| "../var/support" | ||
| ], function( jQuery, support ) { | ||
|
|
||
| (function() { | ||
| var pixelPositionVal, boxSizingReliableVal, | ||
| docElem = document.documentElement, | ||
| container = document.createElement( "div" ), | ||
| div = document.createElement( "div" ); | ||
|
|
||
| if ( !div.style ) { | ||
| return; | ||
| } | ||
|
|
||
| // Support: IE9-11+ | ||
| // Style of cloned element affects source element cloned (#8908) | ||
| div.style.backgroundClip = "content-box"; | ||
| div.cloneNode( true ).style.backgroundClip = ""; | ||
| support.clearCloneStyle = div.style.backgroundClip === "content-box"; | ||
|
|
||
| container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" + | ||
| "position:absolute"; | ||
| container.appendChild( div ); | ||
|
|
||
| // Executing both pixelPosition & boxSizingReliable tests require only one layout | ||
| // so they're executed at the same time to save the second computation. | ||
| function computePixelPositionAndBoxSizingReliable() { | ||
| div.style.cssText = | ||
| // Support: Firefox<29, Android 2.3 | ||
| // Vendor-prefix box-sizing | ||
| "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" + | ||
| "box-sizing:border-box;display:block;margin-top:1%;top:1%;" + | ||
| "border:1px;padding:1px;width:4px;position:absolute"; | ||
| div.innerHTML = ""; | ||
| docElem.appendChild( container ); | ||
|
|
||
| var divStyle = window.getComputedStyle( div, null ); | ||
| pixelPositionVal = divStyle.top !== "1%"; | ||
| boxSizingReliableVal = divStyle.width === "4px"; | ||
|
|
||
| docElem.removeChild( container ); | ||
| } | ||
|
|
||
| // Support: node.js jsdom | ||
| // Don't assume that getComputedStyle is a property of the global object | ||
| if ( window.getComputedStyle ) { | ||
| jQuery.extend( support, { | ||
| pixelPosition: function() { | ||
|
|
||
| // This test is executed only once but we still do memoizing | ||
| // since we can use the boxSizingReliable pre-computing. | ||
| // No need to check if the test was already performed, though. | ||
| computePixelPositionAndBoxSizingReliable(); | ||
| return pixelPositionVal; | ||
| }, | ||
| boxSizingReliable: function() { | ||
| if ( boxSizingReliableVal == null ) { | ||
| computePixelPositionAndBoxSizingReliable(); | ||
| } | ||
| return boxSizingReliableVal; | ||
| }, | ||
| reliableMarginRight: function() { | ||
|
|
||
| // Support: Android 2.3 | ||
| // Check if div with explicit width and no margin-right incorrectly | ||
| // gets computed margin-right based on width of container. (#3333) | ||
| // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right | ||
| // This support function is only executed once so no memoizing is needed. | ||
| var ret, | ||
| marginDiv = div.appendChild( document.createElement( "div" ) ); | ||
|
|
||
| // Reset CSS: box-sizing; display; margin; border; padding | ||
| marginDiv.style.cssText = div.style.cssText = | ||
| // Support: Firefox<29, Android 2.3 | ||
| // Vendor-prefix box-sizing | ||
| "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + | ||
| "box-sizing:content-box;display:block;margin:0;border:0;padding:0"; | ||
| marginDiv.style.marginRight = marginDiv.style.width = "0"; | ||
| div.style.width = "1px"; | ||
| docElem.appendChild( container ); | ||
|
|
||
| ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight ); | ||
|
|
||
| docElem.removeChild( container ); | ||
| div.removeChild( marginDiv ); | ||
|
|
||
| return ret; | ||
| } | ||
| }); | ||
| } | ||
| })(); | ||
|
|
||
| return support; | ||
|
|
||
| }); |
| @@ -0,0 +1,28 @@ | ||
| define([ | ||
| "../core" | ||
| ], function( jQuery ) { | ||
|
|
||
| // A method for quickly swapping in/out CSS properties to get correct calculations. | ||
| jQuery.swap = function( elem, options, callback, args ) { | ||
| var ret, name, | ||
| old = {}; | ||
|
|
||
| // Remember the old values, and insert the new ones | ||
| for ( name in options ) { | ||
| old[ name ] = elem.style[ name ]; | ||
| elem.style[ name ] = options[ name ]; | ||
| } | ||
|
|
||
| ret = callback.apply( elem, args || [] ); | ||
|
|
||
| // Revert the old values | ||
| for ( name in options ) { | ||
| elem.style[ name ] = old[ name ]; | ||
| } | ||
|
|
||
| return ret; | ||
| }; | ||
|
|
||
| return jQuery.swap; | ||
|
|
||
| }); |
| @@ -0,0 +1,3 @@ | ||
| define(function() { | ||
| return [ "Top", "Right", "Bottom", "Left" ]; | ||
| }); |
| @@ -0,0 +1,12 @@ | ||
| define(function() { | ||
| return function( elem ) { | ||
| // Support: IE<=11+, Firefox<=30+ (#15098, #14150) | ||
| // IE throws on elements created in popups | ||
| // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" | ||
| if ( elem.ownerDocument.defaultView.opener ) { | ||
| return elem.ownerDocument.defaultView.getComputedStyle( elem, null ); | ||
| } | ||
|
|
||
| return window.getComputedStyle( elem, null ); | ||
| }; | ||
| }); |
| @@ -0,0 +1,13 @@ | ||
| define([ | ||
| "../../core", | ||
| "../../selector" | ||
| // css is assumed | ||
| ], function( jQuery ) { | ||
|
|
||
| return function( elem, el ) { | ||
| // isHidden might be called from jQuery#filter function; | ||
| // in that case, element will be second argument | ||
| elem = el || elem; | ||
| return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); | ||
| }; | ||
| }); |
| @@ -0,0 +1,3 @@ | ||
| define(function() { | ||
| return (/^margin/); | ||
| }); |
| @@ -0,0 +1,5 @@ | ||
| define([ | ||
| "../../var/pnum" | ||
| ], function( pnum ) { | ||
| return new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); | ||
| }); |
| @@ -0,0 +1,178 @@ | ||
| define([ | ||
| "./core", | ||
| "./var/rnotwhite", | ||
| "./core/access", | ||
| "./data/var/data_priv", | ||
| "./data/var/data_user" | ||
| ], function( jQuery, rnotwhite, access, data_priv, data_user ) { | ||
|
|
||
| // Implementation Summary | ||
| // | ||
| // 1. Enforce API surface and semantic compatibility with 1.9.x branch | ||
| // 2. Improve the module's maintainability by reducing the storage | ||
| // paths to a single mechanism. | ||
| // 3. Use the same single mechanism to support "private" and "user" data. | ||
| // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) | ||
| // 5. Avoid exposing implementation details on user objects (eg. expando properties) | ||
| // 6. Provide a clear path for implementation upgrade to WeakMap in 2014 | ||
|
|
||
| var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, | ||
| rmultiDash = /([A-Z])/g; | ||
|
|
||
| function dataAttr( elem, key, data ) { | ||
| var name; | ||
|
|
||
| // If nothing was found internally, try to fetch any | ||
| // data from the HTML5 data-* attribute | ||
| if ( data === undefined && elem.nodeType === 1 ) { | ||
| name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); | ||
| data = elem.getAttribute( name ); | ||
|
|
||
| if ( typeof data === "string" ) { | ||
| try { | ||
| data = data === "true" ? true : | ||
| data === "false" ? false : | ||
| data === "null" ? null : | ||
| // Only convert to a number if it doesn't change the string | ||
| +data + "" === data ? +data : | ||
| rbrace.test( data ) ? jQuery.parseJSON( data ) : | ||
| data; | ||
| } catch( e ) {} | ||
|
|
||
| // Make sure we set the data so it isn't changed later | ||
| data_user.set( elem, key, data ); | ||
| } else { | ||
| data = undefined; | ||
| } | ||
| } | ||
| return data; | ||
| } | ||
|
|
||
| jQuery.extend({ | ||
| hasData: function( elem ) { | ||
| return data_user.hasData( elem ) || data_priv.hasData( elem ); | ||
| }, | ||
|
|
||
| data: function( elem, name, data ) { | ||
| return data_user.access( elem, name, data ); | ||
| }, | ||
|
|
||
| removeData: function( elem, name ) { | ||
| data_user.remove( elem, name ); | ||
| }, | ||
|
|
||
| // TODO: Now that all calls to _data and _removeData have been replaced | ||
| // with direct calls to data_priv methods, these can be deprecated. | ||
| _data: function( elem, name, data ) { | ||
| return data_priv.access( elem, name, data ); | ||
| }, | ||
|
|
||
| _removeData: function( elem, name ) { | ||
| data_priv.remove( elem, name ); | ||
| } | ||
| }); | ||
|
|
||
| jQuery.fn.extend({ | ||
| data: function( key, value ) { | ||
| var i, name, data, | ||
| elem = this[ 0 ], | ||
| attrs = elem && elem.attributes; | ||
|
|
||
| // Gets all values | ||
| if ( key === undefined ) { | ||
| if ( this.length ) { | ||
| data = data_user.get( elem ); | ||
|
|
||
| if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) { | ||
| i = attrs.length; | ||
| while ( i-- ) { | ||
|
|
||
| // Support: IE11+ | ||
| // The attrs elements can be null (#14894) | ||
| if ( attrs[ i ] ) { | ||
| name = attrs[ i ].name; | ||
| if ( name.indexOf( "data-" ) === 0 ) { | ||
| name = jQuery.camelCase( name.slice(5) ); | ||
| dataAttr( elem, name, data[ name ] ); | ||
| } | ||
| } | ||
| } | ||
| data_priv.set( elem, "hasDataAttrs", true ); | ||
| } | ||
| } | ||
|
|
||
| return data; | ||
| } | ||
|
|
||
| // Sets multiple values | ||
| if ( typeof key === "object" ) { | ||
| return this.each(function() { | ||
| data_user.set( this, key ); | ||
| }); | ||
| } | ||
|
|
||
| return access( this, function( value ) { | ||
| var data, | ||
| camelKey = jQuery.camelCase( key ); | ||
|
|
||
| // The calling jQuery object (element matches) is not empty | ||
| // (and therefore has an element appears at this[ 0 ]) and the | ||
| // `value` parameter was not undefined. An empty jQuery object | ||
| // will result in `undefined` for elem = this[ 0 ] which will | ||
| // throw an exception if an attempt to read a data cache is made. | ||
| if ( elem && value === undefined ) { | ||
| // Attempt to get data from the cache | ||
| // with the key as-is | ||
| data = data_user.get( elem, key ); | ||
| if ( data !== undefined ) { | ||
| return data; | ||
| } | ||
|
|
||
| // Attempt to get data from the cache | ||
| // with the key camelized | ||
| data = data_user.get( elem, camelKey ); | ||
| if ( data !== undefined ) { | ||
| return data; | ||
| } | ||
|
|
||
| // Attempt to "discover" the data in | ||
| // HTML5 custom data-* attrs | ||
| data = dataAttr( elem, camelKey, undefined ); | ||
| if ( data !== undefined ) { | ||
| return data; | ||
| } | ||
|
|
||
| // We tried really hard, but the data doesn't exist. | ||
| return; | ||
| } | ||
|
|
||
| // Set the data... | ||
| this.each(function() { | ||
| // First, attempt to store a copy or reference of any | ||
| // data that might've been store with a camelCased key. | ||
| var data = data_user.get( this, camelKey ); | ||
|
|
||
| // For HTML5 data-* attribute interop, we have to | ||
| // store property names with dashes in a camelCase form. | ||
| // This might not apply to all properties...* | ||
| data_user.set( this, camelKey, value ); | ||
|
|
||
| // *... In the case of properties that might _actually_ | ||
| // have dashes, we need to also store a copy of that | ||
| // unchanged property. | ||
| if ( key.indexOf("-") !== -1 && data !== undefined ) { | ||
| data_user.set( this, key, value ); | ||
| } | ||
| }); | ||
| }, null, value, arguments.length > 1, null, true ); | ||
| }, | ||
|
|
||
| removeData: function( key ) { | ||
| return this.each(function() { | ||
| data_user.remove( this, key ); | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| return jQuery; | ||
| }); |
| @@ -0,0 +1,181 @@ | ||
| define([ | ||
| "../core", | ||
| "../var/rnotwhite", | ||
| "./accepts" | ||
| ], function( jQuery, rnotwhite ) { | ||
|
|
||
| function Data() { | ||
| // Support: Android<4, | ||
| // Old WebKit does not have Object.preventExtensions/freeze method, | ||
| // return new empty object instead with no [[set]] accessor | ||
| Object.defineProperty( this.cache = {}, 0, { | ||
| get: function() { | ||
| return {}; | ||
| } | ||
| }); | ||
|
|
||
| this.expando = jQuery.expando + Data.uid++; | ||
| } | ||
|
|
||
| Data.uid = 1; | ||
| Data.accepts = jQuery.acceptData; | ||
|
|
||
| Data.prototype = { | ||
| key: function( owner ) { | ||
| // We can accept data for non-element nodes in modern browsers, | ||
| // but we should not, see #8335. | ||
| // Always return the key for a frozen object. | ||
| if ( !Data.accepts( owner ) ) { | ||
| return 0; | ||
| } | ||
|
|
||
| var descriptor = {}, | ||
| // Check if the owner object already has a cache key | ||
| unlock = owner[ this.expando ]; | ||
|
|
||
| // If not, create one | ||
| if ( !unlock ) { | ||
| unlock = Data.uid++; | ||
|
|
||
| // Secure it in a non-enumerable, non-writable property | ||
| try { | ||
| descriptor[ this.expando ] = { value: unlock }; | ||
| Object.defineProperties( owner, descriptor ); | ||
|
|
||
| // Support: Android<4 | ||
| // Fallback to a less secure definition | ||
| } catch ( e ) { | ||
| descriptor[ this.expando ] = unlock; | ||
| jQuery.extend( owner, descriptor ); | ||
| } | ||
| } | ||
|
|
||
| // Ensure the cache object | ||
| if ( !this.cache[ unlock ] ) { | ||
| this.cache[ unlock ] = {}; | ||
| } | ||
|
|
||
| return unlock; | ||
| }, | ||
| set: function( owner, data, value ) { | ||
| var prop, | ||
| // There may be an unlock assigned to this node, | ||
| // if there is no entry for this "owner", create one inline | ||
| // and set the unlock as though an owner entry had always existed | ||
| unlock = this.key( owner ), | ||
| cache = this.cache[ unlock ]; | ||
|
|
||
| // Handle: [ owner, key, value ] args | ||
| if ( typeof data === "string" ) { | ||
| cache[ data ] = value; | ||
|
|
||
| // Handle: [ owner, { properties } ] args | ||
| } else { | ||
| // Fresh assignments by object are shallow copied | ||
| if ( jQuery.isEmptyObject( cache ) ) { | ||
| jQuery.extend( this.cache[ unlock ], data ); | ||
| // Otherwise, copy the properties one-by-one to the cache object | ||
| } else { | ||
| for ( prop in data ) { | ||
| cache[ prop ] = data[ prop ]; | ||
| } | ||
| } | ||
| } | ||
| return cache; | ||
| }, | ||
| get: function( owner, key ) { | ||
| // Either a valid cache is found, or will be created. | ||
| // New caches will be created and the unlock returned, | ||
| // allowing direct access to the newly created | ||
| // empty data object. A valid owner object must be provided. | ||
| var cache = this.cache[ this.key( owner ) ]; | ||
|
|
||
| return key === undefined ? | ||
| cache : cache[ key ]; | ||
| }, | ||
| access: function( owner, key, value ) { | ||
| var stored; | ||
| // In cases where either: | ||
| // | ||
| // 1. No key was specified | ||
| // 2. A string key was specified, but no value provided | ||
| // | ||
| // Take the "read" path and allow the get method to determine | ||
| // which value to return, respectively either: | ||
| // | ||
| // 1. The entire cache object | ||
| // 2. The data stored at the key | ||
| // | ||
| if ( key === undefined || | ||
| ((key && typeof key === "string") && value === undefined) ) { | ||
|
|
||
| stored = this.get( owner, key ); | ||
|
|
||
| return stored !== undefined ? | ||
| stored : this.get( owner, jQuery.camelCase(key) ); | ||
| } | ||
|
|
||
| // [*]When the key is not a string, or both a key and value | ||
| // are specified, set or extend (existing objects) with either: | ||
| // | ||
| // 1. An object of properties | ||
| // 2. A key and value | ||
| // | ||
| this.set( owner, key, value ); | ||
|
|
||
| // Since the "set" path can have two possible entry points | ||
| // return the expected data based on which path was taken[*] | ||
| return value !== undefined ? value : key; | ||
| }, | ||
| remove: function( owner, key ) { | ||
| var i, name, camel, | ||
| unlock = this.key( owner ), | ||
| cache = this.cache[ unlock ]; | ||
|
|
||
| if ( key === undefined ) { | ||
| this.cache[ unlock ] = {}; | ||
|
|
||
| } else { | ||
| // Support array or space separated string of keys | ||
| if ( jQuery.isArray( key ) ) { | ||
| // If "name" is an array of keys... | ||
| // When data is initially created, via ("key", "val") signature, | ||
| // keys will be converted to camelCase. | ||
| // Since there is no way to tell _how_ a key was added, remove | ||
| // both plain key and camelCase key. #12786 | ||
| // This will only penalize the array argument path. | ||
| name = key.concat( key.map( jQuery.camelCase ) ); | ||
| } else { | ||
| camel = jQuery.camelCase( key ); | ||
| // Try the string as a key before any manipulation | ||
| if ( key in cache ) { | ||
| name = [ key, camel ]; | ||
| } else { | ||
| // If a key with the spaces exists, use it. | ||
| // Otherwise, create an array by matching non-whitespace | ||
| name = camel; | ||
| name = name in cache ? | ||
| [ name ] : ( name.match( rnotwhite ) || [] ); | ||
| } | ||
| } | ||
|
|
||
| i = name.length; | ||
| while ( i-- ) { | ||
| delete cache[ name[ i ] ]; | ||
| } | ||
| } | ||
| }, | ||
| hasData: function( owner ) { | ||
| return !jQuery.isEmptyObject( | ||
| this.cache[ owner[ this.expando ] ] || {} | ||
| ); | ||
| }, | ||
| discard: function( owner ) { | ||
| if ( owner[ this.expando ] ) { | ||
| delete this.cache[ owner[ this.expando ] ]; | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| return Data; | ||
| }); |
| @@ -0,0 +1,20 @@ | ||
| define([ | ||
| "../core" | ||
| ], function( jQuery ) { | ||
|
|
||
| /** | ||
| * Determines whether an object can have data | ||
| */ | ||
| jQuery.acceptData = function( owner ) { | ||
| // Accepts only: | ||
| // - Node | ||
| // - Node.ELEMENT_NODE | ||
| // - Node.DOCUMENT_NODE | ||
| // - Object | ||
| // - Any | ||
| /* jshint -W018 */ | ||
| return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); | ||
| }; | ||
|
|
||
| return jQuery.acceptData; | ||
| }); |
| @@ -0,0 +1,5 @@ | ||
| define([ | ||
| "../Data" | ||
| ], function( Data ) { | ||
| return new Data(); | ||
| }); |
| @@ -0,0 +1,5 @@ | ||
| define([ | ||
| "../Data" | ||
| ], function( Data ) { | ||
| return new Data(); | ||
| }); |
| @@ -0,0 +1,149 @@ | ||
| define([ | ||
| "./core", | ||
| "./var/slice", | ||
| "./callbacks" | ||
| ], function( jQuery, slice ) { | ||
|
|
||
| jQuery.extend({ | ||
|
|
||
| Deferred: function( func ) { | ||
| var tuples = [ | ||
| // action, add listener, listener list, final state | ||
| [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], | ||
| [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], | ||
| [ "notify", "progress", jQuery.Callbacks("memory") ] | ||
| ], | ||
| state = "pending", | ||
| promise = { | ||
| state: function() { | ||
| return state; | ||
| }, | ||
| always: function() { | ||
| deferred.done( arguments ).fail( arguments ); | ||
| return this; | ||
| }, | ||
| then: function( /* fnDone, fnFail, fnProgress */ ) { | ||
| var fns = arguments; | ||
| return jQuery.Deferred(function( newDefer ) { | ||
| jQuery.each( tuples, function( i, tuple ) { | ||
| var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; | ||
| // deferred[ done | fail | progress ] for forwarding actions to newDefer | ||
| deferred[ tuple[1] ](function() { | ||
| var returned = fn && fn.apply( this, arguments ); | ||
| if ( returned && jQuery.isFunction( returned.promise ) ) { | ||
| returned.promise() | ||
| .done( newDefer.resolve ) | ||
| .fail( newDefer.reject ) | ||
| .progress( newDefer.notify ); | ||
| } else { | ||
| newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); | ||
| } | ||
| }); | ||
| }); | ||
| fns = null; | ||
| }).promise(); | ||
| }, | ||
| // Get a promise for this deferred | ||
| // If obj is provided, the promise aspect is added to the object | ||
| promise: function( obj ) { | ||
| return obj != null ? jQuery.extend( obj, promise ) : promise; | ||
| } | ||
| }, | ||
| deferred = {}; | ||
|
|
||
| // Keep pipe for back-compat | ||
| promise.pipe = promise.then; | ||
|
|
||
| // Add list-specific methods | ||
| jQuery.each( tuples, function( i, tuple ) { | ||
| var list = tuple[ 2 ], | ||
| stateString = tuple[ 3 ]; | ||
|
|
||
| // promise[ done | fail | progress ] = list.add | ||
| promise[ tuple[1] ] = list.add; | ||
|
|
||
| // Handle state | ||
| if ( stateString ) { | ||
| list.add(function() { | ||
| // state = [ resolved | rejected ] | ||
| state = stateString; | ||
|
|
||
| // [ reject_list | resolve_list ].disable; progress_list.lock | ||
| }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); | ||
| } | ||
|
|
||
| // deferred[ resolve | reject | notify ] | ||
| deferred[ tuple[0] ] = function() { | ||
| deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); | ||
| return this; | ||
| }; | ||
| deferred[ tuple[0] + "With" ] = list.fireWith; | ||
| }); | ||
|
|
||
| // Make the deferred a promise | ||
| promise.promise( deferred ); | ||
|
|
||
| // Call given func if any | ||
| if ( func ) { | ||
| func.call( deferred, deferred ); | ||
| } | ||
|
|
||
| // All done! | ||
| return deferred; | ||
| }, | ||
|
|
||
| // Deferred helper | ||
| when: function( subordinate /* , ..., subordinateN */ ) { | ||
| var i = 0, | ||
| resolveValues = slice.call( arguments ), | ||
| length = resolveValues.length, | ||
|
|
||
| // the count of uncompleted subordinates | ||
| remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, | ||
|
|
||
| // the master Deferred. If resolveValues consist of only a single Deferred, just use that. | ||
| deferred = remaining === 1 ? subordinate : jQuery.Deferred(), | ||
|
|
||
| // Update function for both resolve and progress values | ||
| updateFunc = function( i, contexts, values ) { | ||
| return function( value ) { | ||
| contexts[ i ] = this; | ||
| values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; | ||
| if ( values === progressValues ) { | ||
| deferred.notifyWith( contexts, values ); | ||
| } else if ( !( --remaining ) ) { | ||
| deferred.resolveWith( contexts, values ); | ||
| } | ||
| }; | ||
| }, | ||
|
|
||
| progressValues, progressContexts, resolveContexts; | ||
|
|
||
| // Add listeners to Deferred subordinates; treat others as resolved | ||
| if ( length > 1 ) { | ||
| progressValues = new Array( length ); | ||
| progressContexts = new Array( length ); | ||
| resolveContexts = new Array( length ); | ||
| for ( ; i < length; i++ ) { | ||
| if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { | ||
| resolveValues[ i ].promise() | ||
| .done( updateFunc( i, resolveContexts, resolveValues ) ) | ||
| .fail( deferred.reject ) | ||
| .progress( updateFunc( i, progressContexts, progressValues ) ); | ||
| } else { | ||
| --remaining; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // If we're not waiting on anything, resolve the master | ||
| if ( !remaining ) { | ||
| deferred.resolveWith( resolveContexts, resolveValues ); | ||
| } | ||
|
|
||
| return deferred.promise(); | ||
| } | ||
| }); | ||
|
|
||
| return jQuery; | ||
| }); |
| @@ -0,0 +1,13 @@ | ||
| define([ | ||
| "./core", | ||
| "./traversing" | ||
| ], function( jQuery ) { | ||
|
|
||
| // The number of elements contained in the matched element set | ||
| jQuery.fn.size = function() { | ||
| return this.length; | ||
| }; | ||
|
|
||
| jQuery.fn.andSelf = jQuery.fn.addBack; | ||
|
|
||
| }); |
| @@ -0,0 +1,50 @@ | ||
| define([ | ||
| "./core", | ||
| "./core/access", | ||
| "./css" | ||
| ], function( jQuery, access ) { | ||
|
|
||
| // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods | ||
| jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { | ||
| jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { | ||
| // Margin is only for outerHeight, outerWidth | ||
| jQuery.fn[ funcName ] = function( margin, value ) { | ||
| var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), | ||
| extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); | ||
|
|
||
| return access( this, function( elem, type, value ) { | ||
| var doc; | ||
|
|
||
| if ( jQuery.isWindow( elem ) ) { | ||
| // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there | ||
| // isn't a whole lot we can do. See pull request at this URL for discussion: | ||
| // https://github.com/jquery/jquery/pull/764 | ||
| return elem.document.documentElement[ "client" + name ]; | ||
| } | ||
|
|
||
| // Get document width or height | ||
| if ( elem.nodeType === 9 ) { | ||
| doc = elem.documentElement; | ||
|
|
||
| // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], | ||
| // whichever is greatest | ||
| return Math.max( | ||
| elem.body[ "scroll" + name ], doc[ "scroll" + name ], | ||
| elem.body[ "offset" + name ], doc[ "offset" + name ], | ||
| doc[ "client" + name ] | ||
| ); | ||
| } | ||
|
|
||
| return value === undefined ? | ||
| // Get width or height on the element, requesting but not forcing parseFloat | ||
| jQuery.css( elem, type, extra ) : | ||
|
|
||
| // Set width or height on the element | ||
| jQuery.style( elem, type, value, extra ); | ||
| }, type, chainable ? margin : undefined, chainable, null ); | ||
| }; | ||
| }); | ||
| }); | ||
|
|
||
| return jQuery; | ||
| }); |