diff options
Diffstat (limited to 'bower_components/jquery/src/ajax')
| -rw-r--r-- | bower_components/jquery/src/ajax/jsonp.js | 100 | ||||
| -rw-r--r-- | bower_components/jquery/src/ajax/load.js | 83 | ||||
| -rw-r--r-- | bower_components/jquery/src/ajax/parseJSON.js | 53 | ||||
| -rw-r--r-- | bower_components/jquery/src/ajax/parseXML.js | 31 | ||||
| -rw-r--r-- | bower_components/jquery/src/ajax/script.js | 95 | ||||
| -rw-r--r-- | bower_components/jquery/src/ajax/var/location.js | 3 | ||||
| -rw-r--r-- | bower_components/jquery/src/ajax/var/nonce.js | 5 | ||||
| -rw-r--r-- | bower_components/jquery/src/ajax/var/rquery.js | 3 | ||||
| -rw-r--r-- | bower_components/jquery/src/ajax/xhr.js | 229 |
9 files changed, 0 insertions, 602 deletions
diff --git a/bower_components/jquery/src/ajax/jsonp.js b/bower_components/jquery/src/ajax/jsonp.js deleted file mode 100644 index 89ce44d..0000000 --- a/bower_components/jquery/src/ajax/jsonp.js +++ /dev/null @@ -1,100 +0,0 @@ -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" ) === 0 && - 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() { - - // If previous value didn't exist - remove it - if ( overwritten === undefined ) { - jQuery( window ).removeProp( callbackName ); - - // Otherwise restore preexisting value - } else { - 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"; - } -} ); - -} ); diff --git a/bower_components/jquery/src/ajax/load.js b/bower_components/jquery/src/ajax/load.js deleted file mode 100644 index 2ae4b39..0000000 --- a/bower_components/jquery/src/ajax/load.js +++ /dev/null @@ -1,83 +0,0 @@ -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 > -1 ) { - selector = jQuery.trim( url.slice( off, url.length ) ); - 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. - // Make value of this field explicit since - // user can override it through ajaxSetup method - type: type || "GET", - 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 ); - - // If the request succeeds, this function gets "data", "status", "jqXHR" - // but they are ignored because response was set above. - // If it fails, this function gets "jqXHR", "status", "error" - } ).always( callback && function( jqXHR, status ) { - self.each( function() { - callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); - } ); - } ); - } - - return this; -}; - -} ); diff --git a/bower_components/jquery/src/ajax/parseJSON.js b/bower_components/jquery/src/ajax/parseJSON.js deleted file mode 100644 index 34efb79..0000000 --- a/bower_components/jquery/src/ajax/parseJSON.js +++ /dev/null @@ -1,53 +0,0 @@ -define( [ - "../core" -], function( jQuery ) { - -var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g; - -jQuery.parseJSON = function( data ) { - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - - // Support: Android 2.3 - // Workaround failure to string-cast null input - return window.JSON.parse( data + "" ); - } - - var requireNonComma, - depth = null, - str = jQuery.trim( data + "" ); - - // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains - // after removing valid tokens - return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) { - - // Force termination if we see a misplaced comma - if ( requireNonComma && comma ) { - depth = 0; - } - - // Perform no more replacements after returning to outermost depth - if ( depth === 0 ) { - return token; - } - - // Commas must not follow "[", "{", or "," - requireNonComma = open || comma; - - // Determine new depth - // array/object open ("[" or "{"): depth += true - false (increment) - // array/object close ("]" or "}"): depth += false - true (decrement) - // other cases ("," or primitive): depth += true - true (numeric cast) - depth += !close - !open; - - // Remove this token - return ""; - } ) ) ? - ( Function( "return " + str ) )() : - jQuery.error( "Invalid JSON: " + data ); -}; - -return jQuery.parseJSON; - -} ); diff --git a/bower_components/jquery/src/ajax/parseXML.js b/bower_components/jquery/src/ajax/parseXML.js deleted file mode 100644 index a05e800..0000000 --- a/bower_components/jquery/src/ajax/parseXML.js +++ /dev/null @@ -1,31 +0,0 @@ -define( [ - "../core" -], function( jQuery ) { - -// Cross-browser xml parsing -jQuery.parseXML = function( data ) { - var xml, tmp; - if ( !data || typeof data !== "string" ) { - return null; - } - try { - if ( window.DOMParser ) { // Standard - tmp = new window.DOMParser(); - xml = tmp.parseFromString( data, "text/xml" ); - } else { // IE - xml = new window.ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch ( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; -}; - -return jQuery.parseXML; - -} ); diff --git a/bower_components/jquery/src/ajax/script.js b/bower_components/jquery/src/ajax/script.js deleted file mode 100644 index 1aa4dbf..0000000 --- a/bower_components/jquery/src/ajax/script.js +++ /dev/null @@ -1,95 +0,0 @@ -define( [ - "../core", - "../var/document", - "../ajax" -], function( jQuery, document ) { - -// Install script dataType -jQuery.ajaxSetup( { - accepts: { - script: "text/javascript, application/javascript, " + - "application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /\b(?:java|ecma)script\b/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -} ); - -// Handle cache's special case and global -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - s.global = false; - } -} ); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function( s ) { - - // This transport only deals with cross domain requests - if ( s.crossDomain ) { - - var script, - head = document.head || jQuery( "head" )[ 0 ] || document.documentElement; - - return { - - send: function( _, callback ) { - - script = document.createElement( "script" ); - - script.async = true; - - if ( s.scriptCharset ) { - script.charset = s.scriptCharset; - } - - script.src = s.url; - - // Attach handlers for all browsers - script.onload = script.onreadystatechange = function( _, isAbort ) { - - if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { - - // Handle memory leak in IE - script.onload = script.onreadystatechange = null; - - // Remove the script - if ( script.parentNode ) { - script.parentNode.removeChild( script ); - } - - // Dereference the script - script = null; - - // Callback if not abort - if ( !isAbort ) { - callback( 200, "success" ); - } - } - }; - - // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending - // Use native DOM manipulation to avoid our domManip AJAX trickery - head.insertBefore( script, head.firstChild ); - }, - - abort: function() { - if ( script ) { - script.onload( undefined, true ); - } - } - }; - } -} ); - -} ); diff --git a/bower_components/jquery/src/ajax/var/location.js b/bower_components/jquery/src/ajax/var/location.js deleted file mode 100644 index ff9578e..0000000 --- a/bower_components/jquery/src/ajax/var/location.js +++ /dev/null @@ -1,3 +0,0 @@ -define( function() { - return window.location; -} ); diff --git a/bower_components/jquery/src/ajax/var/nonce.js b/bower_components/jquery/src/ajax/var/nonce.js deleted file mode 100644 index 83fd557..0000000 --- a/bower_components/jquery/src/ajax/var/nonce.js +++ /dev/null @@ -1,5 +0,0 @@ -define( [ - "../../core" -], function( jQuery ) { - return jQuery.now(); -} ); diff --git a/bower_components/jquery/src/ajax/var/rquery.js b/bower_components/jquery/src/ajax/var/rquery.js deleted file mode 100644 index 0502146..0000000 --- a/bower_components/jquery/src/ajax/var/rquery.js +++ /dev/null @@ -1,3 +0,0 @@ -define( function() { - return ( /\?/ ); -} ); diff --git a/bower_components/jquery/src/ajax/xhr.js b/bower_components/jquery/src/ajax/xhr.js deleted file mode 100644 index 7e41409..0000000 --- a/bower_components/jquery/src/ajax/xhr.js +++ /dev/null @@ -1,229 +0,0 @@ -define( [ - "../core", - "../var/document", - "../var/support", - "../ajax" -], function( jQuery, document, support ) { - -// Create the request object -// (This is still attached to ajaxSettings for backward compatibility) -jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? - - // Support: IE6-IE8 - function() { - - // XHR cannot access local files, always use ActiveX for that case - if ( this.isLocal ) { - return createActiveXHR(); - } - - // Support: IE 9-11 - // IE seems to error on cross-domain PATCH requests when ActiveX XHR - // is used. In IE 9+ always use the native XHR. - // Note: this condition won't catch Edge as it doesn't define - // document.documentMode but it also doesn't support ActiveX so it won't - // reach this code. - if ( document.documentMode > 8 ) { - return createStandardXHR(); - } - - // Support: IE<9 - // oldIE XHR does not support non-RFC2616 methods (#13240) - // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx - // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9 - // Although this check for six methods instead of eight - // since IE also does not support "trace" and "connect" - return /^(get|post|head|put|delete|options)$/i.test( this.type ) && - createStandardXHR() || createActiveXHR(); - } : - - // For all other browsers, use the standard XMLHttpRequest object - createStandardXHR; - -var xhrId = 0, - xhrCallbacks = {}, - xhrSupported = jQuery.ajaxSettings.xhr(); - -// Support: IE<10 -// 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 ]( undefined, true ); - } - } ); -} - -// Determine support properties -support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); -xhrSupported = support.ajax = !!xhrSupported; - -// Create transport if the browser can provide an xhr -if ( xhrSupported ) { - - jQuery.ajaxTransport( function( options ) { - - // Cross domain only allowed if supported through XMLHttpRequest - if ( !options.crossDomain || support.cors ) { - - var callback; - - return { - send: function( headers, complete ) { - var i, - xhr = options.xhr(), - id = ++xhrId; - - // Open the socket - 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 ) { - - // Support: IE<9 - // IE's ActiveXObject throws a 'Type Mismatch' exception when setting - // request header to a null-value. - // - // To keep consistent with other XHR implementations, cast the value - // to string and ignore `undefined`. - if ( headers[ i ] !== undefined ) { - xhr.setRequestHeader( i, headers[ i ] + "" ); - } - } - - // Do send the request - // This may raise an exception which is actually - // handled in jQuery.ajax (so no try/catch here) - xhr.send( ( options.hasContent && options.data ) || null ); - - // Listener - callback = function( _, isAbort ) { - var status, statusText, responses; - - // Was never called and is aborted or complete - if ( callback && ( isAbort || xhr.readyState === 4 ) ) { - - // Clean up - delete xhrCallbacks[ id ]; - callback = undefined; - xhr.onreadystatechange = jQuery.noop; - - // Abort manually if needed - if ( isAbort ) { - if ( xhr.readyState !== 4 ) { - xhr.abort(); - } - } else { - responses = {}; - status = xhr.status; - - // Support: IE<10 - // Accessing binary-data responseText throws an exception - // (#11426) - if ( typeof xhr.responseText === "string" ) { - responses.text = xhr.responseText; - } - - // Firefox throws an exception when accessing - // statusText for faulty cross-domain requests - try { - statusText = xhr.statusText; - } catch ( e ) { - - // We normalize with Webkit giving an empty statusText - statusText = ""; - } - - // Filter status for non standard behaviors - - // If the request is local and we have data: assume a success - // (success with no data won't get notified, that's the best we - // can do given current implementations) - if ( !status && options.isLocal && !options.crossDomain ) { - status = responses.text ? 200 : 404; - - // IE - #1450: sometimes returns 1223 when it should be 204 - } else if ( status === 1223 ) { - status = 204; - } - } - } - - // Call complete if needed - if ( responses ) { - complete( status, statusText, responses, xhr.getAllResponseHeaders() ); - } - }; - - // Do send the request - // `xhr.send` may raise an exception, but it will be - // handled in jQuery.ajax (so no try/catch here) - if ( !options.async ) { - - // If we're in sync mode we fire the callback - callback(); - } else if ( xhr.readyState === 4 ) { - - // (IE6 & IE7) if it's in cache and has been - // retrieved directly we need to fire the callback - window.setTimeout( callback ); - } else { - - // Register the callback, but delay it in case `xhr.send` throws - // Add to the list of active xhr callbacks - xhr.onreadystatechange = xhrCallbacks[ id ] = callback; - } - }, - - abort: function() { - if ( callback ) { - callback( undefined, true ); - } - } - }; - } - } ); -} - -// Functions to create xhrs -function createStandardXHR() { - try { - return new window.XMLHttpRequest(); - } catch ( e ) {} -} - -function createActiveXHR() { - try { - return new window.ActiveXObject( "Microsoft.XMLHTTP" ); - } catch ( e ) {} -} - -} ); |
