smparkes-envjs 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/envjsrb +157 -73
- data/bin/jquery-1.3.2-test.js +11 -4
- data/lib/envjs/env.js +935 -11028
- data/lib/envjs/net/cgi.rb +94 -0
- data/lib/envjs/net/file.rb +4 -4
- data/lib/envjs/runtime.rb +80 -24
- data/test/call-load-test.js +0 -2
- data/test/firebug/errorIcon.png +0 -0
- data/test/firebug/firebug.css +209 -0
- data/test/firebug/firebug.html +23 -0
- data/test/firebug/firebug.js +672 -0
- data/test/firebug/firebugx.js +10 -0
- data/test/firebug/infoIcon.png +0 -0
- data/test/firebug/warningIcon.png +0 -0
- data/test/fixtures/html/events.html +171 -0
- data/test/fixtures/html/iframe1.html +46 -0
- data/test/fixtures/html/iframe1a.html +46 -0
- data/test/fixtures/html/iframe2.html +45 -0
- data/test/fixtures/html/iframe3.html +28 -0
- data/test/fixtures/html/iframeN.html +57 -0
- data/test/fixtures/html/malformed.html +181 -0
- data/test/fixtures/html/scope.html +81 -0
- data/test/fixtures/html/trivial.html +19 -0
- data/test/fixtures/html/with_js.html +26 -0
- data/test/fixtures/images/icon-blue.png +0 -0
- data/test/fixtures/js/external_script.js +1 -0
- data/test/fixtures/js/script.js +1 -0
- data/test/fixtures/js/script_error.js +2 -0
- data/test/html/malformed.html +1 -0
- data/test/index.html +21 -19
- data/test/{primaryTests.js → primary-tests.js} +1 -3
- data/test/{prototype.js → prototype-test.js} +0 -2
- data/test/qunit/qunit/qunit.css +0 -0
- data/test/qunit/qunit/qunit.js +2 -2
- data/test/{qunit/qunit/qunit.js.smp → specs/dist/env.spec.js} +539 -7
- data/test/specs/envjs.spec.css +46 -0
- data/test/specs/parser/html.js +31 -0
- data/test/specs/parser/spec.html +40 -0
- data/test/specs/parser/xml.js +31 -0
- data/test/specs/qunit.bdd.js +210 -0
- data/test/{qunit.smp/qunit → specs}/qunit.css +0 -0
- data/test/{qunit.smp/qunit → specs}/qunit.js +2 -2
- data/test/specs/template/spec-0.js +31 -0
- data/test/specs/template/spec-1.js +31 -0
- data/test/specs/template/spec.html +40 -0
- data/test/specs/window/css.js +23 -0
- data/test/specs/window/dialog.js +25 -0
- data/test/specs/window/document.js +23 -0
- data/test/specs/window/event.js +25 -0
- data/test/specs/window/history.js +34 -0
- data/test/specs/window/location.js +34 -0
- data/test/specs/window/navigator.js +71 -0
- data/test/specs/window/screen.js +42 -0
- data/test/specs/window/spec.html +48 -0
- data/test/specs/window/timer.js +26 -0
- data/test/specs/window/window.js +53 -0
- data/test/specs/xhr/spec.html +47 -0
- data/test/specs/xhr/xhr.js +31 -0
- data/test/test.js +10 -0
- data/test/unit/elementmembers.js +31 -0
- data/test/unit/nu.validator.js +34 -0
- data/test/unit/onload.js +1 -3
- data/test/unit/parser.js +106 -98
- data/test/unit/prototypecompat.js +2 -2
- data/test/vendor/jQuery/1.3.2/ChangeLog.txt +98 -0
- data/test/vendor/jQuery/1.3.2/GPL-LICENSE.txt +278 -0
- data/test/vendor/jQuery/1.3.2/MIT-LICENSE.txt +20 -0
- data/test/vendor/jQuery/1.3.2/Makefile +154 -0
- data/test/vendor/jQuery/1.3.2/README +67 -0
- data/test/vendor/jQuery/1.3.2/build/ant-contrib-0.6.jar +0 -0
- data/test/vendor/jQuery/1.3.2/build/build/min.js +11 -0
- data/test/vendor/jQuery/1.3.2/build/build/pack.js +19 -0
- data/test/vendor/jQuery/1.3.2/build/js/Packer.js +209 -0
- data/test/vendor/jQuery/1.3.2/build/js/ParseMaster.js +106 -0
- data/test/vendor/jQuery/1.3.2/build/js/Words.js +62 -0
- data/test/vendor/jQuery/1.3.2/build/js/base2.js +978 -0
- data/test/vendor/jQuery/1.3.2/build/js/jsmin.js +316 -0
- data/test/vendor/jQuery/1.3.2/build/js/json.js +117 -0
- data/test/vendor/jQuery/1.3.2/build/js/pack.js +316 -0
- data/test/vendor/jQuery/1.3.2/build/js/parse.js +105 -0
- data/test/vendor/jQuery/1.3.2/build/js/writeFile.js +19 -0
- data/test/vendor/jQuery/1.3.2/build/js/xml.js +25 -0
- data/test/vendor/jQuery/1.3.2/build/js.jar +0 -0
- data/test/vendor/jQuery/1.3.2/build/runtest/env.js +1 -0
- data/test/vendor/jQuery/1.3.2/build/runtest/test.js +106 -0
- data/test/vendor/jQuery/1.3.2/build/runtest/testrunner.js +197 -0
- data/test/vendor/jQuery/1.3.2/build/speed/benchmarker.css +65 -0
- data/test/vendor/jQuery/1.3.2/build/speed/benchmarker.js +181 -0
- data/test/vendor/jQuery/1.3.2/build/speed/index.html +72 -0
- data/test/vendor/jQuery/1.3.2/build/speed/jquery-basis.js +3549 -0
- data/test/vendor/jQuery/1.3.2/build/style.xsl +99 -0
- data/test/vendor/jQuery/1.3.2/build/yuicompressor-2.4.2.jar +0 -0
- data/test/vendor/jQuery/1.3.2/build.xml +123 -0
- data/test/vendor/jQuery/1.3.2/dist/jquery.js +4376 -0
- data/test/vendor/jQuery/1.3.2/reminder.txt +3 -0
- data/test/vendor/jQuery/1.3.2/src/ajax.js +541 -0
- data/test/vendor/jQuery/1.3.2/src/core.js +1255 -0
- data/test/vendor/jQuery/1.3.2/src/data.js +145 -0
- data/test/vendor/jQuery/1.3.2/src/dimensions.js +49 -0
- data/test/vendor/jQuery/1.3.2/src/event.js +684 -0
- data/test/vendor/jQuery/1.3.2/src/fx.js +407 -0
- data/test/vendor/jQuery/1.3.2/src/intro.js +13 -0
- data/test/vendor/jQuery/1.3.2/src/offset.js +155 -0
- data/test/vendor/jQuery/1.3.2/src/outro.js +1 -0
- data/test/vendor/jQuery/1.3.2/src/selector.js +1015 -0
- data/test/vendor/jQuery/1.3.2/src/support.js +112 -0
- data/test/vendor/jQuery/1.3.2/test/data/cow.jpg +0 -0
- data/test/vendor/jQuery/1.3.2/test/data/dashboard.xml +11 -0
- data/test/vendor/jQuery/1.3.2/test/data/echoQuery.php +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/iframe.html +8 -0
- data/test/vendor/jQuery/1.3.2/test/data/json.php +9 -0
- data/test/vendor/jQuery/1.3.2/test/data/json_assigned_obj.js +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/json_obj.js +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/jsonp.php +10 -0
- data/test/vendor/jQuery/1.3.2/test/data/name.html +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/name.php +29 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/absolute.html +39 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/body.html +24 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/fixed.html +33 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/relative.html +31 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/scroll.html +39 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/static.html +31 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/table.html +43 -0
- data/test/vendor/jQuery/1.3.2/test/data/params_html.php +12 -0
- data/test/vendor/jQuery/1.3.2/test/data/test.html +7 -0
- data/test/vendor/jQuery/1.3.2/test/data/test.js +3 -0
- data/test/vendor/jQuery/1.3.2/test/data/test.php +7 -0
- data/test/vendor/jQuery/1.3.2/test/data/test2.html +5 -0
- data/test/vendor/jQuery/1.3.2/test/data/test3.html +3 -0
- data/test/vendor/jQuery/1.3.2/test/data/testrunner.js +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/text.php +12 -0
- data/test/vendor/jQuery/1.3.2/test/data/with_fries.xml +25 -0
- data/test/vendor/jQuery/1.3.2/test/index.html +229 -0
- data/test/vendor/jQuery/1.3.2/test/jqenv-1259090275493.html +247 -0
- data/test/vendor/jQuery/1.3.2/test/jqenv-1259091671501.html +247 -0
- data/test/vendor/jQuery/1.3.2/test/jqenv-1259175319655.html +247 -0
- data/test/vendor/jQuery/1.3.2/test/offset.html +28 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/jquery/1.2.1/jquery.js +11 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/jquery/1.2.3/jquery.js +11 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/mootools/1.11/mootools.js +1577 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/prototype/1.6.0.2/prototype.js +4221 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/builder.js +131 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/controls.js +835 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/dragdrop.js +944 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/effects.js +1090 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/scriptaculous.js +51 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/slider.js +278 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/unittest.js +564 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/builder.js +136 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/controls.js +965 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/dragdrop.js +974 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/effects.js +1122 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/scriptaculous.js +58 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/slider.js +275 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/sound.js +55 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/unittest.js +568 -0
- data/test/vendor/jQuery/1.3.2/test/polluted.php +64 -0
- data/test/vendor/jQuery/1.3.2/test/qunit/testrunner.js +780 -0
- data/test/vendor/jQuery/1.3.2/test/qunit/testsuite.css +120 -0
- data/test/vendor/jQuery/1.3.2/test/test.js +41 -0
- data/test/vendor/jQuery/1.3.2/test/unit/ajax.js +856 -0
- data/test/vendor/jQuery/1.3.2/test/unit/core.js +1872 -0
- data/test/vendor/jQuery/1.3.2/test/unit/data.js +160 -0
- data/test/vendor/jQuery/1.3.2/test/unit/dimensions.js +86 -0
- data/test/vendor/jQuery/1.3.2/test/unit/event.js +670 -0
- data/test/vendor/jQuery/1.3.2/test/unit/fx.js +451 -0
- data/test/vendor/jQuery/1.3.2/test/unit/offset.js +173 -0
- data/test/vendor/jQuery/1.3.2/test/unit/selector.js +395 -0
- data/test/vendor/jQuery/1.3.2/test/xhtml.php +5 -0
- data/test/vendor/jQuery/1.3.2/version.txt +1 -0
- metadata +158 -22
- data/lib/envjs/runtime.rb.smp +0 -133
- data/test/envjs-call-load-test.js +0 -5
- data/test/envjs-prototype.js +0 -5
- data/test/qunit/package.json +0 -21
- data/test/qunit/test/index.html +0 -17
- data/test/qunit/test/same.js +0 -1368
- data/test/qunit/test/test.js +0 -136
- data/test/qunit.smp/package.json +0 -21
- data/test/qunit.smp/test/index.html +0 -17
- data/test/qunit.smp/test/same.js +0 -1368
- data/test/qunit.smp/test/test.js +0 -136
- data/test/rhino-call-load-test.js +0 -5
- data/test/rhino-prototype.js +0 -5
- data/test/test-with-envs-jar.js +0 -8
- data/test/test-with-rhino-jar.js +0 -9
@@ -0,0 +1,1255 @@
|
|
1
|
+
var
|
2
|
+
// Will speed up references to window, and allows munging its name.
|
3
|
+
window = this,
|
4
|
+
// Will speed up references to undefined, and allows munging its name.
|
5
|
+
undefined,
|
6
|
+
// Map over jQuery in case of overwrite
|
7
|
+
_jQuery = window.jQuery,
|
8
|
+
// Map over the $ in case of overwrite
|
9
|
+
_$ = window.$,
|
10
|
+
|
11
|
+
jQuery = window.jQuery = window.$ = function( selector, context ) {
|
12
|
+
// The jQuery object is actually just the init constructor 'enhanced'
|
13
|
+
return new jQuery.fn.init( selector, context );
|
14
|
+
},
|
15
|
+
|
16
|
+
// A simple way to check for HTML strings or ID strings
|
17
|
+
// (both of which we optimize for)
|
18
|
+
quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
|
19
|
+
// Is it a simple selector
|
20
|
+
isSimple = /^.[^:#\[\.,]*$/;
|
21
|
+
|
22
|
+
jQuery.fn = jQuery.prototype = {
|
23
|
+
init: function( selector, context ) {
|
24
|
+
// Make sure that a selection was provided
|
25
|
+
selector = selector || document;
|
26
|
+
|
27
|
+
// Handle $(DOMElement)
|
28
|
+
if ( selector.nodeType ) {
|
29
|
+
this[0] = selector;
|
30
|
+
this.length = 1;
|
31
|
+
this.context = selector;
|
32
|
+
return this;
|
33
|
+
}
|
34
|
+
// Handle HTML strings
|
35
|
+
if ( typeof selector === "string" ) {
|
36
|
+
// Are we dealing with HTML string or an ID?
|
37
|
+
var match = quickExpr.exec( selector );
|
38
|
+
|
39
|
+
// Verify a match, and that no context was specified for #id
|
40
|
+
if ( match && (match[1] || !context) ) {
|
41
|
+
|
42
|
+
// HANDLE: $(html) -> $(array)
|
43
|
+
if ( match[1] )
|
44
|
+
selector = jQuery.clean( [ match[1] ], context );
|
45
|
+
|
46
|
+
// HANDLE: $("#id")
|
47
|
+
else {
|
48
|
+
var elem = document.getElementById( match[3] );
|
49
|
+
|
50
|
+
// Handle the case where IE and Opera return items
|
51
|
+
// by name instead of ID
|
52
|
+
if ( elem && elem.id != match[3] )
|
53
|
+
return jQuery().find( selector );
|
54
|
+
|
55
|
+
// Otherwise, we inject the element directly into the jQuery object
|
56
|
+
var ret = jQuery( elem || [] );
|
57
|
+
ret.context = document;
|
58
|
+
ret.selector = selector;
|
59
|
+
return ret;
|
60
|
+
}
|
61
|
+
|
62
|
+
// HANDLE: $(expr, [context])
|
63
|
+
// (which is just equivalent to: $(content).find(expr)
|
64
|
+
} else
|
65
|
+
return jQuery( context ).find( selector );
|
66
|
+
|
67
|
+
// HANDLE: $(function)
|
68
|
+
// Shortcut for document ready
|
69
|
+
} else if ( jQuery.isFunction( selector ) )
|
70
|
+
return jQuery( document ).ready( selector );
|
71
|
+
|
72
|
+
// Make sure that old selector state is passed along
|
73
|
+
if ( selector.selector && selector.context ) {
|
74
|
+
this.selector = selector.selector;
|
75
|
+
this.context = selector.context;
|
76
|
+
}
|
77
|
+
|
78
|
+
return this.setArray(jQuery.isArray( selector ) ?
|
79
|
+
selector :
|
80
|
+
jQuery.makeArray(selector));
|
81
|
+
},
|
82
|
+
|
83
|
+
// Start with an empty selector
|
84
|
+
selector: "",
|
85
|
+
|
86
|
+
// The current version of jQuery being used
|
87
|
+
jquery: "@VERSION",
|
88
|
+
|
89
|
+
// The number of elements contained in the matched element set
|
90
|
+
size: function() {
|
91
|
+
return this.length;
|
92
|
+
},
|
93
|
+
|
94
|
+
// Get the Nth element in the matched element set OR
|
95
|
+
// Get the whole matched element set as a clean array
|
96
|
+
get: function( num ) {
|
97
|
+
return num === undefined ?
|
98
|
+
|
99
|
+
// Return a 'clean' array
|
100
|
+
Array.prototype.slice.call( this ) :
|
101
|
+
|
102
|
+
// Return just the object
|
103
|
+
this[ num ];
|
104
|
+
},
|
105
|
+
|
106
|
+
// Take an array of elements and push it onto the stack
|
107
|
+
// (returning the new matched element set)
|
108
|
+
pushStack: function( elems, name, selector ) {
|
109
|
+
// Build a new jQuery matched element set
|
110
|
+
var ret = jQuery( elems );
|
111
|
+
|
112
|
+
// Add the old object onto the stack (as a reference)
|
113
|
+
ret.prevObject = this;
|
114
|
+
|
115
|
+
ret.context = this.context;
|
116
|
+
|
117
|
+
if ( name === "find" )
|
118
|
+
ret.selector = this.selector + (this.selector ? " " : "") + selector;
|
119
|
+
else if ( name )
|
120
|
+
ret.selector = this.selector + "." + name + "(" + selector + ")";
|
121
|
+
|
122
|
+
// Return the newly-formed element set
|
123
|
+
return ret;
|
124
|
+
},
|
125
|
+
|
126
|
+
// Force the current matched set of elements to become
|
127
|
+
// the specified array of elements (destroying the stack in the process)
|
128
|
+
// You should use pushStack() in order to do this, but maintain the stack
|
129
|
+
setArray: function( elems ) {
|
130
|
+
// Resetting the length to 0, then using the native Array push
|
131
|
+
// is a super-fast way to populate an object with array-like properties
|
132
|
+
this.length = 0;
|
133
|
+
Array.prototype.push.apply( this, elems );
|
134
|
+
|
135
|
+
return this;
|
136
|
+
},
|
137
|
+
|
138
|
+
// Execute a callback for every element in the matched set.
|
139
|
+
// (You can seed the arguments with an array of args, but this is
|
140
|
+
// only used internally.)
|
141
|
+
each: function( callback, args ) {
|
142
|
+
return jQuery.each( this, callback, args );
|
143
|
+
},
|
144
|
+
|
145
|
+
// Determine the position of an element within
|
146
|
+
// the matched set of elements
|
147
|
+
index: function( elem ) {
|
148
|
+
// Locate the position of the desired element
|
149
|
+
return jQuery.inArray(
|
150
|
+
// If it receives a jQuery object, the first element is used
|
151
|
+
elem && elem.jquery ? elem[0] : elem
|
152
|
+
, this );
|
153
|
+
},
|
154
|
+
|
155
|
+
attr: function( name, value, type ) {
|
156
|
+
var options = name;
|
157
|
+
|
158
|
+
// Look for the case where we're accessing a style value
|
159
|
+
if ( typeof name === "string" )
|
160
|
+
if ( value === undefined )
|
161
|
+
return this[0] && jQuery[ type || "attr" ]( this[0], name );
|
162
|
+
|
163
|
+
else {
|
164
|
+
options = {};
|
165
|
+
options[ name ] = value;
|
166
|
+
}
|
167
|
+
|
168
|
+
// Check to see if we're setting style values
|
169
|
+
return this.each(function(i){
|
170
|
+
// Set all the styles
|
171
|
+
for ( name in options )
|
172
|
+
jQuery.attr(
|
173
|
+
type ?
|
174
|
+
this.style :
|
175
|
+
this,
|
176
|
+
name, jQuery.prop( this, options[ name ], type, i, name )
|
177
|
+
);
|
178
|
+
});
|
179
|
+
},
|
180
|
+
|
181
|
+
css: function( key, value ) {
|
182
|
+
// ignore negative width and height values
|
183
|
+
if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
|
184
|
+
value = undefined;
|
185
|
+
return this.attr( key, value, "curCSS" );
|
186
|
+
},
|
187
|
+
|
188
|
+
text: function( text ) {
|
189
|
+
if ( typeof text !== "object" && text != null )
|
190
|
+
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
|
191
|
+
|
192
|
+
var ret = "";
|
193
|
+
|
194
|
+
jQuery.each( text || this, function(){
|
195
|
+
jQuery.each( this.childNodes, function(){
|
196
|
+
if ( this.nodeType != 8 )
|
197
|
+
ret += this.nodeType != 1 ?
|
198
|
+
this.nodeValue :
|
199
|
+
jQuery.fn.text( [ this ] );
|
200
|
+
});
|
201
|
+
});
|
202
|
+
|
203
|
+
return ret;
|
204
|
+
},
|
205
|
+
|
206
|
+
wrapAll: function( html ) {
|
207
|
+
if ( this[0] ) {
|
208
|
+
// The elements to wrap the target around
|
209
|
+
var wrap = jQuery( html, this[0].ownerDocument ).clone();
|
210
|
+
|
211
|
+
if ( this[0].parentNode )
|
212
|
+
wrap.insertBefore( this[0] );
|
213
|
+
|
214
|
+
wrap.map(function(){
|
215
|
+
var elem = this;
|
216
|
+
|
217
|
+
while ( elem.firstChild )
|
218
|
+
elem = elem.firstChild;
|
219
|
+
|
220
|
+
return elem;
|
221
|
+
}).append(this);
|
222
|
+
}
|
223
|
+
|
224
|
+
return this;
|
225
|
+
},
|
226
|
+
|
227
|
+
wrapInner: function( html ) {
|
228
|
+
return this.each(function(){
|
229
|
+
jQuery( this ).contents().wrapAll( html );
|
230
|
+
});
|
231
|
+
},
|
232
|
+
|
233
|
+
wrap: function( html ) {
|
234
|
+
return this.each(function(){
|
235
|
+
jQuery( this ).wrapAll( html );
|
236
|
+
});
|
237
|
+
},
|
238
|
+
|
239
|
+
append: function() {
|
240
|
+
return this.domManip(arguments, true, function(elem){
|
241
|
+
if (this.nodeType == 1)
|
242
|
+
this.appendChild( elem );
|
243
|
+
});
|
244
|
+
},
|
245
|
+
|
246
|
+
prepend: function() {
|
247
|
+
return this.domManip(arguments, true, function(elem){
|
248
|
+
if (this.nodeType == 1)
|
249
|
+
this.insertBefore( elem, this.firstChild );
|
250
|
+
});
|
251
|
+
},
|
252
|
+
|
253
|
+
before: function() {
|
254
|
+
return this.domManip(arguments, false, function(elem){
|
255
|
+
this.parentNode.insertBefore( elem, this );
|
256
|
+
});
|
257
|
+
},
|
258
|
+
|
259
|
+
after: function() {
|
260
|
+
return this.domManip(arguments, false, function(elem){
|
261
|
+
this.parentNode.insertBefore( elem, this.nextSibling );
|
262
|
+
});
|
263
|
+
},
|
264
|
+
|
265
|
+
end: function() {
|
266
|
+
return this.prevObject || jQuery( [] );
|
267
|
+
},
|
268
|
+
|
269
|
+
// For internal use only.
|
270
|
+
// Behaves like an Array's method, not like a jQuery method.
|
271
|
+
push: [].push,
|
272
|
+
sort: [].sort,
|
273
|
+
splice: [].splice,
|
274
|
+
|
275
|
+
find: function( selector ) {
|
276
|
+
if ( this.length === 1 ) {
|
277
|
+
var ret = this.pushStack( [], "find", selector );
|
278
|
+
ret.length = 0;
|
279
|
+
jQuery.find( selector, this[0], ret );
|
280
|
+
return ret;
|
281
|
+
} else {
|
282
|
+
return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){
|
283
|
+
return jQuery.find( selector, elem );
|
284
|
+
})), "find", selector );
|
285
|
+
}
|
286
|
+
},
|
287
|
+
|
288
|
+
clone: function( events ) {
|
289
|
+
// Do the clone
|
290
|
+
var ret = this.map(function(){
|
291
|
+
if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
|
292
|
+
// IE copies events bound via attachEvent when
|
293
|
+
// using cloneNode. Calling detachEvent on the
|
294
|
+
// clone will also remove the events from the orignal
|
295
|
+
// In order to get around this, we use innerHTML.
|
296
|
+
// Unfortunately, this means some modifications to
|
297
|
+
// attributes in IE that are actually only stored
|
298
|
+
// as properties will not be copied (such as the
|
299
|
+
// the name attribute on an input).
|
300
|
+
var html = this.outerHTML;
|
301
|
+
if ( !html ) {
|
302
|
+
var div = this.ownerDocument.createElement("div");
|
303
|
+
div.appendChild( this.cloneNode(true) );
|
304
|
+
html = div.innerHTML;
|
305
|
+
}
|
306
|
+
|
307
|
+
return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];
|
308
|
+
} else
|
309
|
+
return this.cloneNode(true);
|
310
|
+
});
|
311
|
+
|
312
|
+
// Copy the events from the original to the clone
|
313
|
+
if ( events === true ) {
|
314
|
+
var orig = this.find("*").andSelf(), i = 0;
|
315
|
+
|
316
|
+
ret.find("*").andSelf().each(function(){
|
317
|
+
if ( this.nodeName !== orig[i].nodeName )
|
318
|
+
return;
|
319
|
+
|
320
|
+
var events = jQuery.data( orig[i], "events" );
|
321
|
+
|
322
|
+
for ( var type in events ) {
|
323
|
+
for ( var handler in events[ type ] ) {
|
324
|
+
jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
|
325
|
+
}
|
326
|
+
}
|
327
|
+
|
328
|
+
i++;
|
329
|
+
});
|
330
|
+
}
|
331
|
+
|
332
|
+
// Return the cloned set
|
333
|
+
return ret;
|
334
|
+
},
|
335
|
+
|
336
|
+
filter: function( selector ) {
|
337
|
+
return this.pushStack(
|
338
|
+
jQuery.isFunction( selector ) &&
|
339
|
+
jQuery.grep(this, function(elem, i){
|
340
|
+
return selector.call( elem, i );
|
341
|
+
}) ||
|
342
|
+
|
343
|
+
jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
|
344
|
+
return elem.nodeType === 1;
|
345
|
+
}) ), "filter", selector );
|
346
|
+
},
|
347
|
+
|
348
|
+
closest: function( selector ) {
|
349
|
+
var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,
|
350
|
+
closer = 0;
|
351
|
+
|
352
|
+
return this.map(function(){
|
353
|
+
var cur = this;
|
354
|
+
while ( cur && cur.ownerDocument ) {
|
355
|
+
if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
|
356
|
+
jQuery.data(cur, "closest", closer);
|
357
|
+
return cur;
|
358
|
+
}
|
359
|
+
cur = cur.parentNode;
|
360
|
+
closer++;
|
361
|
+
}
|
362
|
+
});
|
363
|
+
},
|
364
|
+
|
365
|
+
not: function( selector ) {
|
366
|
+
if ( typeof selector === "string" )
|
367
|
+
// test special case where just one selector is passed in
|
368
|
+
if ( isSimple.test( selector ) )
|
369
|
+
return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector );
|
370
|
+
else
|
371
|
+
selector = jQuery.multiFilter( selector, this );
|
372
|
+
|
373
|
+
var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
|
374
|
+
return this.filter(function() {
|
375
|
+
return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
|
376
|
+
});
|
377
|
+
},
|
378
|
+
|
379
|
+
add: function( selector ) {
|
380
|
+
return this.pushStack( jQuery.unique( jQuery.merge(
|
381
|
+
this.get(),
|
382
|
+
typeof selector === "string" ?
|
383
|
+
jQuery( selector ) :
|
384
|
+
jQuery.makeArray( selector )
|
385
|
+
)));
|
386
|
+
},
|
387
|
+
|
388
|
+
is: function( selector ) {
|
389
|
+
return !!selector && jQuery.multiFilter( selector, this ).length > 0;
|
390
|
+
},
|
391
|
+
|
392
|
+
hasClass: function( selector ) {
|
393
|
+
return !!selector && this.is( "." + selector );
|
394
|
+
},
|
395
|
+
|
396
|
+
val: function( value ) {
|
397
|
+
if ( value === undefined ) {
|
398
|
+
var elem = this[0];
|
399
|
+
|
400
|
+
if ( elem ) {
|
401
|
+
if( jQuery.nodeName( elem, 'option' ) )
|
402
|
+
return (elem.attributes.value || {}).specified ? elem.value : elem.text;
|
403
|
+
|
404
|
+
// We need to handle select boxes special
|
405
|
+
if ( jQuery.nodeName( elem, "select" ) ) {
|
406
|
+
var index = elem.selectedIndex,
|
407
|
+
values = [],
|
408
|
+
options = elem.options,
|
409
|
+
one = elem.type == "select-one";
|
410
|
+
|
411
|
+
// Nothing was selected
|
412
|
+
if ( index < 0 )
|
413
|
+
return null;
|
414
|
+
|
415
|
+
// Loop through all the selected options
|
416
|
+
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
|
417
|
+
var option = options[ i ];
|
418
|
+
|
419
|
+
if ( option.selected ) {
|
420
|
+
// Get the specifc value for the option
|
421
|
+
value = jQuery(option).val();
|
422
|
+
|
423
|
+
// We don't need an array for one selects
|
424
|
+
if ( one )
|
425
|
+
return value;
|
426
|
+
|
427
|
+
// Multi-Selects return an array
|
428
|
+
values.push( value );
|
429
|
+
}
|
430
|
+
}
|
431
|
+
|
432
|
+
return values;
|
433
|
+
}
|
434
|
+
|
435
|
+
// Everything else, we just grab the value
|
436
|
+
return (elem.value || "").replace(/\r/g, "");
|
437
|
+
|
438
|
+
}
|
439
|
+
|
440
|
+
return undefined;
|
441
|
+
}
|
442
|
+
|
443
|
+
if ( typeof value === "number" )
|
444
|
+
value += '';
|
445
|
+
|
446
|
+
return this.each(function(){
|
447
|
+
if ( this.nodeType != 1 )
|
448
|
+
return;
|
449
|
+
|
450
|
+
if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )
|
451
|
+
this.checked = (jQuery.inArray(this.value, value) >= 0 ||
|
452
|
+
jQuery.inArray(this.name, value) >= 0);
|
453
|
+
|
454
|
+
else if ( jQuery.nodeName( this, "select" ) ) {
|
455
|
+
var values = jQuery.makeArray(value);
|
456
|
+
|
457
|
+
jQuery( "option", this ).each(function(){
|
458
|
+
this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
|
459
|
+
jQuery.inArray( this.text, values ) >= 0);
|
460
|
+
});
|
461
|
+
|
462
|
+
if ( !values.length )
|
463
|
+
this.selectedIndex = -1;
|
464
|
+
|
465
|
+
} else
|
466
|
+
this.value = value;
|
467
|
+
});
|
468
|
+
},
|
469
|
+
|
470
|
+
html: function( value ) {
|
471
|
+
return value === undefined ?
|
472
|
+
(this[0] ?
|
473
|
+
this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
|
474
|
+
null) :
|
475
|
+
this.empty().append( value );
|
476
|
+
},
|
477
|
+
|
478
|
+
replaceWith: function( value ) {
|
479
|
+
return this.after( value ).remove();
|
480
|
+
},
|
481
|
+
|
482
|
+
eq: function( i ) {
|
483
|
+
return this.slice( i, +i + 1 );
|
484
|
+
},
|
485
|
+
|
486
|
+
slice: function() {
|
487
|
+
return this.pushStack( Array.prototype.slice.apply( this, arguments ),
|
488
|
+
"slice", Array.prototype.slice.call(arguments).join(",") );
|
489
|
+
},
|
490
|
+
|
491
|
+
map: function( callback ) {
|
492
|
+
return this.pushStack( jQuery.map(this, function(elem, i){
|
493
|
+
return callback.call( elem, i, elem );
|
494
|
+
}));
|
495
|
+
},
|
496
|
+
|
497
|
+
andSelf: function() {
|
498
|
+
return this.add( this.prevObject );
|
499
|
+
},
|
500
|
+
|
501
|
+
domManip: function( args, table, callback ) {
|
502
|
+
if ( this[0] ) {
|
503
|
+
var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
|
504
|
+
scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
|
505
|
+
first = fragment.firstChild;
|
506
|
+
|
507
|
+
if ( first )
|
508
|
+
for ( var i = 0, l = this.length; i < l; i++ )
|
509
|
+
callback.call( root(this[i], first), this.length > 1 || i > 0 ?
|
510
|
+
fragment.cloneNode(true) : fragment );
|
511
|
+
|
512
|
+
if ( scripts )
|
513
|
+
jQuery.each( scripts, evalScript );
|
514
|
+
}
|
515
|
+
|
516
|
+
return this;
|
517
|
+
|
518
|
+
function root( elem, cur ) {
|
519
|
+
return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
|
520
|
+
(elem.getElementsByTagName("tbody")[0] ||
|
521
|
+
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
|
522
|
+
elem;
|
523
|
+
}
|
524
|
+
}
|
525
|
+
};
|
526
|
+
|
527
|
+
// Give the init function the jQuery prototype for later instantiation
|
528
|
+
jQuery.fn.init.prototype = jQuery.fn;
|
529
|
+
|
530
|
+
function evalScript( i, elem ) {
|
531
|
+
if ( elem.src )
|
532
|
+
jQuery.ajax({
|
533
|
+
url: elem.src,
|
534
|
+
async: false,
|
535
|
+
dataType: "script"
|
536
|
+
});
|
537
|
+
|
538
|
+
else
|
539
|
+
jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
|
540
|
+
|
541
|
+
if ( elem.parentNode )
|
542
|
+
elem.parentNode.removeChild( elem );
|
543
|
+
}
|
544
|
+
|
545
|
+
function now(){
|
546
|
+
return +new Date;
|
547
|
+
}
|
548
|
+
|
549
|
+
jQuery.extend = jQuery.fn.extend = function() {
|
550
|
+
// copy reference to target object
|
551
|
+
var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
|
552
|
+
|
553
|
+
// Handle a deep copy situation
|
554
|
+
if ( typeof target === "boolean" ) {
|
555
|
+
deep = target;
|
556
|
+
target = arguments[1] || {};
|
557
|
+
// skip the boolean and the target
|
558
|
+
i = 2;
|
559
|
+
}
|
560
|
+
|
561
|
+
// Handle case when target is a string or something (possible in deep copy)
|
562
|
+
if ( typeof target !== "object" && !jQuery.isFunction(target) )
|
563
|
+
target = {};
|
564
|
+
|
565
|
+
// extend jQuery itself if only one argument is passed
|
566
|
+
if ( length == i ) {
|
567
|
+
target = this;
|
568
|
+
--i;
|
569
|
+
}
|
570
|
+
|
571
|
+
for ( ; i < length; i++ )
|
572
|
+
// Only deal with non-null/undefined values
|
573
|
+
if ( (options = arguments[ i ]) != null )
|
574
|
+
// Extend the base object
|
575
|
+
for ( var name in options ) {
|
576
|
+
var src = target[ name ], copy = options[ name ];
|
577
|
+
|
578
|
+
// Prevent never-ending loop
|
579
|
+
if ( target === copy )
|
580
|
+
continue;
|
581
|
+
|
582
|
+
// Recurse if we're merging object values
|
583
|
+
if ( deep && copy && typeof copy === "object" && !copy.nodeType )
|
584
|
+
target[ name ] = jQuery.extend( deep,
|
585
|
+
// Never move original objects, clone them
|
586
|
+
src || ( copy.length != null ? [ ] : { } )
|
587
|
+
, copy );
|
588
|
+
|
589
|
+
// Don't bring in undefined values
|
590
|
+
else if ( copy !== undefined )
|
591
|
+
target[ name ] = copy;
|
592
|
+
|
593
|
+
}
|
594
|
+
|
595
|
+
// Return the modified object
|
596
|
+
return target;
|
597
|
+
};
|
598
|
+
|
599
|
+
// exclude the following css properties to add px
|
600
|
+
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
|
601
|
+
// cache defaultView
|
602
|
+
defaultView = document.defaultView || {},
|
603
|
+
toString = Object.prototype.toString;
|
604
|
+
|
605
|
+
jQuery.extend({
|
606
|
+
noConflict: function( deep ) {
|
607
|
+
window.$ = _$;
|
608
|
+
|
609
|
+
if ( deep )
|
610
|
+
window.jQuery = _jQuery;
|
611
|
+
|
612
|
+
return jQuery;
|
613
|
+
},
|
614
|
+
|
615
|
+
// See test/unit/core.js for details concerning isFunction.
|
616
|
+
// Since version 1.3, DOM methods and functions like alert
|
617
|
+
// aren't supported. They return false on IE (#2968).
|
618
|
+
isFunction: function( obj ) {
|
619
|
+
return toString.call(obj) === "[object Function]";
|
620
|
+
},
|
621
|
+
|
622
|
+
isArray: function( obj ) {
|
623
|
+
return toString.call(obj) === "[object Array]";
|
624
|
+
},
|
625
|
+
|
626
|
+
// check if an element is in a (or is an) XML document
|
627
|
+
isXMLDoc: function( elem ) {
|
628
|
+
return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
|
629
|
+
!!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );
|
630
|
+
},
|
631
|
+
|
632
|
+
// Evalulates a script in a global context
|
633
|
+
globalEval: function( data ) {
|
634
|
+
if ( data && /\S/.test(data) ) {
|
635
|
+
// Inspired by code by Andrea Giammarchi
|
636
|
+
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
|
637
|
+
var head = document.getElementsByTagName("head")[0] || document.documentElement,
|
638
|
+
script = document.createElement("script");
|
639
|
+
|
640
|
+
script.type = "text/javascript";
|
641
|
+
if ( jQuery.support.scriptEval )
|
642
|
+
script.appendChild( document.createTextNode( data ) );
|
643
|
+
else
|
644
|
+
script.text = data;
|
645
|
+
|
646
|
+
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
|
647
|
+
// This arises when a base node is used (#2709).
|
648
|
+
head.insertBefore( script, head.firstChild );
|
649
|
+
head.removeChild( script );
|
650
|
+
}
|
651
|
+
},
|
652
|
+
|
653
|
+
nodeName: function( elem, name ) {
|
654
|
+
return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
|
655
|
+
},
|
656
|
+
|
657
|
+
// args is for internal usage only
|
658
|
+
each: function( object, callback, args ) {
|
659
|
+
var name, i = 0, length = object.length;
|
660
|
+
|
661
|
+
if ( args ) {
|
662
|
+
if ( length === undefined ) {
|
663
|
+
for ( name in object )
|
664
|
+
if ( callback.apply( object[ name ], args ) === false )
|
665
|
+
break;
|
666
|
+
} else
|
667
|
+
for ( ; i < length; )
|
668
|
+
if ( callback.apply( object[ i++ ], args ) === false )
|
669
|
+
break;
|
670
|
+
|
671
|
+
// A special, fast, case for the most common use of each
|
672
|
+
} else {
|
673
|
+
if ( length === undefined ) {
|
674
|
+
for ( name in object )
|
675
|
+
if ( callback.call( object[ name ], name, object[ name ] ) === false )
|
676
|
+
break;
|
677
|
+
} else
|
678
|
+
for ( var value = object[0];
|
679
|
+
i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
|
680
|
+
}
|
681
|
+
|
682
|
+
return object;
|
683
|
+
},
|
684
|
+
|
685
|
+
prop: function( elem, value, type, i, name ) {
|
686
|
+
// Handle executable functions
|
687
|
+
if ( jQuery.isFunction( value ) )
|
688
|
+
value = value.call( elem, i );
|
689
|
+
|
690
|
+
// Handle passing in a number to a CSS property
|
691
|
+
return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?
|
692
|
+
value + "px" :
|
693
|
+
value;
|
694
|
+
},
|
695
|
+
|
696
|
+
className: {
|
697
|
+
// internal only, use addClass("class")
|
698
|
+
add: function( elem, classNames ) {
|
699
|
+
jQuery.each((classNames || "").split(/\s+/), function(i, className){
|
700
|
+
if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
|
701
|
+
elem.className += (elem.className ? " " : "") + className;
|
702
|
+
});
|
703
|
+
},
|
704
|
+
|
705
|
+
// internal only, use removeClass("class")
|
706
|
+
remove: function( elem, classNames ) {
|
707
|
+
if (elem.nodeType == 1)
|
708
|
+
elem.className = classNames !== undefined ?
|
709
|
+
jQuery.grep(elem.className.split(/\s+/), function(className){
|
710
|
+
return !jQuery.className.has( classNames, className );
|
711
|
+
}).join(" ") :
|
712
|
+
"";
|
713
|
+
},
|
714
|
+
|
715
|
+
// internal only, use hasClass("class")
|
716
|
+
has: function( elem, className ) {
|
717
|
+
return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
|
718
|
+
}
|
719
|
+
},
|
720
|
+
|
721
|
+
// A method for quickly swapping in/out CSS properties to get correct calculations
|
722
|
+
swap: function( elem, options, callback ) {
|
723
|
+
var old = {};
|
724
|
+
// Remember the old values, and insert the new ones
|
725
|
+
for ( var name in options ) {
|
726
|
+
old[ name ] = elem.style[ name ];
|
727
|
+
elem.style[ name ] = options[ name ];
|
728
|
+
}
|
729
|
+
|
730
|
+
callback.call( elem );
|
731
|
+
|
732
|
+
// Revert the old values
|
733
|
+
for ( var name in options )
|
734
|
+
elem.style[ name ] = old[ name ];
|
735
|
+
},
|
736
|
+
|
737
|
+
css: function( elem, name, force, extra ) {
|
738
|
+
if ( name == "width" || name == "height" ) {
|
739
|
+
var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
|
740
|
+
|
741
|
+
function getWH() {
|
742
|
+
val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
|
743
|
+
|
744
|
+
if ( extra === "border" )
|
745
|
+
return;
|
746
|
+
|
747
|
+
jQuery.each( which, function() {
|
748
|
+
if ( !extra )
|
749
|
+
val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
|
750
|
+
if ( extra === "margin" )
|
751
|
+
val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
|
752
|
+
else
|
753
|
+
val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
|
754
|
+
});
|
755
|
+
}
|
756
|
+
|
757
|
+
if ( elem.offsetWidth !== 0 )
|
758
|
+
getWH();
|
759
|
+
else
|
760
|
+
jQuery.swap( elem, props, getWH );
|
761
|
+
|
762
|
+
return Math.max(0, Math.round(val));
|
763
|
+
}
|
764
|
+
|
765
|
+
return jQuery.curCSS( elem, name, force );
|
766
|
+
},
|
767
|
+
|
768
|
+
curCSS: function( elem, name, force ) {
|
769
|
+
var ret, style = elem.style;
|
770
|
+
|
771
|
+
// We need to handle opacity special in IE
|
772
|
+
if ( name == "opacity" && !jQuery.support.opacity ) {
|
773
|
+
ret = jQuery.attr( style, "opacity" );
|
774
|
+
|
775
|
+
return ret == "" ?
|
776
|
+
"1" :
|
777
|
+
ret;
|
778
|
+
}
|
779
|
+
|
780
|
+
// Make sure we're using the right name for getting the float value
|
781
|
+
if ( name.match( /float/i ) )
|
782
|
+
name = styleFloat;
|
783
|
+
|
784
|
+
if ( !force && style && style[ name ] )
|
785
|
+
ret = style[ name ];
|
786
|
+
|
787
|
+
else if ( defaultView.getComputedStyle ) {
|
788
|
+
|
789
|
+
// Only "float" is needed here
|
790
|
+
if ( name.match( /float/i ) )
|
791
|
+
name = "float";
|
792
|
+
|
793
|
+
name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
|
794
|
+
|
795
|
+
var computedStyle = defaultView.getComputedStyle( elem, null );
|
796
|
+
|
797
|
+
if ( computedStyle )
|
798
|
+
ret = computedStyle.getPropertyValue( name );
|
799
|
+
|
800
|
+
// We should always get a number back from opacity
|
801
|
+
if ( name == "opacity" && ret == "" )
|
802
|
+
ret = "1";
|
803
|
+
|
804
|
+
} else if ( elem.currentStyle ) {
|
805
|
+
var camelCase = name.replace(/\-(\w)/g, function(all, letter){
|
806
|
+
return letter.toUpperCase();
|
807
|
+
});
|
808
|
+
|
809
|
+
ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
|
810
|
+
|
811
|
+
// From the awesome hack by Dean Edwards
|
812
|
+
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
|
813
|
+
|
814
|
+
// If we're not dealing with a regular pixel number
|
815
|
+
// but a number that has a weird ending, we need to convert it to pixels
|
816
|
+
if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
|
817
|
+
// Remember the original values
|
818
|
+
var left = style.left, rsLeft = elem.runtimeStyle.left;
|
819
|
+
|
820
|
+
// Put in the new values to get a computed value out
|
821
|
+
elem.runtimeStyle.left = elem.currentStyle.left;
|
822
|
+
style.left = ret || 0;
|
823
|
+
ret = style.pixelLeft + "px";
|
824
|
+
|
825
|
+
// Revert the changed values
|
826
|
+
style.left = left;
|
827
|
+
elem.runtimeStyle.left = rsLeft;
|
828
|
+
}
|
829
|
+
}
|
830
|
+
|
831
|
+
return ret;
|
832
|
+
},
|
833
|
+
|
834
|
+
clean: function( elems, context, fragment ) {
|
835
|
+
context = context || document;
|
836
|
+
|
837
|
+
// !context.createElement fails in IE with an error but returns typeof 'object'
|
838
|
+
if ( typeof context.createElement === "undefined" )
|
839
|
+
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
|
840
|
+
|
841
|
+
// If a single string is passed in and it's a single tag
|
842
|
+
// just do a createElement and skip the rest
|
843
|
+
if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
|
844
|
+
var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
|
845
|
+
if ( match )
|
846
|
+
return [ context.createElement( match[1] ) ];
|
847
|
+
}
|
848
|
+
|
849
|
+
var ret = [], scripts = [], div = context.createElement("div");
|
850
|
+
|
851
|
+
jQuery.each(elems, function(i, elem){
|
852
|
+
if ( typeof elem === "number" )
|
853
|
+
elem += '';
|
854
|
+
|
855
|
+
if ( !elem )
|
856
|
+
return;
|
857
|
+
|
858
|
+
// Convert html string into DOM nodes
|
859
|
+
if ( typeof elem === "string" ) {
|
860
|
+
// Fix "XHTML"-style tags in all browsers
|
861
|
+
elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
|
862
|
+
return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
|
863
|
+
all :
|
864
|
+
front + "></" + tag + ">";
|
865
|
+
});
|
866
|
+
|
867
|
+
// Trim whitespace, otherwise indexOf won't work as expected
|
868
|
+
var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase();
|
869
|
+
|
870
|
+
var wrap =
|
871
|
+
// option or optgroup
|
872
|
+
!tags.indexOf("<opt") &&
|
873
|
+
[ 1, "<select multiple='multiple'>", "</select>" ] ||
|
874
|
+
|
875
|
+
!tags.indexOf("<leg") &&
|
876
|
+
[ 1, "<fieldset>", "</fieldset>" ] ||
|
877
|
+
|
878
|
+
tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
|
879
|
+
[ 1, "<table>", "</table>" ] ||
|
880
|
+
|
881
|
+
!tags.indexOf("<tr") &&
|
882
|
+
[ 2, "<table><tbody>", "</tbody></table>" ] ||
|
883
|
+
|
884
|
+
// <thead> matched above
|
885
|
+
(!tags.indexOf("<td") || !tags.indexOf("<th")) &&
|
886
|
+
[ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
|
887
|
+
|
888
|
+
!tags.indexOf("<col") &&
|
889
|
+
[ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
|
890
|
+
|
891
|
+
// IE can't serialize <link> and <script> tags normally
|
892
|
+
!jQuery.support.htmlSerialize &&
|
893
|
+
[ 1, "div<div>", "</div>" ] ||
|
894
|
+
|
895
|
+
[ 0, "", "" ];
|
896
|
+
|
897
|
+
// Go to html and back, then peel off extra wrappers
|
898
|
+
div.innerHTML = wrap[1] + elem + wrap[2];
|
899
|
+
|
900
|
+
// Move to the right depth
|
901
|
+
while ( wrap[0]-- )
|
902
|
+
div = div.lastChild;
|
903
|
+
|
904
|
+
// Remove IE's autoinserted <tbody> from table fragments
|
905
|
+
if ( !jQuery.support.tbody ) {
|
906
|
+
|
907
|
+
// String was a <table>, *may* have spurious <tbody>
|
908
|
+
var hasBody = /<tbody/i.test(elem),
|
909
|
+
tbody = !tags.indexOf("<table") && !hasBody ?
|
910
|
+
div.firstChild && div.firstChild.childNodes :
|
911
|
+
|
912
|
+
// String was a bare <thead> or <tfoot>
|
913
|
+
wrap[1] == "<table>" && !hasBody ?
|
914
|
+
div.childNodes :
|
915
|
+
[];
|
916
|
+
|
917
|
+
for ( var j = tbody.length - 1; j >= 0 ; --j )
|
918
|
+
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
|
919
|
+
tbody[ j ].parentNode.removeChild( tbody[ j ] );
|
920
|
+
|
921
|
+
}
|
922
|
+
|
923
|
+
// IE completely kills leading whitespace when innerHTML is used
|
924
|
+
if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )
|
925
|
+
div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
|
926
|
+
|
927
|
+
elem = jQuery.makeArray( div.childNodes );
|
928
|
+
}
|
929
|
+
|
930
|
+
if ( elem.nodeType )
|
931
|
+
ret.push( elem );
|
932
|
+
else
|
933
|
+
ret = jQuery.merge( ret, elem );
|
934
|
+
|
935
|
+
});
|
936
|
+
|
937
|
+
if ( fragment ) {
|
938
|
+
for ( var i = 0; ret[i]; i++ ) {
|
939
|
+
if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
|
940
|
+
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
|
941
|
+
} else {
|
942
|
+
if ( ret[i].nodeType === 1 )
|
943
|
+
ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
|
944
|
+
fragment.appendChild( ret[i] );
|
945
|
+
}
|
946
|
+
}
|
947
|
+
|
948
|
+
return scripts;
|
949
|
+
}
|
950
|
+
|
951
|
+
return ret;
|
952
|
+
},
|
953
|
+
|
954
|
+
attr: function( elem, name, value ) {
|
955
|
+
// don't set attributes on text and comment nodes
|
956
|
+
if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
|
957
|
+
return undefined;
|
958
|
+
|
959
|
+
var notxml = !jQuery.isXMLDoc( elem ),
|
960
|
+
// Whether we are setting (or getting)
|
961
|
+
set = value !== undefined;
|
962
|
+
|
963
|
+
// Try to normalize/fix the name
|
964
|
+
name = notxml && jQuery.props[ name ] || name;
|
965
|
+
|
966
|
+
// Only do all the following if this is a node (faster for style)
|
967
|
+
// IE elem.getAttribute passes even for style
|
968
|
+
if ( elem.tagName ) {
|
969
|
+
|
970
|
+
// These attributes require special treatment
|
971
|
+
var special = /href|src|style/.test( name );
|
972
|
+
|
973
|
+
// Safari mis-reports the default selected property of a hidden option
|
974
|
+
// Accessing the parent's selectedIndex property fixes it
|
975
|
+
if ( name == "selected" && elem.parentNode )
|
976
|
+
elem.parentNode.selectedIndex;
|
977
|
+
|
978
|
+
// If applicable, access the attribute via the DOM 0 way
|
979
|
+
if ( name in elem && notxml && !special ) {
|
980
|
+
if ( set ){
|
981
|
+
// We can't allow the type property to be changed (since it causes problems in IE)
|
982
|
+
if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
|
983
|
+
throw "type property can't be changed";
|
984
|
+
|
985
|
+
elem[ name ] = value;
|
986
|
+
}
|
987
|
+
|
988
|
+
// browsers index elements by id/name on forms, give priority to attributes.
|
989
|
+
if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
|
990
|
+
return elem.getAttributeNode( name ).nodeValue;
|
991
|
+
|
992
|
+
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
|
993
|
+
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
994
|
+
if ( name == "tabIndex" ) {
|
995
|
+
var attributeNode = elem.getAttributeNode( "tabIndex" );
|
996
|
+
return attributeNode && attributeNode.specified
|
997
|
+
? attributeNode.value
|
998
|
+
: elem.nodeName.match(/(button|input|object|select|textarea)/i)
|
999
|
+
? 0
|
1000
|
+
: elem.nodeName.match(/^(a|area)$/i) && elem.href
|
1001
|
+
? 0
|
1002
|
+
: undefined;
|
1003
|
+
}
|
1004
|
+
|
1005
|
+
return elem[ name ];
|
1006
|
+
}
|
1007
|
+
|
1008
|
+
if ( !jQuery.support.style && notxml && name == "style" )
|
1009
|
+
return jQuery.attr( elem.style, "cssText", value );
|
1010
|
+
|
1011
|
+
if ( set )
|
1012
|
+
// convert the value to a string (all browsers do this but IE) see #1070
|
1013
|
+
elem.setAttribute( name, "" + value );
|
1014
|
+
|
1015
|
+
var attr = !jQuery.support.hrefNormalized && notxml && special
|
1016
|
+
// Some attributes require a special call on IE
|
1017
|
+
? elem.getAttribute( name, 2 )
|
1018
|
+
: elem.getAttribute( name );
|
1019
|
+
|
1020
|
+
// Non-existent attributes return null, we normalize to undefined
|
1021
|
+
return attr === null ? undefined : attr;
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
// elem is actually elem.style ... set the style
|
1025
|
+
|
1026
|
+
// IE uses filters for opacity
|
1027
|
+
if ( !jQuery.support.opacity && name == "opacity" ) {
|
1028
|
+
if ( set ) {
|
1029
|
+
// IE has trouble with opacity if it does not have layout
|
1030
|
+
// Force it by setting the zoom level
|
1031
|
+
elem.zoom = 1;
|
1032
|
+
|
1033
|
+
// Set the alpha filter to set the opacity
|
1034
|
+
elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
|
1035
|
+
(parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
|
1039
|
+
(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
|
1040
|
+
"";
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
name = name.replace(/-([a-z])/ig, function(all, letter){
|
1044
|
+
return letter.toUpperCase();
|
1045
|
+
});
|
1046
|
+
|
1047
|
+
if ( set )
|
1048
|
+
elem[ name ] = value;
|
1049
|
+
|
1050
|
+
return elem[ name ];
|
1051
|
+
},
|
1052
|
+
|
1053
|
+
trim: function( text ) {
|
1054
|
+
return (text || "").replace( /^\s+|\s+$/g, "" );
|
1055
|
+
},
|
1056
|
+
|
1057
|
+
makeArray: function( array ) {
|
1058
|
+
var ret = [];
|
1059
|
+
|
1060
|
+
if( array != null ){
|
1061
|
+
var i = array.length;
|
1062
|
+
// The window, strings (and functions) also have 'length'
|
1063
|
+
if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
|
1064
|
+
ret[0] = array;
|
1065
|
+
else
|
1066
|
+
while( i )
|
1067
|
+
ret[--i] = array[i];
|
1068
|
+
}
|
1069
|
+
|
1070
|
+
return ret;
|
1071
|
+
},
|
1072
|
+
|
1073
|
+
inArray: function( elem, array ) {
|
1074
|
+
for ( var i = 0, length = array.length; i < length; i++ )
|
1075
|
+
// Use === because on IE, window == document
|
1076
|
+
if ( array[ i ] === elem )
|
1077
|
+
return i;
|
1078
|
+
|
1079
|
+
return -1;
|
1080
|
+
},
|
1081
|
+
|
1082
|
+
merge: function( first, second ) {
|
1083
|
+
// We have to loop this way because IE & Opera overwrite the length
|
1084
|
+
// expando of getElementsByTagName
|
1085
|
+
var i = 0, elem, pos = first.length;
|
1086
|
+
// Also, we need to make sure that the correct elements are being returned
|
1087
|
+
// (IE returns comment nodes in a '*' query)
|
1088
|
+
if ( !jQuery.support.getAll ) {
|
1089
|
+
while ( (elem = second[ i++ ]) != null )
|
1090
|
+
if ( elem.nodeType != 8 )
|
1091
|
+
first[ pos++ ] = elem;
|
1092
|
+
|
1093
|
+
} else
|
1094
|
+
while ( (elem = second[ i++ ]) != null )
|
1095
|
+
first[ pos++ ] = elem;
|
1096
|
+
|
1097
|
+
return first;
|
1098
|
+
},
|
1099
|
+
|
1100
|
+
unique: function( array ) {
|
1101
|
+
var ret = [], done = {};
|
1102
|
+
|
1103
|
+
try {
|
1104
|
+
|
1105
|
+
for ( var i = 0, length = array.length; i < length; i++ ) {
|
1106
|
+
var id = jQuery.data( array[ i ] );
|
1107
|
+
|
1108
|
+
if ( !done[ id ] ) {
|
1109
|
+
done[ id ] = true;
|
1110
|
+
ret.push( array[ i ] );
|
1111
|
+
}
|
1112
|
+
}
|
1113
|
+
|
1114
|
+
} catch( e ) {
|
1115
|
+
ret = array;
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
return ret;
|
1119
|
+
},
|
1120
|
+
|
1121
|
+
grep: function( elems, callback, inv ) {
|
1122
|
+
var ret = [];
|
1123
|
+
|
1124
|
+
// Go through the array, only saving the items
|
1125
|
+
// that pass the validator function
|
1126
|
+
for ( var i = 0, length = elems.length; i < length; i++ )
|
1127
|
+
if ( !inv != !callback( elems[ i ], i ) )
|
1128
|
+
ret.push( elems[ i ] );
|
1129
|
+
|
1130
|
+
return ret;
|
1131
|
+
},
|
1132
|
+
|
1133
|
+
map: function( elems, callback ) {
|
1134
|
+
var ret = [];
|
1135
|
+
|
1136
|
+
// Go through the array, translating each of the items to their
|
1137
|
+
// new value (or values).
|
1138
|
+
for ( var i = 0, length = elems.length; i < length; i++ ) {
|
1139
|
+
var value = callback( elems[ i ], i );
|
1140
|
+
|
1141
|
+
if ( value != null )
|
1142
|
+
ret[ ret.length ] = value;
|
1143
|
+
}
|
1144
|
+
|
1145
|
+
return ret.concat.apply( [], ret );
|
1146
|
+
}
|
1147
|
+
});
|
1148
|
+
|
1149
|
+
// Use of jQuery.browser is deprecated.
|
1150
|
+
// It's included for backwards compatibility and plugins,
|
1151
|
+
// although they should work to migrate away.
|
1152
|
+
|
1153
|
+
var userAgent = navigator.userAgent.toLowerCase();
|
1154
|
+
|
1155
|
+
// Figure out what browser is being used
|
1156
|
+
jQuery.browser = {
|
1157
|
+
version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
|
1158
|
+
safari: /webkit/.test( userAgent ),
|
1159
|
+
opera: /opera/.test( userAgent ),
|
1160
|
+
msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
|
1161
|
+
mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
|
1162
|
+
};
|
1163
|
+
|
1164
|
+
jQuery.each({
|
1165
|
+
parent: function(elem){return elem.parentNode;},
|
1166
|
+
parents: function(elem){return jQuery.dir(elem,"parentNode");},
|
1167
|
+
next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
|
1168
|
+
prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
|
1169
|
+
nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
|
1170
|
+
prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
|
1171
|
+
siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
|
1172
|
+
children: function(elem){return jQuery.sibling(elem.firstChild);},
|
1173
|
+
contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
|
1174
|
+
}, function(name, fn){
|
1175
|
+
jQuery.fn[ name ] = function( selector ) {
|
1176
|
+
var ret = jQuery.map( this, fn );
|
1177
|
+
|
1178
|
+
if ( selector && typeof selector == "string" )
|
1179
|
+
ret = jQuery.multiFilter( selector, ret );
|
1180
|
+
|
1181
|
+
return this.pushStack( jQuery.unique( ret ), name, selector );
|
1182
|
+
};
|
1183
|
+
});
|
1184
|
+
|
1185
|
+
jQuery.each({
|
1186
|
+
appendTo: "append",
|
1187
|
+
prependTo: "prepend",
|
1188
|
+
insertBefore: "before",
|
1189
|
+
insertAfter: "after",
|
1190
|
+
replaceAll: "replaceWith"
|
1191
|
+
}, function(name, original){
|
1192
|
+
jQuery.fn[ name ] = function( selector ) {
|
1193
|
+
var ret = [], insert = jQuery( selector );
|
1194
|
+
|
1195
|
+
for ( var i = 0, l = insert.length; i < l; i++ ) {
|
1196
|
+
var elems = (i > 0 ? this.clone(true) : this).get();
|
1197
|
+
jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
|
1198
|
+
ret = ret.concat( elems );
|
1199
|
+
}
|
1200
|
+
|
1201
|
+
return this.pushStack( ret, name, selector );
|
1202
|
+
};
|
1203
|
+
});
|
1204
|
+
|
1205
|
+
jQuery.each({
|
1206
|
+
removeAttr: function( name ) {
|
1207
|
+
jQuery.attr( this, name, "" );
|
1208
|
+
if (this.nodeType == 1)
|
1209
|
+
this.removeAttribute( name );
|
1210
|
+
},
|
1211
|
+
|
1212
|
+
addClass: function( classNames ) {
|
1213
|
+
jQuery.className.add( this, classNames );
|
1214
|
+
},
|
1215
|
+
|
1216
|
+
removeClass: function( classNames ) {
|
1217
|
+
jQuery.className.remove( this, classNames );
|
1218
|
+
},
|
1219
|
+
|
1220
|
+
toggleClass: function( classNames, state ) {
|
1221
|
+
if( typeof state !== "boolean" )
|
1222
|
+
state = !jQuery.className.has( this, classNames );
|
1223
|
+
jQuery.className[ state ? "add" : "remove" ]( this, classNames );
|
1224
|
+
},
|
1225
|
+
|
1226
|
+
remove: function( selector ) {
|
1227
|
+
if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
|
1228
|
+
// Prevent memory leaks
|
1229
|
+
jQuery( "*", this ).add([this]).each(function(){
|
1230
|
+
jQuery.event.remove(this);
|
1231
|
+
jQuery.removeData(this);
|
1232
|
+
});
|
1233
|
+
if (this.parentNode)
|
1234
|
+
this.parentNode.removeChild( this );
|
1235
|
+
}
|
1236
|
+
},
|
1237
|
+
|
1238
|
+
empty: function() {
|
1239
|
+
// Remove element nodes and prevent memory leaks
|
1240
|
+
jQuery(this).children().remove();
|
1241
|
+
|
1242
|
+
// Remove any remaining nodes
|
1243
|
+
while ( this.firstChild )
|
1244
|
+
this.removeChild( this.firstChild );
|
1245
|
+
}
|
1246
|
+
}, function(name, fn){
|
1247
|
+
jQuery.fn[ name ] = function(){
|
1248
|
+
return this.each( fn, arguments );
|
1249
|
+
};
|
1250
|
+
});
|
1251
|
+
|
1252
|
+
// Helper function used by the dimensions and offset modules
|
1253
|
+
function num(elem, prop) {
|
1254
|
+
return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
|
1255
|
+
}
|