guff-compass 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +21 -0
- data/.gitignore +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +21 -0
- data/demo/bower_components/jquery/.bower.json +21 -0
- data/demo/bower_components/jquery/.editorconfig +43 -0
- data/demo/bower_components/jquery/.gitattributes +2 -0
- data/demo/bower_components/jquery/.gitignore +14 -0
- data/demo/bower_components/jquery/.gitmodules +6 -0
- data/demo/bower_components/jquery/.jshintrc +17 -0
- data/demo/bower_components/jquery/.mailmap +94 -0
- data/demo/bower_components/jquery/AUTHORS.txt +170 -0
- data/demo/bower_components/jquery/CONTRIBUTING.md +216 -0
- data/demo/bower_components/jquery/Gruntfile.js +594 -0
- data/demo/bower_components/jquery/MIT-LICENSE.txt +21 -0
- data/demo/bower_components/jquery/README.md +398 -0
- data/demo/bower_components/jquery/bower.json +11 -0
- data/demo/bower_components/jquery/build/release-notes.js +59 -0
- data/demo/bower_components/jquery/build/release.js +316 -0
- data/demo/bower_components/jquery/component.json +15 -0
- data/demo/bower_components/jquery/composer.json +35 -0
- data/demo/bower_components/jquery/jquery-migrate.js +511 -0
- data/demo/bower_components/jquery/jquery-migrate.min.js +3 -0
- data/demo/bower_components/jquery/jquery.js +9789 -0
- data/demo/bower_components/jquery/jquery.min.js +6 -0
- data/demo/bower_components/jquery/jquery.min.map +1 -0
- data/demo/bower_components/jquery/package.json +38 -0
- data/demo/bower_components/jquery/speed/benchmark.js +15 -0
- data/demo/bower_components/jquery/speed/benchmarker.css +65 -0
- data/demo/bower_components/jquery/speed/benchmarker.js +181 -0
- data/demo/bower_components/jquery/speed/closest.html +39 -0
- data/demo/bower_components/jquery/speed/css.html +82 -0
- data/demo/bower_components/jquery/speed/event.html +58 -0
- data/demo/bower_components/jquery/speed/filter.html +183 -0
- data/demo/bower_components/jquery/speed/find.html +179 -0
- data/demo/bower_components/jquery/speed/index.html +72 -0
- data/demo/bower_components/jquery/speed/jquery-basis.js +6238 -0
- data/demo/bower_components/jquery/speed/slice.vs.concat.html +47 -0
- data/demo/bower_components/jquery/src/.jshintrc +27 -0
- data/demo/bower_components/jquery/src/ajax.js +855 -0
- data/demo/bower_components/jquery/src/ajax/jsonp.js +80 -0
- data/demo/bower_components/jquery/src/ajax/script.js +86 -0
- data/demo/bower_components/jquery/src/ajax/xhr.js +207 -0
- data/demo/bower_components/jquery/src/attributes.js +659 -0
- data/demo/bower_components/jquery/src/callbacks.js +197 -0
- data/demo/bower_components/jquery/src/core.js +981 -0
- data/demo/bower_components/jquery/src/css.js +661 -0
- data/demo/bower_components/jquery/src/data.js +336 -0
- data/demo/bower_components/jquery/src/deferred.js +141 -0
- data/demo/bower_components/jquery/src/deprecated.js +11 -0
- data/demo/bower_components/jquery/src/dimensions.js +41 -0
- data/demo/bower_components/jquery/src/effects.js +732 -0
- data/demo/bower_components/jquery/src/event-alias.js +32 -0
- data/demo/bower_components/jquery/src/event.js +995 -0
- data/demo/bower_components/jquery/src/exports.js +21 -0
- data/demo/bower_components/jquery/src/intro.js +20 -0
- data/demo/bower_components/jquery/src/manipulation.js +744 -0
- data/demo/bower_components/jquery/src/offset.js +169 -0
- data/demo/bower_components/jquery/src/outro.js +2 -0
- data/demo/bower_components/jquery/src/queue.js +146 -0
- data/demo/bower_components/jquery/src/serialize.js +99 -0
- data/demo/bower_components/jquery/src/sizzle-jquery.js +7 -0
- data/demo/bower_components/jquery/src/support.js +246 -0
- data/demo/bower_components/jquery/src/traversing.js +283 -0
- data/demo/bower_components/jquery/src/wrap.js +66 -0
- data/demo/bower_components/jquery/test/.jshintignore +3 -0
- data/demo/bower_components/jquery/test/.jshintrc +60 -0
- data/demo/bower_components/jquery/test/data/1x1.jpg +0 -0
- data/demo/bower_components/jquery/test/data/ajax/unreleasedXHR.html +25 -0
- data/demo/bower_components/jquery/test/data/atom+xml.php +4 -0
- data/demo/bower_components/jquery/test/data/badcall.js +1 -0
- data/demo/bower_components/jquery/test/data/badjson.js +1 -0
- data/demo/bower_components/jquery/test/data/cleanScript.html +10 -0
- data/demo/bower_components/jquery/test/data/core/cc_on.html +22 -0
- data/demo/bower_components/jquery/test/data/dashboard.xml +11 -0
- data/demo/bower_components/jquery/test/data/dimensions/documentLarge.html +17 -0
- data/demo/bower_components/jquery/test/data/dimensions/documentSmall.html +21 -0
- data/demo/bower_components/jquery/test/data/echoData.php +1 -0
- data/demo/bower_components/jquery/test/data/echoQuery.php +1 -0
- data/demo/bower_components/jquery/test/data/errorWithJSON.php +6 -0
- data/demo/bower_components/jquery/test/data/errorWithText.php +5 -0
- data/demo/bower_components/jquery/test/data/etag.php +21 -0
- data/demo/bower_components/jquery/test/data/evalScript.php +1 -0
- data/demo/bower_components/jquery/test/data/event/focusElem.html +16 -0
- data/demo/bower_components/jquery/test/data/event/longLoadScript.php +4 -0
- data/demo/bower_components/jquery/test/data/event/promiseReady.html +17 -0
- data/demo/bower_components/jquery/test/data/event/syncReady.html +23 -0
- data/demo/bower_components/jquery/test/data/headers.php +18 -0
- data/demo/bower_components/jquery/test/data/if_modified_since.php +20 -0
- data/demo/bower_components/jquery/test/data/iframe.html +8 -0
- data/demo/bower_components/jquery/test/data/jquery-1.9.1.ajax_xhr.min.js +5 -0
- data/demo/bower_components/jquery/test/data/json.php +13 -0
- data/demo/bower_components/jquery/test/data/json_obj.js +1 -0
- data/demo/bower_components/jquery/test/data/jsonp.php +14 -0
- data/demo/bower_components/jquery/test/data/manipulation/iframe-denied.html +36 -0
- data/demo/bower_components/jquery/test/data/name.html +1 -0
- data/demo/bower_components/jquery/test/data/name.php +24 -0
- data/demo/bower_components/jquery/test/data/nocontent.php +5 -0
- data/demo/bower_components/jquery/test/data/offset/absolute.html +41 -0
- data/demo/bower_components/jquery/test/data/offset/body.html +26 -0
- data/demo/bower_components/jquery/test/data/offset/fixed.html +34 -0
- data/demo/bower_components/jquery/test/data/offset/relative.html +31 -0
- data/demo/bower_components/jquery/test/data/offset/scroll.html +39 -0
- data/demo/bower_components/jquery/test/data/offset/static.html +31 -0
- data/demo/bower_components/jquery/test/data/offset/table.html +43 -0
- data/demo/bower_components/jquery/test/data/params_html.php +12 -0
- data/demo/bower_components/jquery/test/data/readywaitasset.js +1 -0
- data/demo/bower_components/jquery/test/data/readywaitloader.js +25 -0
- data/demo/bower_components/jquery/test/data/script.php +11 -0
- data/demo/bower_components/jquery/test/data/selector/html5_selector.html +114 -0
- data/demo/bower_components/jquery/test/data/selector/sizzle_cache.html +21 -0
- data/demo/bower_components/jquery/test/data/statusText.php +5 -0
- data/demo/bower_components/jquery/test/data/support/bodyBackground.html +28 -0
- data/demo/bower_components/jquery/test/data/support/boxSizing.html +19 -0
- data/demo/bower_components/jquery/test/data/support/csp.js +3 -0
- data/demo/bower_components/jquery/test/data/support/csp.php +22 -0
- data/demo/bower_components/jquery/test/data/support/shrinkWrapBlocks.html +23 -0
- data/demo/bower_components/jquery/test/data/support/testElementCrash.html +17 -0
- data/demo/bower_components/jquery/test/data/test.html +7 -0
- data/demo/bower_components/jquery/test/data/test.js +3 -0
- data/demo/bower_components/jquery/test/data/test.php +7 -0
- data/demo/bower_components/jquery/test/data/test2.html +5 -0
- data/demo/bower_components/jquery/test/data/test3.html +3 -0
- data/demo/bower_components/jquery/test/data/testinit.js +264 -0
- data/demo/bower_components/jquery/test/data/testrunner.js +371 -0
- data/demo/bower_components/jquery/test/data/testsuite.css +155 -0
- data/demo/bower_components/jquery/test/data/text.php +12 -0
- data/demo/bower_components/jquery/test/data/ua.txt +272 -0
- data/demo/bower_components/jquery/test/data/with_fries.xml +25 -0
- data/demo/bower_components/jquery/test/data/with_fries_over_jsonp.php +7 -0
- data/demo/bower_components/jquery/test/delegatetest.html +228 -0
- data/demo/bower_components/jquery/test/hovertest.html +158 -0
- data/demo/bower_components/jquery/test/index.html +337 -0
- data/demo/bower_components/jquery/test/jquery.js +5 -0
- data/demo/bower_components/jquery/test/localfile.html +75 -0
- data/demo/bower_components/jquery/test/networkerror.html +84 -0
- data/demo/bower_components/jquery/test/readywait.html +70 -0
- data/demo/bower_components/jquery/test/unit/ajax.js +2016 -0
- data/demo/bower_components/jquery/test/unit/attributes.js +1388 -0
- data/demo/bower_components/jquery/test/unit/callbacks.js +342 -0
- data/demo/bower_components/jquery/test/unit/core.js +1360 -0
- data/demo/bower_components/jquery/test/unit/css.js +1056 -0
- data/demo/bower_components/jquery/test/unit/data.js +645 -0
- data/demo/bower_components/jquery/test/unit/deferred.js +436 -0
- data/demo/bower_components/jquery/test/unit/deprecated.js +8 -0
- data/demo/bower_components/jquery/test/unit/dimensions.js +472 -0
- data/demo/bower_components/jquery/test/unit/effects.js +2242 -0
- data/demo/bower_components/jquery/test/unit/event.js +2755 -0
- data/demo/bower_components/jquery/test/unit/exports.js +7 -0
- data/demo/bower_components/jquery/test/unit/manipulation.js +2120 -0
- data/demo/bower_components/jquery/test/unit/offset.js +559 -0
- data/demo/bower_components/jquery/test/unit/queue.js +314 -0
- data/demo/bower_components/jquery/test/unit/selector.js +172 -0
- data/demo/bower_components/jquery/test/unit/serialize.js +148 -0
- data/demo/bower_components/jquery/test/unit/support.js +370 -0
- data/demo/bower_components/jquery/test/unit/traversing.js +797 -0
- data/demo/bower_components/jquery/test/unit/wrap.js +265 -0
- data/demo/bower_components/jquery/test/xhtml.php +5 -0
- data/demo/index.html +347 -0
- data/demo/styles/main.css +208 -0
- data/demo/styles/main.scss +138 -0
- data/docs/docco.css +506 -0
- data/docs/guff.html +1127 -0
- data/docs/public/fonts/aller-bold.eot +0 -0
- data/docs/public/fonts/aller-bold.ttf +0 -0
- data/docs/public/fonts/aller-bold.woff +0 -0
- data/docs/public/fonts/aller-light.eot +0 -0
- data/docs/public/fonts/aller-light.ttf +0 -0
- data/docs/public/fonts/aller-light.woff +0 -0
- data/docs/public/fonts/novecento-bold.eot +0 -0
- data/docs/public/fonts/novecento-bold.ttf +0 -0
- data/docs/public/fonts/novecento-bold.woff +0 -0
- data/docs/public/stylesheets/normalize.css +375 -0
- data/guff.gemspec +16 -0
- data/guff.scss +514 -0
- data/gulpfile.js +67 -0
- data/lib/guff.rb +4 -0
- data/lib/stylesheets/_guff.scss +514 -0
- data/package.json +19 -0
- data/src/_functions.scss +57 -0
- data/src/_mixins.scss +301 -0
- data/src/_reset.scss +67 -0
- data/src/_settings.scss +22 -0
- data/src/_typography.scss +67 -0
- metadata +259 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
var oldCallbacks = [],
|
2
|
+
rjsonp = /(=)\?(?=&|$)|\?\?/;
|
3
|
+
|
4
|
+
// Default jsonp settings
|
5
|
+
jQuery.ajaxSetup({
|
6
|
+
jsonp: "callback",
|
7
|
+
jsonpCallback: function() {
|
8
|
+
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
|
9
|
+
this[ callback ] = true;
|
10
|
+
return callback;
|
11
|
+
}
|
12
|
+
});
|
13
|
+
|
14
|
+
// Detect, normalize options and install callbacks for jsonp requests
|
15
|
+
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
|
16
|
+
|
17
|
+
var callbackName, overwritten, responseContainer,
|
18
|
+
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
|
19
|
+
"url" :
|
20
|
+
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
|
21
|
+
);
|
22
|
+
|
23
|
+
// Handle iff the expected data type is "jsonp" or we have a parameter to set
|
24
|
+
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
|
25
|
+
|
26
|
+
// Get callback name, remembering preexisting value associated with it
|
27
|
+
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
|
28
|
+
s.jsonpCallback() :
|
29
|
+
s.jsonpCallback;
|
30
|
+
|
31
|
+
// Insert callback into url or form data
|
32
|
+
if ( jsonProp ) {
|
33
|
+
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
|
34
|
+
} else if ( s.jsonp !== false ) {
|
35
|
+
s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Use data converter to retrieve json after script execution
|
39
|
+
s.converters["script json"] = function() {
|
40
|
+
if ( !responseContainer ) {
|
41
|
+
jQuery.error( callbackName + " was not called" );
|
42
|
+
}
|
43
|
+
return responseContainer[ 0 ];
|
44
|
+
};
|
45
|
+
|
46
|
+
// force json dataType
|
47
|
+
s.dataTypes[ 0 ] = "json";
|
48
|
+
|
49
|
+
// Install callback
|
50
|
+
overwritten = window[ callbackName ];
|
51
|
+
window[ callbackName ] = function() {
|
52
|
+
responseContainer = arguments;
|
53
|
+
};
|
54
|
+
|
55
|
+
// Clean-up function (fires after converters)
|
56
|
+
jqXHR.always(function() {
|
57
|
+
// Restore preexisting value
|
58
|
+
window[ callbackName ] = overwritten;
|
59
|
+
|
60
|
+
// Save back as free
|
61
|
+
if ( s[ callbackName ] ) {
|
62
|
+
// make sure that re-using the options doesn't screw things around
|
63
|
+
s.jsonpCallback = originalSettings.jsonpCallback;
|
64
|
+
|
65
|
+
// save the callback name for future use
|
66
|
+
oldCallbacks.push( callbackName );
|
67
|
+
}
|
68
|
+
|
69
|
+
// Call if it was a function and we have a response
|
70
|
+
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
|
71
|
+
overwritten( responseContainer[ 0 ] );
|
72
|
+
}
|
73
|
+
|
74
|
+
responseContainer = overwritten = undefined;
|
75
|
+
});
|
76
|
+
|
77
|
+
// Delegate to script
|
78
|
+
return "script";
|
79
|
+
}
|
80
|
+
});
|
@@ -0,0 +1,86 @@
|
|
1
|
+
// Install script dataType
|
2
|
+
jQuery.ajaxSetup({
|
3
|
+
accepts: {
|
4
|
+
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
|
5
|
+
},
|
6
|
+
contents: {
|
7
|
+
script: /(?:java|ecma)script/
|
8
|
+
},
|
9
|
+
converters: {
|
10
|
+
"text script": function( text ) {
|
11
|
+
jQuery.globalEval( text );
|
12
|
+
return text;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
});
|
16
|
+
|
17
|
+
// Handle cache's special case and global
|
18
|
+
jQuery.ajaxPrefilter( "script", function( s ) {
|
19
|
+
if ( s.cache === undefined ) {
|
20
|
+
s.cache = false;
|
21
|
+
}
|
22
|
+
if ( s.crossDomain ) {
|
23
|
+
s.type = "GET";
|
24
|
+
s.global = false;
|
25
|
+
}
|
26
|
+
});
|
27
|
+
|
28
|
+
// Bind script tag hack transport
|
29
|
+
jQuery.ajaxTransport( "script", function(s) {
|
30
|
+
|
31
|
+
// This transport only deals with cross domain requests
|
32
|
+
if ( s.crossDomain ) {
|
33
|
+
|
34
|
+
var script,
|
35
|
+
head = document.head || jQuery("head")[0] || document.documentElement;
|
36
|
+
|
37
|
+
return {
|
38
|
+
|
39
|
+
send: function( _, callback ) {
|
40
|
+
|
41
|
+
script = document.createElement("script");
|
42
|
+
|
43
|
+
script.async = true;
|
44
|
+
|
45
|
+
if ( s.scriptCharset ) {
|
46
|
+
script.charset = s.scriptCharset;
|
47
|
+
}
|
48
|
+
|
49
|
+
script.src = s.url;
|
50
|
+
|
51
|
+
// Attach handlers for all browsers
|
52
|
+
script.onload = script.onreadystatechange = function( _, isAbort ) {
|
53
|
+
|
54
|
+
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
|
55
|
+
|
56
|
+
// Handle memory leak in IE
|
57
|
+
script.onload = script.onreadystatechange = null;
|
58
|
+
|
59
|
+
// Remove the script
|
60
|
+
if ( script.parentNode ) {
|
61
|
+
script.parentNode.removeChild( script );
|
62
|
+
}
|
63
|
+
|
64
|
+
// Dereference the script
|
65
|
+
script = null;
|
66
|
+
|
67
|
+
// Callback if not abort
|
68
|
+
if ( !isAbort ) {
|
69
|
+
callback( 200, "success" );
|
70
|
+
}
|
71
|
+
}
|
72
|
+
};
|
73
|
+
|
74
|
+
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
|
75
|
+
// Use native DOM manipulation to avoid our domManip AJAX trickery
|
76
|
+
head.insertBefore( script, head.firstChild );
|
77
|
+
},
|
78
|
+
|
79
|
+
abort: function() {
|
80
|
+
if ( script ) {
|
81
|
+
script.onload( undefined, true );
|
82
|
+
}
|
83
|
+
}
|
84
|
+
};
|
85
|
+
}
|
86
|
+
});
|
@@ -0,0 +1,207 @@
|
|
1
|
+
var xhrCallbacks, xhrSupported,
|
2
|
+
xhrId = 0,
|
3
|
+
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
|
4
|
+
xhrOnUnloadAbort = window.ActiveXObject && function() {
|
5
|
+
// Abort all pending requests
|
6
|
+
var key;
|
7
|
+
for ( key in xhrCallbacks ) {
|
8
|
+
xhrCallbacks[ key ]( undefined, true );
|
9
|
+
}
|
10
|
+
};
|
11
|
+
|
12
|
+
// Functions to create xhrs
|
13
|
+
function createStandardXHR() {
|
14
|
+
try {
|
15
|
+
return new window.XMLHttpRequest();
|
16
|
+
} catch( e ) {}
|
17
|
+
}
|
18
|
+
|
19
|
+
function createActiveXHR() {
|
20
|
+
try {
|
21
|
+
return new window.ActiveXObject("Microsoft.XMLHTTP");
|
22
|
+
} catch( e ) {}
|
23
|
+
}
|
24
|
+
|
25
|
+
// Create the request object
|
26
|
+
// (This is still attached to ajaxSettings for backward compatibility)
|
27
|
+
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
|
28
|
+
/* Microsoft failed to properly
|
29
|
+
* implement the XMLHttpRequest in IE7 (can't request local files),
|
30
|
+
* so we use the ActiveXObject when it is available
|
31
|
+
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
|
32
|
+
* we need a fallback.
|
33
|
+
*/
|
34
|
+
function() {
|
35
|
+
return !this.isLocal && createStandardXHR() || createActiveXHR();
|
36
|
+
} :
|
37
|
+
// For all other browsers, use the standard XMLHttpRequest object
|
38
|
+
createStandardXHR;
|
39
|
+
|
40
|
+
// Determine support properties
|
41
|
+
xhrSupported = jQuery.ajaxSettings.xhr();
|
42
|
+
jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
|
43
|
+
xhrSupported = jQuery.support.ajax = !!xhrSupported;
|
44
|
+
|
45
|
+
// Create transport if the browser can provide an xhr
|
46
|
+
if ( xhrSupported ) {
|
47
|
+
|
48
|
+
jQuery.ajaxTransport(function( s ) {
|
49
|
+
// Cross domain only allowed if supported through XMLHttpRequest
|
50
|
+
if ( !s.crossDomain || jQuery.support.cors ) {
|
51
|
+
|
52
|
+
var callback;
|
53
|
+
|
54
|
+
return {
|
55
|
+
send: function( headers, complete ) {
|
56
|
+
|
57
|
+
// Get a new xhr
|
58
|
+
var handle, i,
|
59
|
+
xhr = s.xhr();
|
60
|
+
|
61
|
+
// Open the socket
|
62
|
+
// Passing null username, generates a login popup on Opera (#2865)
|
63
|
+
if ( s.username ) {
|
64
|
+
xhr.open( s.type, s.url, s.async, s.username, s.password );
|
65
|
+
} else {
|
66
|
+
xhr.open( s.type, s.url, s.async );
|
67
|
+
}
|
68
|
+
|
69
|
+
// Apply custom fields if provided
|
70
|
+
if ( s.xhrFields ) {
|
71
|
+
for ( i in s.xhrFields ) {
|
72
|
+
xhr[ i ] = s.xhrFields[ i ];
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
// Override mime type if needed
|
77
|
+
if ( s.mimeType && xhr.overrideMimeType ) {
|
78
|
+
xhr.overrideMimeType( s.mimeType );
|
79
|
+
}
|
80
|
+
|
81
|
+
// X-Requested-With header
|
82
|
+
// For cross-domain requests, seeing as conditions for a preflight are
|
83
|
+
// akin to a jigsaw puzzle, we simply never set it to be sure.
|
84
|
+
// (it can always be set on a per-request basis or even using ajaxSetup)
|
85
|
+
// For same-domain requests, won't change header if already provided.
|
86
|
+
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
|
87
|
+
headers["X-Requested-With"] = "XMLHttpRequest";
|
88
|
+
}
|
89
|
+
|
90
|
+
// Need an extra try/catch for cross domain requests in Firefox 3
|
91
|
+
try {
|
92
|
+
for ( i in headers ) {
|
93
|
+
xhr.setRequestHeader( i, headers[ i ] );
|
94
|
+
}
|
95
|
+
} catch( err ) {}
|
96
|
+
|
97
|
+
// Do send the request
|
98
|
+
// This may raise an exception which is actually
|
99
|
+
// handled in jQuery.ajax (so no try/catch here)
|
100
|
+
xhr.send( ( s.hasContent && s.data ) || null );
|
101
|
+
|
102
|
+
// Listener
|
103
|
+
callback = function( _, isAbort ) {
|
104
|
+
var status, responseHeaders, statusText, responses;
|
105
|
+
|
106
|
+
// Firefox throws exceptions when accessing properties
|
107
|
+
// of an xhr when a network error occurred
|
108
|
+
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
|
109
|
+
try {
|
110
|
+
|
111
|
+
// Was never called and is aborted or complete
|
112
|
+
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
|
113
|
+
|
114
|
+
// Only called once
|
115
|
+
callback = undefined;
|
116
|
+
|
117
|
+
// Do not keep as active anymore
|
118
|
+
if ( handle ) {
|
119
|
+
xhr.onreadystatechange = jQuery.noop;
|
120
|
+
if ( xhrOnUnloadAbort ) {
|
121
|
+
delete xhrCallbacks[ handle ];
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
// If it's an abort
|
126
|
+
if ( isAbort ) {
|
127
|
+
// Abort it manually if needed
|
128
|
+
if ( xhr.readyState !== 4 ) {
|
129
|
+
xhr.abort();
|
130
|
+
}
|
131
|
+
} else {
|
132
|
+
responses = {};
|
133
|
+
status = xhr.status;
|
134
|
+
responseHeaders = xhr.getAllResponseHeaders();
|
135
|
+
|
136
|
+
// When requesting binary data, IE6-9 will throw an exception
|
137
|
+
// on any attempt to access responseText (#11426)
|
138
|
+
if ( typeof xhr.responseText === "string" ) {
|
139
|
+
responses.text = xhr.responseText;
|
140
|
+
}
|
141
|
+
|
142
|
+
// Firefox throws an exception when accessing
|
143
|
+
// statusText for faulty cross-domain requests
|
144
|
+
try {
|
145
|
+
statusText = xhr.statusText;
|
146
|
+
} catch( e ) {
|
147
|
+
// We normalize with Webkit giving an empty statusText
|
148
|
+
statusText = "";
|
149
|
+
}
|
150
|
+
|
151
|
+
// Filter status for non standard behaviors
|
152
|
+
|
153
|
+
// If the request is local and we have data: assume a success
|
154
|
+
// (success with no data won't get notified, that's the best we
|
155
|
+
// can do given current implementations)
|
156
|
+
if ( !status && s.isLocal && !s.crossDomain ) {
|
157
|
+
status = responses.text ? 200 : 404;
|
158
|
+
// IE - #1450: sometimes returns 1223 when it should be 204
|
159
|
+
} else if ( status === 1223 ) {
|
160
|
+
status = 204;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
} catch( firefoxAccessException ) {
|
165
|
+
if ( !isAbort ) {
|
166
|
+
complete( -1, firefoxAccessException );
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
// Call complete if needed
|
171
|
+
if ( responses ) {
|
172
|
+
complete( status, statusText, responses, responseHeaders );
|
173
|
+
}
|
174
|
+
};
|
175
|
+
|
176
|
+
if ( !s.async ) {
|
177
|
+
// if we're in sync mode we fire the callback
|
178
|
+
callback();
|
179
|
+
} else if ( xhr.readyState === 4 ) {
|
180
|
+
// (IE6 & IE7) if it's in cache and has been
|
181
|
+
// retrieved directly we need to fire the callback
|
182
|
+
setTimeout( callback );
|
183
|
+
} else {
|
184
|
+
handle = ++xhrId;
|
185
|
+
if ( xhrOnUnloadAbort ) {
|
186
|
+
// Create the active xhrs callbacks list if needed
|
187
|
+
// and attach the unload handler
|
188
|
+
if ( !xhrCallbacks ) {
|
189
|
+
xhrCallbacks = {};
|
190
|
+
jQuery( window ).unload( xhrOnUnloadAbort );
|
191
|
+
}
|
192
|
+
// Add to list of active xhrs callbacks
|
193
|
+
xhrCallbacks[ handle ] = callback;
|
194
|
+
}
|
195
|
+
xhr.onreadystatechange = callback;
|
196
|
+
}
|
197
|
+
},
|
198
|
+
|
199
|
+
abort: function() {
|
200
|
+
if ( callback ) {
|
201
|
+
callback( undefined, true );
|
202
|
+
}
|
203
|
+
}
|
204
|
+
};
|
205
|
+
}
|
206
|
+
});
|
207
|
+
}
|
@@ -0,0 +1,659 @@
|
|
1
|
+
var nodeHook, boolHook,
|
2
|
+
rclass = /[\t\r\n\f]/g,
|
3
|
+
rreturn = /\r/g,
|
4
|
+
rfocusable = /^(?:input|select|textarea|button|object)$/i,
|
5
|
+
rclickable = /^(?:a|area)$/i,
|
6
|
+
ruseDefault = /^(?:checked|selected)$/i,
|
7
|
+
getSetAttribute = jQuery.support.getSetAttribute,
|
8
|
+
getSetInput = jQuery.support.input;
|
9
|
+
|
10
|
+
jQuery.fn.extend({
|
11
|
+
attr: function( name, value ) {
|
12
|
+
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
|
13
|
+
},
|
14
|
+
|
15
|
+
removeAttr: function( name ) {
|
16
|
+
return this.each(function() {
|
17
|
+
jQuery.removeAttr( this, name );
|
18
|
+
});
|
19
|
+
},
|
20
|
+
|
21
|
+
prop: function( name, value ) {
|
22
|
+
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
|
23
|
+
},
|
24
|
+
|
25
|
+
removeProp: function( name ) {
|
26
|
+
name = jQuery.propFix[ name ] || name;
|
27
|
+
return this.each(function() {
|
28
|
+
// try/catch handles cases where IE balks (such as removing a property on window)
|
29
|
+
try {
|
30
|
+
this[ name ] = undefined;
|
31
|
+
delete this[ name ];
|
32
|
+
} catch( e ) {}
|
33
|
+
});
|
34
|
+
},
|
35
|
+
|
36
|
+
addClass: function( value ) {
|
37
|
+
var classes, elem, cur, clazz, j,
|
38
|
+
i = 0,
|
39
|
+
len = this.length,
|
40
|
+
proceed = typeof value === "string" && value;
|
41
|
+
|
42
|
+
if ( jQuery.isFunction( value ) ) {
|
43
|
+
return this.each(function( j ) {
|
44
|
+
jQuery( this ).addClass( value.call( this, j, this.className ) );
|
45
|
+
});
|
46
|
+
}
|
47
|
+
|
48
|
+
if ( proceed ) {
|
49
|
+
// The disjunction here is for better compressibility (see removeClass)
|
50
|
+
classes = ( value || "" ).match( core_rnotwhite ) || [];
|
51
|
+
|
52
|
+
for ( ; i < len; i++ ) {
|
53
|
+
elem = this[ i ];
|
54
|
+
cur = elem.nodeType === 1 && ( elem.className ?
|
55
|
+
( " " + elem.className + " " ).replace( rclass, " " ) :
|
56
|
+
" "
|
57
|
+
);
|
58
|
+
|
59
|
+
if ( cur ) {
|
60
|
+
j = 0;
|
61
|
+
while ( (clazz = classes[j++]) ) {
|
62
|
+
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
|
63
|
+
cur += clazz + " ";
|
64
|
+
}
|
65
|
+
}
|
66
|
+
elem.className = jQuery.trim( cur );
|
67
|
+
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
return this;
|
73
|
+
},
|
74
|
+
|
75
|
+
removeClass: function( value ) {
|
76
|
+
var classes, elem, cur, clazz, j,
|
77
|
+
i = 0,
|
78
|
+
len = this.length,
|
79
|
+
proceed = arguments.length === 0 || typeof value === "string" && value;
|
80
|
+
|
81
|
+
if ( jQuery.isFunction( value ) ) {
|
82
|
+
return this.each(function( j ) {
|
83
|
+
jQuery( this ).removeClass( value.call( this, j, this.className ) );
|
84
|
+
});
|
85
|
+
}
|
86
|
+
if ( proceed ) {
|
87
|
+
classes = ( value || "" ).match( core_rnotwhite ) || [];
|
88
|
+
|
89
|
+
for ( ; i < len; i++ ) {
|
90
|
+
elem = this[ i ];
|
91
|
+
// This expression is here for better compressibility (see addClass)
|
92
|
+
cur = elem.nodeType === 1 && ( elem.className ?
|
93
|
+
( " " + elem.className + " " ).replace( rclass, " " ) :
|
94
|
+
""
|
95
|
+
);
|
96
|
+
|
97
|
+
if ( cur ) {
|
98
|
+
j = 0;
|
99
|
+
while ( (clazz = classes[j++]) ) {
|
100
|
+
// Remove *all* instances
|
101
|
+
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
|
102
|
+
cur = cur.replace( " " + clazz + " ", " " );
|
103
|
+
}
|
104
|
+
}
|
105
|
+
elem.className = value ? jQuery.trim( cur ) : "";
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
return this;
|
111
|
+
},
|
112
|
+
|
113
|
+
toggleClass: function( value, stateVal ) {
|
114
|
+
var type = typeof value;
|
115
|
+
|
116
|
+
if ( typeof stateVal === "boolean" && type === "string" ) {
|
117
|
+
return stateVal ? this.addClass( value ) : this.removeClass( value );
|
118
|
+
}
|
119
|
+
|
120
|
+
if ( jQuery.isFunction( value ) ) {
|
121
|
+
return this.each(function( i ) {
|
122
|
+
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
|
123
|
+
});
|
124
|
+
}
|
125
|
+
|
126
|
+
return this.each(function() {
|
127
|
+
if ( type === "string" ) {
|
128
|
+
// toggle individual class names
|
129
|
+
var className,
|
130
|
+
i = 0,
|
131
|
+
self = jQuery( this ),
|
132
|
+
classNames = value.match( core_rnotwhite ) || [];
|
133
|
+
|
134
|
+
while ( (className = classNames[ i++ ]) ) {
|
135
|
+
// check each className given, space separated list
|
136
|
+
if ( self.hasClass( className ) ) {
|
137
|
+
self.removeClass( className );
|
138
|
+
} else {
|
139
|
+
self.addClass( className );
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
// Toggle whole class name
|
144
|
+
} else if ( type === core_strundefined || type === "boolean" ) {
|
145
|
+
if ( this.className ) {
|
146
|
+
// store className if set
|
147
|
+
jQuery._data( this, "__className__", this.className );
|
148
|
+
}
|
149
|
+
|
150
|
+
// If the element has a class name or if we're passed "false",
|
151
|
+
// then remove the whole classname (if there was one, the above saved it).
|
152
|
+
// Otherwise bring back whatever was previously saved (if anything),
|
153
|
+
// falling back to the empty string if nothing was stored.
|
154
|
+
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
|
155
|
+
}
|
156
|
+
});
|
157
|
+
},
|
158
|
+
|
159
|
+
hasClass: function( selector ) {
|
160
|
+
var className = " " + selector + " ",
|
161
|
+
i = 0,
|
162
|
+
l = this.length;
|
163
|
+
for ( ; i < l; i++ ) {
|
164
|
+
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
|
165
|
+
return true;
|
166
|
+
}
|
167
|
+
}
|
168
|
+
|
169
|
+
return false;
|
170
|
+
},
|
171
|
+
|
172
|
+
val: function( value ) {
|
173
|
+
var ret, hooks, isFunction,
|
174
|
+
elem = this[0];
|
175
|
+
|
176
|
+
if ( !arguments.length ) {
|
177
|
+
if ( elem ) {
|
178
|
+
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
|
179
|
+
|
180
|
+
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
|
181
|
+
return ret;
|
182
|
+
}
|
183
|
+
|
184
|
+
ret = elem.value;
|
185
|
+
|
186
|
+
return typeof ret === "string" ?
|
187
|
+
// handle most common string cases
|
188
|
+
ret.replace(rreturn, "") :
|
189
|
+
// handle cases where value is null/undef or number
|
190
|
+
ret == null ? "" : ret;
|
191
|
+
}
|
192
|
+
|
193
|
+
return;
|
194
|
+
}
|
195
|
+
|
196
|
+
isFunction = jQuery.isFunction( value );
|
197
|
+
|
198
|
+
return this.each(function( i ) {
|
199
|
+
var val;
|
200
|
+
|
201
|
+
if ( this.nodeType !== 1 ) {
|
202
|
+
return;
|
203
|
+
}
|
204
|
+
|
205
|
+
if ( isFunction ) {
|
206
|
+
val = value.call( this, i, jQuery( this ).val() );
|
207
|
+
} else {
|
208
|
+
val = value;
|
209
|
+
}
|
210
|
+
|
211
|
+
// Treat null/undefined as ""; convert numbers to string
|
212
|
+
if ( val == null ) {
|
213
|
+
val = "";
|
214
|
+
} else if ( typeof val === "number" ) {
|
215
|
+
val += "";
|
216
|
+
} else if ( jQuery.isArray( val ) ) {
|
217
|
+
val = jQuery.map(val, function ( value ) {
|
218
|
+
return value == null ? "" : value + "";
|
219
|
+
});
|
220
|
+
}
|
221
|
+
|
222
|
+
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
|
223
|
+
|
224
|
+
// If set returns undefined, fall back to normal setting
|
225
|
+
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
|
226
|
+
this.value = val;
|
227
|
+
}
|
228
|
+
});
|
229
|
+
}
|
230
|
+
});
|
231
|
+
|
232
|
+
jQuery.extend({
|
233
|
+
valHooks: {
|
234
|
+
option: {
|
235
|
+
get: function( elem ) {
|
236
|
+
// Use proper attribute retrieval(#6932, #12072)
|
237
|
+
var val = jQuery.find.attr( elem, "value" );
|
238
|
+
return val != null ?
|
239
|
+
val :
|
240
|
+
elem.text;
|
241
|
+
}
|
242
|
+
},
|
243
|
+
select: {
|
244
|
+
get: function( elem ) {
|
245
|
+
var value, option,
|
246
|
+
options = elem.options,
|
247
|
+
index = elem.selectedIndex,
|
248
|
+
one = elem.type === "select-one" || index < 0,
|
249
|
+
values = one ? null : [],
|
250
|
+
max = one ? index + 1 : options.length,
|
251
|
+
i = index < 0 ?
|
252
|
+
max :
|
253
|
+
one ? index : 0;
|
254
|
+
|
255
|
+
// Loop through all the selected options
|
256
|
+
for ( ; i < max; i++ ) {
|
257
|
+
option = options[ i ];
|
258
|
+
|
259
|
+
// oldIE doesn't update selected after form reset (#2551)
|
260
|
+
if ( ( option.selected || i === index ) &&
|
261
|
+
// Don't return options that are disabled or in a disabled optgroup
|
262
|
+
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
|
263
|
+
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
|
264
|
+
|
265
|
+
// Get the specific value for the option
|
266
|
+
value = jQuery( option ).val();
|
267
|
+
|
268
|
+
// We don't need an array for one selects
|
269
|
+
if ( one ) {
|
270
|
+
return value;
|
271
|
+
}
|
272
|
+
|
273
|
+
// Multi-Selects return an array
|
274
|
+
values.push( value );
|
275
|
+
}
|
276
|
+
}
|
277
|
+
|
278
|
+
return values;
|
279
|
+
},
|
280
|
+
|
281
|
+
set: function( elem, value ) {
|
282
|
+
var optionSet, option,
|
283
|
+
options = elem.options,
|
284
|
+
values = jQuery.makeArray( value ),
|
285
|
+
i = options.length;
|
286
|
+
|
287
|
+
while ( i-- ) {
|
288
|
+
option = options[ i ];
|
289
|
+
if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {
|
290
|
+
optionSet = true;
|
291
|
+
}
|
292
|
+
}
|
293
|
+
|
294
|
+
// force browsers to behave consistently when non-matching value is set
|
295
|
+
if ( !optionSet ) {
|
296
|
+
elem.selectedIndex = -1;
|
297
|
+
}
|
298
|
+
return values;
|
299
|
+
}
|
300
|
+
}
|
301
|
+
},
|
302
|
+
|
303
|
+
attr: function( elem, name, value ) {
|
304
|
+
var hooks, ret,
|
305
|
+
nType = elem.nodeType;
|
306
|
+
|
307
|
+
// don't get/set attributes on text, comment and attribute nodes
|
308
|
+
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
309
|
+
return;
|
310
|
+
}
|
311
|
+
|
312
|
+
// Fallback to prop when attributes are not supported
|
313
|
+
if ( typeof elem.getAttribute === core_strundefined ) {
|
314
|
+
return jQuery.prop( elem, name, value );
|
315
|
+
}
|
316
|
+
|
317
|
+
// All attributes are lowercase
|
318
|
+
// Grab necessary hook if one is defined
|
319
|
+
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
|
320
|
+
name = name.toLowerCase();
|
321
|
+
hooks = jQuery.attrHooks[ name ] ||
|
322
|
+
( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
|
323
|
+
}
|
324
|
+
|
325
|
+
if ( value !== undefined ) {
|
326
|
+
|
327
|
+
if ( value === null ) {
|
328
|
+
jQuery.removeAttr( elem, name );
|
329
|
+
|
330
|
+
} else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
|
331
|
+
return ret;
|
332
|
+
|
333
|
+
} else {
|
334
|
+
elem.setAttribute( name, value + "" );
|
335
|
+
return value;
|
336
|
+
}
|
337
|
+
|
338
|
+
} else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
|
339
|
+
return ret;
|
340
|
+
|
341
|
+
} else {
|
342
|
+
ret = jQuery.find.attr( elem, name );
|
343
|
+
|
344
|
+
// Non-existent attributes return null, we normalize to undefined
|
345
|
+
return ret == null ?
|
346
|
+
undefined :
|
347
|
+
ret;
|
348
|
+
}
|
349
|
+
},
|
350
|
+
|
351
|
+
removeAttr: function( elem, value ) {
|
352
|
+
var name, propName,
|
353
|
+
i = 0,
|
354
|
+
attrNames = value && value.match( core_rnotwhite );
|
355
|
+
|
356
|
+
if ( attrNames && elem.nodeType === 1 ) {
|
357
|
+
while ( (name = attrNames[i++]) ) {
|
358
|
+
propName = jQuery.propFix[ name ] || name;
|
359
|
+
|
360
|
+
// Boolean attributes get special treatment (#10870)
|
361
|
+
if ( jQuery.expr.match.bool.test( name ) ) {
|
362
|
+
// Set corresponding property to false
|
363
|
+
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
|
364
|
+
elem[ propName ] = false;
|
365
|
+
// Support: IE<9
|
366
|
+
// Also clear defaultChecked/defaultSelected (if appropriate)
|
367
|
+
} else {
|
368
|
+
elem[ jQuery.camelCase( "default-" + name ) ] =
|
369
|
+
elem[ propName ] = false;
|
370
|
+
}
|
371
|
+
|
372
|
+
// See #9699 for explanation of this approach (setting first, then removal)
|
373
|
+
} else {
|
374
|
+
jQuery.attr( elem, name, "" );
|
375
|
+
}
|
376
|
+
|
377
|
+
elem.removeAttribute( getSetAttribute ? name : propName );
|
378
|
+
}
|
379
|
+
}
|
380
|
+
},
|
381
|
+
|
382
|
+
attrHooks: {
|
383
|
+
type: {
|
384
|
+
set: function( elem, value ) {
|
385
|
+
if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
|
386
|
+
// Setting the type on a radio button after the value resets the value in IE6-9
|
387
|
+
// Reset value to default in case type is set after value during creation
|
388
|
+
var val = elem.value;
|
389
|
+
elem.setAttribute( "type", value );
|
390
|
+
if ( val ) {
|
391
|
+
elem.value = val;
|
392
|
+
}
|
393
|
+
return value;
|
394
|
+
}
|
395
|
+
}
|
396
|
+
}
|
397
|
+
},
|
398
|
+
|
399
|
+
propFix: {
|
400
|
+
"for": "htmlFor",
|
401
|
+
"class": "className"
|
402
|
+
},
|
403
|
+
|
404
|
+
prop: function( elem, name, value ) {
|
405
|
+
var ret, hooks, notxml,
|
406
|
+
nType = elem.nodeType;
|
407
|
+
|
408
|
+
// don't get/set properties on text, comment and attribute nodes
|
409
|
+
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
410
|
+
return;
|
411
|
+
}
|
412
|
+
|
413
|
+
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
414
|
+
|
415
|
+
if ( notxml ) {
|
416
|
+
// Fix name and attach hooks
|
417
|
+
name = jQuery.propFix[ name ] || name;
|
418
|
+
hooks = jQuery.propHooks[ name ];
|
419
|
+
}
|
420
|
+
|
421
|
+
if ( value !== undefined ) {
|
422
|
+
return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
|
423
|
+
ret :
|
424
|
+
( elem[ name ] = value );
|
425
|
+
|
426
|
+
} else {
|
427
|
+
return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
|
428
|
+
ret :
|
429
|
+
elem[ name ];
|
430
|
+
}
|
431
|
+
},
|
432
|
+
|
433
|
+
propHooks: {
|
434
|
+
tabIndex: {
|
435
|
+
get: function( elem ) {
|
436
|
+
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
|
437
|
+
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
438
|
+
// Use proper attribute retrieval(#12072)
|
439
|
+
var tabindex = jQuery.find.attr( elem, "tabindex" );
|
440
|
+
|
441
|
+
return tabindex ?
|
442
|
+
parseInt( tabindex, 10 ) :
|
443
|
+
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
|
444
|
+
0 :
|
445
|
+
-1;
|
446
|
+
}
|
447
|
+
}
|
448
|
+
}
|
449
|
+
});
|
450
|
+
|
451
|
+
// Hooks for boolean attributes
|
452
|
+
boolHook = {
|
453
|
+
set: function( elem, value, name ) {
|
454
|
+
if ( value === false ) {
|
455
|
+
// Remove boolean attributes when set to false
|
456
|
+
jQuery.removeAttr( elem, name );
|
457
|
+
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
|
458
|
+
// IE<8 needs the *property* name
|
459
|
+
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
|
460
|
+
|
461
|
+
// Use defaultChecked and defaultSelected for oldIE
|
462
|
+
} else {
|
463
|
+
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
|
464
|
+
}
|
465
|
+
|
466
|
+
return name;
|
467
|
+
}
|
468
|
+
};
|
469
|
+
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
|
470
|
+
var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr;
|
471
|
+
|
472
|
+
jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?
|
473
|
+
function( elem, name, isXML ) {
|
474
|
+
var fn = jQuery.expr.attrHandle[ name ],
|
475
|
+
ret = isXML ?
|
476
|
+
undefined :
|
477
|
+
/* jshint eqeqeq: false */
|
478
|
+
(jQuery.expr.attrHandle[ name ] = undefined) !=
|
479
|
+
getter( elem, name, isXML ) ?
|
480
|
+
|
481
|
+
name.toLowerCase() :
|
482
|
+
null;
|
483
|
+
jQuery.expr.attrHandle[ name ] = fn;
|
484
|
+
return ret;
|
485
|
+
} :
|
486
|
+
function( elem, name, isXML ) {
|
487
|
+
return isXML ?
|
488
|
+
undefined :
|
489
|
+
elem[ jQuery.camelCase( "default-" + name ) ] ?
|
490
|
+
name.toLowerCase() :
|
491
|
+
null;
|
492
|
+
};
|
493
|
+
});
|
494
|
+
|
495
|
+
// fix oldIE attroperties
|
496
|
+
if ( !getSetInput || !getSetAttribute ) {
|
497
|
+
jQuery.attrHooks.value = {
|
498
|
+
set: function( elem, value, name ) {
|
499
|
+
if ( jQuery.nodeName( elem, "input" ) ) {
|
500
|
+
// Does not return so that setAttribute is also used
|
501
|
+
elem.defaultValue = value;
|
502
|
+
} else {
|
503
|
+
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
|
504
|
+
return nodeHook && nodeHook.set( elem, value, name );
|
505
|
+
}
|
506
|
+
}
|
507
|
+
};
|
508
|
+
}
|
509
|
+
|
510
|
+
// IE6/7 do not support getting/setting some attributes with get/setAttribute
|
511
|
+
if ( !getSetAttribute ) {
|
512
|
+
|
513
|
+
// Use this for any attribute in IE6/7
|
514
|
+
// This fixes almost every IE6/7 issue
|
515
|
+
nodeHook = {
|
516
|
+
set: function( elem, value, name ) {
|
517
|
+
// Set the existing or create a new attribute node
|
518
|
+
var ret = elem.getAttributeNode( name );
|
519
|
+
if ( !ret ) {
|
520
|
+
elem.setAttributeNode(
|
521
|
+
(ret = elem.ownerDocument.createAttribute( name ))
|
522
|
+
);
|
523
|
+
}
|
524
|
+
|
525
|
+
ret.value = value += "";
|
526
|
+
|
527
|
+
// Break association with cloned elements by also using setAttribute (#9646)
|
528
|
+
return name === "value" || value === elem.getAttribute( name ) ?
|
529
|
+
value :
|
530
|
+
undefined;
|
531
|
+
}
|
532
|
+
};
|
533
|
+
jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords =
|
534
|
+
// Some attributes are constructed with empty-string values when not defined
|
535
|
+
function( elem, name, isXML ) {
|
536
|
+
var ret;
|
537
|
+
return isXML ?
|
538
|
+
undefined :
|
539
|
+
(ret = elem.getAttributeNode( name )) && ret.value !== "" ?
|
540
|
+
ret.value :
|
541
|
+
null;
|
542
|
+
};
|
543
|
+
jQuery.valHooks.button = {
|
544
|
+
get: function( elem, name ) {
|
545
|
+
var ret = elem.getAttributeNode( name );
|
546
|
+
return ret && ret.specified ?
|
547
|
+
ret.value :
|
548
|
+
undefined;
|
549
|
+
},
|
550
|
+
set: nodeHook.set
|
551
|
+
};
|
552
|
+
|
553
|
+
// Set contenteditable to false on removals(#10429)
|
554
|
+
// Setting to empty string throws an error as an invalid value
|
555
|
+
jQuery.attrHooks.contenteditable = {
|
556
|
+
set: function( elem, value, name ) {
|
557
|
+
nodeHook.set( elem, value === "" ? false : value, name );
|
558
|
+
}
|
559
|
+
};
|
560
|
+
|
561
|
+
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
|
562
|
+
// This is for removals
|
563
|
+
jQuery.each([ "width", "height" ], function( i, name ) {
|
564
|
+
jQuery.attrHooks[ name ] = {
|
565
|
+
set: function( elem, value ) {
|
566
|
+
if ( value === "" ) {
|
567
|
+
elem.setAttribute( name, "auto" );
|
568
|
+
return value;
|
569
|
+
}
|
570
|
+
}
|
571
|
+
};
|
572
|
+
});
|
573
|
+
}
|
574
|
+
|
575
|
+
|
576
|
+
// Some attributes require a special call on IE
|
577
|
+
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
|
578
|
+
if ( !jQuery.support.hrefNormalized ) {
|
579
|
+
// href/src property should get the full normalized URL (#10299/#12915)
|
580
|
+
jQuery.each([ "href", "src" ], function( i, name ) {
|
581
|
+
jQuery.propHooks[ name ] = {
|
582
|
+
get: function( elem ) {
|
583
|
+
return elem.getAttribute( name, 4 );
|
584
|
+
}
|
585
|
+
};
|
586
|
+
});
|
587
|
+
}
|
588
|
+
|
589
|
+
if ( !jQuery.support.style ) {
|
590
|
+
jQuery.attrHooks.style = {
|
591
|
+
get: function( elem ) {
|
592
|
+
// Return undefined in the case of empty string
|
593
|
+
// Note: IE uppercases css property names, but if we were to .toLowerCase()
|
594
|
+
// .cssText, that would destroy case senstitivity in URL's, like in "background"
|
595
|
+
return elem.style.cssText || undefined;
|
596
|
+
},
|
597
|
+
set: function( elem, value ) {
|
598
|
+
return ( elem.style.cssText = value + "" );
|
599
|
+
}
|
600
|
+
};
|
601
|
+
}
|
602
|
+
|
603
|
+
// Safari mis-reports the default selected property of an option
|
604
|
+
// Accessing the parent's selectedIndex property fixes it
|
605
|
+
if ( !jQuery.support.optSelected ) {
|
606
|
+
jQuery.propHooks.selected = {
|
607
|
+
get: function( elem ) {
|
608
|
+
var parent = elem.parentNode;
|
609
|
+
|
610
|
+
if ( parent ) {
|
611
|
+
parent.selectedIndex;
|
612
|
+
|
613
|
+
// Make sure that it also works with optgroups, see #5701
|
614
|
+
if ( parent.parentNode ) {
|
615
|
+
parent.parentNode.selectedIndex;
|
616
|
+
}
|
617
|
+
}
|
618
|
+
return null;
|
619
|
+
}
|
620
|
+
};
|
621
|
+
}
|
622
|
+
|
623
|
+
jQuery.each([
|
624
|
+
"tabIndex",
|
625
|
+
"readOnly",
|
626
|
+
"maxLength",
|
627
|
+
"cellSpacing",
|
628
|
+
"cellPadding",
|
629
|
+
"rowSpan",
|
630
|
+
"colSpan",
|
631
|
+
"useMap",
|
632
|
+
"frameBorder",
|
633
|
+
"contentEditable"
|
634
|
+
], function() {
|
635
|
+
jQuery.propFix[ this.toLowerCase() ] = this;
|
636
|
+
});
|
637
|
+
|
638
|
+
// IE6/7 call enctype encoding
|
639
|
+
if ( !jQuery.support.enctype ) {
|
640
|
+
jQuery.propFix.enctype = "encoding";
|
641
|
+
}
|
642
|
+
|
643
|
+
// Radios and checkboxes getter/setter
|
644
|
+
jQuery.each([ "radio", "checkbox" ], function() {
|
645
|
+
jQuery.valHooks[ this ] = {
|
646
|
+
set: function( elem, value ) {
|
647
|
+
if ( jQuery.isArray( value ) ) {
|
648
|
+
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
|
649
|
+
}
|
650
|
+
}
|
651
|
+
};
|
652
|
+
if ( !jQuery.support.checkOn ) {
|
653
|
+
jQuery.valHooks[ this ].get = function( elem ) {
|
654
|
+
// Support: Webkit
|
655
|
+
// "" is returned instead of "on" if a value isn't specified
|
656
|
+
return elem.getAttribute("value") === null ? "on" : elem.value;
|
657
|
+
};
|
658
|
+
}
|
659
|
+
});
|