annotate inkscape/firefox/jquery-1.3.1.js @ 272:01439f28d0bd

Check-in primitive integrated madbuilder code.
author wycc
date Mon, 26 Jan 2009 01:36:04 +0800
parents
children
rev   line source
272
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1 /*!
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2 * jQuery JavaScript Library v1.3.1
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3 * http://jquery.com/
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4 *
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
5 * Copyright (c) 2009 John Resig
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
6 * Dual licensed under the MIT and GPL licenses.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
7 * http://docs.jquery.com/License
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
8 *
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
9 * Date: 2009-01-21 20:42:16 -0500 (Wed, 21 Jan 2009)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
10 * Revision: 6158
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
11 */
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
12 (function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
13
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
14 var
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
15 // Will speed up references to window, and allows munging its name.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
16 window = this,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
17 // Will speed up references to undefined, and allows munging its name.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
18 undefined,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
19 // Map over jQuery in case of overwrite
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
20 _jQuery = window.jQuery,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
21 // Map over the $ in case of overwrite
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
22 _$ = window.$,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
23
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
24 jQuery = window.jQuery = window.$ = function( selector, context ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
25 // The jQuery object is actually just the init constructor 'enhanced'
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
26 return new jQuery.fn.init( selector, context );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
27 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
28
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
29 // A simple way to check for HTML strings or ID strings
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
30 // (both of which we optimize for)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
31 quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
32 // Is it a simple selector
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
33 isSimple = /^.[^:#\[\.,]*$/;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
34
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
35 jQuery.fn = jQuery.prototype = {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
36 init: function( selector, context ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
37 // Make sure that a selection was provided
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
38 selector = selector || document;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
39
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
40 // Handle $(DOMElement)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
41 if ( selector.nodeType ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
42 this[0] = selector;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
43 this.length = 1;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
44 this.context = selector;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
45 return this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
46 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
47 // Handle HTML strings
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
48 if ( typeof selector === "string" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
49 // Are we dealing with HTML string or an ID?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
50 var match = quickExpr.exec( selector );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
51
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
52 // Verify a match, and that no context was specified for #id
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
53 if ( match && (match[1] || !context) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
54
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
55 // HANDLE: $(html) -> $(array)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
56 if ( match[1] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
57 selector = jQuery.clean( [ match[1] ], context );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
58
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
59 // HANDLE: $("#id")
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
60 else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
61 var elem = document.getElementById( match[3] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
62
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
63 // Handle the case where IE and Opera return items
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
64 // by name instead of ID
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
65 if ( elem && elem.id != match[3] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
66 return jQuery().find( selector );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
67
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
68 // Otherwise, we inject the element directly into the jQuery object
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
69 var ret = jQuery( elem || [] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
70 ret.context = document;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
71 ret.selector = selector;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
72 return ret;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
73 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
74
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
75 // HANDLE: $(expr, [context])
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
76 // (which is just equivalent to: $(content).find(expr)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
77 } else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
78 return jQuery( context ).find( selector );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
79
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
80 // HANDLE: $(function)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
81 // Shortcut for document ready
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
82 } else if ( jQuery.isFunction( selector ) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
83 return jQuery( document ).ready( selector );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
84
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
85 // Make sure that old selector state is passed along
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
86 if ( selector.selector && selector.context ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
87 this.selector = selector.selector;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
88 this.context = selector.context;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
89 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
90
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
91 return this.setArray(jQuery.makeArray(selector));
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
92 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
93
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
94 // Start with an empty selector
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
95 selector: "",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
96
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
97 // The current version of jQuery being used
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
98 jquery: "1.3.1",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
99
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
100 // The number of elements contained in the matched element set
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
101 size: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
102 return this.length;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
103 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
104
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
105 // Get the Nth element in the matched element set OR
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
106 // Get the whole matched element set as a clean array
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
107 get: function( num ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
108 return num === undefined ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
109
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
110 // Return a 'clean' array
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
111 jQuery.makeArray( this ) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
112
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
113 // Return just the object
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
114 this[ num ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
115 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
116
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
117 // Take an array of elements and push it onto the stack
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
118 // (returning the new matched element set)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
119 pushStack: function( elems, name, selector ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
120 // Build a new jQuery matched element set
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
121 var ret = jQuery( elems );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
122
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
123 // Add the old object onto the stack (as a reference)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
124 ret.prevObject = this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
125
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
126 ret.context = this.context;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
127
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
128 if ( name === "find" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
129 ret.selector = this.selector + (this.selector ? " " : "") + selector;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
130 else if ( name )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
131 ret.selector = this.selector + "." + name + "(" + selector + ")";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
132
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
133 // Return the newly-formed element set
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
134 return ret;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
135 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
136
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
137 // Force the current matched set of elements to become
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
138 // the specified array of elements (destroying the stack in the process)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
139 // You should use pushStack() in order to do this, but maintain the stack
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
140 setArray: function( elems ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
141 // Resetting the length to 0, then using the native Array push
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
142 // is a super-fast way to populate an object with array-like properties
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
143 this.length = 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
144 Array.prototype.push.apply( this, elems );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
145
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
146 return this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
147 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
148
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
149 // Execute a callback for every element in the matched set.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
150 // (You can seed the arguments with an array of args, but this is
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
151 // only used internally.)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
152 each: function( callback, args ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
153 return jQuery.each( this, callback, args );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
154 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
155
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
156 // Determine the position of an element within
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
157 // the matched set of elements
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
158 index: function( elem ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
159 // Locate the position of the desired element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
160 return jQuery.inArray(
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
161 // If it receives a jQuery object, the first element is used
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
162 elem && elem.jquery ? elem[0] : elem
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
163 , this );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
164 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
165
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
166 attr: function( name, value, type ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
167 var options = name;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
168
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
169 // Look for the case where we're accessing a style value
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
170 if ( typeof name === "string" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
171 if ( value === undefined )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
172 return this[0] && jQuery[ type || "attr" ]( this[0], name );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
173
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
174 else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
175 options = {};
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
176 options[ name ] = value;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
177 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
178
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
179 // Check to see if we're setting style values
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
180 return this.each(function(i){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
181 // Set all the styles
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
182 for ( name in options )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
183 jQuery.attr(
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
184 type ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
185 this.style :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
186 this,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
187 name, jQuery.prop( this, options[ name ], type, i, name )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
188 );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
189 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
190 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
191
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
192 css: function( key, value ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
193 // ignore negative width and height values
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
194 if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
195 value = undefined;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
196 return this.attr( key, value, "curCSS" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
197 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
198
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
199 text: function( text ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
200 if ( typeof text !== "object" && text != null )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
201 return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
202
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
203 var ret = "";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
204
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
205 jQuery.each( text || this, function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
206 jQuery.each( this.childNodes, function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
207 if ( this.nodeType != 8 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
208 ret += this.nodeType != 1 ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
209 this.nodeValue :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
210 jQuery.fn.text( [ this ] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
211 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
212 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
213
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
214 return ret;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
215 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
216
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
217 wrapAll: function( html ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
218 if ( this[0] ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
219 // The elements to wrap the target around
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
220 var wrap = jQuery( html, this[0].ownerDocument ).clone();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
221
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
222 if ( this[0].parentNode )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
223 wrap.insertBefore( this[0] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
224
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
225 wrap.map(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
226 var elem = this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
227
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
228 while ( elem.firstChild )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
229 elem = elem.firstChild;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
230
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
231 return elem;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
232 }).append(this);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
233 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
234
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
235 return this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
236 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
237
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
238 wrapInner: function( html ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
239 return this.each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
240 jQuery( this ).contents().wrapAll( html );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
241 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
242 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
243
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
244 wrap: function( html ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
245 return this.each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
246 jQuery( this ).wrapAll( html );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
247 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
248 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
249
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
250 append: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
251 return this.domManip(arguments, true, function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
252 if (this.nodeType == 1)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
253 this.appendChild( elem );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
254 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
255 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
256
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
257 prepend: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
258 return this.domManip(arguments, true, function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
259 if (this.nodeType == 1)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
260 this.insertBefore( elem, this.firstChild );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
261 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
262 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
263
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
264 before: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
265 return this.domManip(arguments, false, function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
266 this.parentNode.insertBefore( elem, this );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
267 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
268 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
269
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
270 after: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
271 return this.domManip(arguments, false, function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
272 this.parentNode.insertBefore( elem, this.nextSibling );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
273 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
274 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
275
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
276 end: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
277 return this.prevObject || jQuery( [] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
278 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
279
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
280 // For internal use only.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
281 // Behaves like an Array's .push method, not like a jQuery method.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
282 push: [].push,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
283
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
284 find: function( selector ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
285 if ( this.length === 1 && !/,/.test(selector) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
286 var ret = this.pushStack( [], "find", selector );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
287 ret.length = 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
288 jQuery.find( selector, this[0], ret );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
289 return ret;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
290 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
291 var elems = jQuery.map(this, function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
292 return jQuery.find( selector, elem );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
293 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
294
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
295 return this.pushStack( /[^+>] [^+>]/.test( selector ) ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
296 jQuery.unique( elems ) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
297 elems, "find", selector );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
298 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
299 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
300
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
301 clone: function( events ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
302 // Do the clone
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
303 var ret = this.map(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
304 if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
305 // IE copies events bound via attachEvent when
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
306 // using cloneNode. Calling detachEvent on the
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
307 // clone will also remove the events from the orignal
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
308 // In order to get around this, we use innerHTML.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
309 // Unfortunately, this means some modifications to
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
310 // attributes in IE that are actually only stored
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
311 // as properties will not be copied (such as the
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
312 // the name attribute on an input).
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
313 var clone = this.cloneNode(true),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
314 container = document.createElement("div");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
315 container.appendChild(clone);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
316 return jQuery.clean([container.innerHTML])[0];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
317 } else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
318 return this.cloneNode(true);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
319 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
320
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
321 // Need to set the expando to null on the cloned set if it exists
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
322 // removeData doesn't work here, IE removes it from the original as well
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
323 // this is primarily for IE but the data expando shouldn't be copied over in any browser
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
324 var clone = ret.find("*").andSelf().each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
325 if ( this[ expando ] !== undefined )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
326 this[ expando ] = null;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
327 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
328
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
329 // Copy the events from the original to the clone
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
330 if ( events === true )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
331 this.find("*").andSelf().each(function(i){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
332 if (this.nodeType == 3)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
333 return;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
334 var events = jQuery.data( this, "events" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
335
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
336 for ( var type in events )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
337 for ( var handler in events[ type ] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
338 jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
339 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
340
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
341 // Return the cloned set
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
342 return ret;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
343 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
344
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
345 filter: function( selector ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
346 return this.pushStack(
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
347 jQuery.isFunction( selector ) &&
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
348 jQuery.grep(this, function(elem, i){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
349 return selector.call( elem, i );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
350 }) ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
351
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
352 jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
353 return elem.nodeType === 1;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
354 }) ), "filter", selector );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
355 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
356
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
357 closest: function( selector ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
358 var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
359
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
360 return this.map(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
361 var cur = this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
362 while ( cur && cur.ownerDocument ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
363 if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
364 return cur;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
365 cur = cur.parentNode;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
366 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
367 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
368 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
369
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
370 not: function( selector ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
371 if ( typeof selector === "string" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
372 // test special case where just one selector is passed in
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
373 if ( isSimple.test( selector ) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
374 return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
375 else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
376 selector = jQuery.multiFilter( selector, this );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
377
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
378 var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
379 return this.filter(function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
380 return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
381 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
382 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
383
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
384 add: function( selector ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
385 return this.pushStack( jQuery.unique( jQuery.merge(
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
386 this.get(),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
387 typeof selector === "string" ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
388 jQuery( selector ) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
389 jQuery.makeArray( selector )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
390 )));
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
391 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
392
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
393 is: function( selector ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
394 return !!selector && jQuery.multiFilter( selector, this ).length > 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
395 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
396
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
397 hasClass: function( selector ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
398 return !!selector && this.is( "." + selector );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
399 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
400
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
401 val: function( value ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
402 if ( value === undefined ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
403 var elem = this[0];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
404
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
405 if ( elem ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
406 if( jQuery.nodeName( elem, 'option' ) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
407 return (elem.attributes.value || {}).specified ? elem.value : elem.text;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
408
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
409 // We need to handle select boxes special
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
410 if ( jQuery.nodeName( elem, "select" ) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
411 var index = elem.selectedIndex,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
412 values = [],
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
413 options = elem.options,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
414 one = elem.type == "select-one";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
415
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
416 // Nothing was selected
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
417 if ( index < 0 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
418 return null;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
419
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
420 // Loop through all the selected options
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
421 for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
422 var option = options[ i ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
423
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
424 if ( option.selected ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
425 // Get the specifc value for the option
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
426 value = jQuery(option).val();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
427
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
428 // We don't need an array for one selects
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
429 if ( one )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
430 return value;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
431
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
432 // Multi-Selects return an array
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
433 values.push( value );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
434 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
435 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
436
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
437 return values;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
438 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
439
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
440 // Everything else, we just grab the value
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
441 return (elem.value || "").replace(/\r/g, "");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
442
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
443 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
444
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
445 return undefined;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
446 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
447
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
448 if ( typeof value === "number" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
449 value += '';
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
450
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
451 return this.each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
452 if ( this.nodeType != 1 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
453 return;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
454
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
455 if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
456 this.checked = (jQuery.inArray(this.value, value) >= 0 ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
457 jQuery.inArray(this.name, value) >= 0);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
458
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
459 else if ( jQuery.nodeName( this, "select" ) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
460 var values = jQuery.makeArray(value);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
461
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
462 jQuery( "option", this ).each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
463 this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
464 jQuery.inArray( this.text, values ) >= 0);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
465 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
466
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
467 if ( !values.length )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
468 this.selectedIndex = -1;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
469
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
470 } else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
471 this.value = value;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
472 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
473 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
474
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
475 html: function( value ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
476 return value === undefined ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
477 (this[0] ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
478 this[0].innerHTML :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
479 null) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
480 this.empty().append( value );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
481 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
482
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
483 replaceWith: function( value ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
484 return this.after( value ).remove();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
485 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
486
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
487 eq: function( i ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
488 return this.slice( i, +i + 1 );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
489 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
490
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
491 slice: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
492 return this.pushStack( Array.prototype.slice.apply( this, arguments ),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
493 "slice", Array.prototype.slice.call(arguments).join(",") );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
494 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
495
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
496 map: function( callback ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
497 return this.pushStack( jQuery.map(this, function(elem, i){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
498 return callback.call( elem, i, elem );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
499 }));
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
500 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
501
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
502 andSelf: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
503 return this.add( this.prevObject );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
504 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
505
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
506 domManip: function( args, table, callback ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
507 if ( this[0] ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
508 var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
509 scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
510 first = fragment.firstChild,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
511 extra = this.length > 1 ? fragment.cloneNode(true) : fragment;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
512
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
513 if ( first )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
514 for ( var i = 0, l = this.length; i < l; i++ )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
515 callback.call( root(this[i], first), i > 0 ? extra.cloneNode(true) : fragment );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
516
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
517 if ( scripts )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
518 jQuery.each( scripts, evalScript );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
519 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
520
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
521 return this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
522
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
523 function root( elem, cur ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
524 return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
525 (elem.getElementsByTagName("tbody")[0] ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
526 elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
527 elem;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
528 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
529 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
530 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
531
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
532 // Give the init function the jQuery prototype for later instantiation
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
533 jQuery.fn.init.prototype = jQuery.fn;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
534
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
535 function evalScript( i, elem ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
536 if ( elem.src )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
537 jQuery.ajax({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
538 url: elem.src,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
539 async: false,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
540 dataType: "script"
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
541 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
542
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
543 else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
544 jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
545
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
546 if ( elem.parentNode )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
547 elem.parentNode.removeChild( elem );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
548 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
549
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
550 function now(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
551 return +new Date;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
552 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
553
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
554 jQuery.extend = jQuery.fn.extend = function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
555 // copy reference to target object
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
556 var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
557
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
558 // Handle a deep copy situation
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
559 if ( typeof target === "boolean" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
560 deep = target;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
561 target = arguments[1] || {};
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
562 // skip the boolean and the target
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
563 i = 2;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
564 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
565
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
566 // Handle case when target is a string or something (possible in deep copy)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
567 if ( typeof target !== "object" && !jQuery.isFunction(target) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
568 target = {};
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
569
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
570 // extend jQuery itself if only one argument is passed
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
571 if ( length == i ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
572 target = this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
573 --i;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
574 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
575
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
576 for ( ; i < length; i++ )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
577 // Only deal with non-null/undefined values
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
578 if ( (options = arguments[ i ]) != null )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
579 // Extend the base object
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
580 for ( var name in options ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
581 var src = target[ name ], copy = options[ name ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
582
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
583 // Prevent never-ending loop
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
584 if ( target === copy )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
585 continue;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
586
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
587 // Recurse if we're merging object values
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
588 if ( deep && copy && typeof copy === "object" && !copy.nodeType )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
589 target[ name ] = jQuery.extend( deep,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
590 // Never move original objects, clone them
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
591 src || ( copy.length != null ? [ ] : { } )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
592 , copy );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
593
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
594 // Don't bring in undefined values
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
595 else if ( copy !== undefined )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
596 target[ name ] = copy;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
597
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
598 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
599
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
600 // Return the modified object
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
601 return target;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
602 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
603
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
604 // exclude the following css properties to add px
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
605 var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
606 // cache defaultView
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
607 defaultView = document.defaultView || {},
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
608 toString = Object.prototype.toString;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
609
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
610 jQuery.extend({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
611 noConflict: function( deep ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
612 window.$ = _$;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
613
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
614 if ( deep )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
615 window.jQuery = _jQuery;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
616
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
617 return jQuery;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
618 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
619
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
620 // See test/unit/core.js for details concerning isFunction.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
621 // Since version 1.3, DOM methods and functions like alert
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
622 // aren't supported. They return false on IE (#2968).
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
623 isFunction: function( obj ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
624 return toString.call(obj) === "[object Function]";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
625 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
626
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
627 isArray: function( obj ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
628 return toString.call(obj) === "[object Array]";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
629 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
630
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
631 // check if an element is in a (or is an) XML document
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
632 isXMLDoc: function( elem ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
633 return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
634 !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
635 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
636
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
637 // Evalulates a script in a global context
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
638 globalEval: function( data ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
639 data = jQuery.trim( data );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
640
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
641 if ( data ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
642 // Inspired by code by Andrea Giammarchi
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
643 // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
644 var head = document.getElementsByTagName("head")[0] || document.documentElement,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
645 script = document.createElement("script");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
646
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
647 script.type = "text/javascript";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
648 if ( jQuery.support.scriptEval )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
649 script.appendChild( document.createTextNode( data ) );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
650 else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
651 script.text = data;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
652
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
653 // Use insertBefore instead of appendChild to circumvent an IE6 bug.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
654 // This arises when a base node is used (#2709).
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
655 head.insertBefore( script, head.firstChild );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
656 head.removeChild( script );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
657 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
658 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
659
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
660 nodeName: function( elem, name ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
661 return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
662 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
663
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
664 // args is for internal usage only
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
665 each: function( object, callback, args ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
666 var name, i = 0, length = object.length;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
667
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
668 if ( args ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
669 if ( length === undefined ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
670 for ( name in object )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
671 if ( callback.apply( object[ name ], args ) === false )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
672 break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
673 } else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
674 for ( ; i < length; )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
675 if ( callback.apply( object[ i++ ], args ) === false )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
676 break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
677
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
678 // A special, fast, case for the most common use of each
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
679 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
680 if ( length === undefined ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
681 for ( name in object )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
682 if ( callback.call( object[ name ], name, object[ name ] ) === false )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
683 break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
684 } else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
685 for ( var value = object[0];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
686 i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
687 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
688
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
689 return object;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
690 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
691
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
692 prop: function( elem, value, type, i, name ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
693 // Handle executable functions
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
694 if ( jQuery.isFunction( value ) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
695 value = value.call( elem, i );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
696
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
697 // Handle passing in a number to a CSS property
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
698 return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
699 value + "px" :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
700 value;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
701 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
702
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
703 className: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
704 // internal only, use addClass("class")
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
705 add: function( elem, classNames ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
706 jQuery.each((classNames || "").split(/\s+/), function(i, className){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
707 if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
708 elem.className += (elem.className ? " " : "") + className;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
709 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
710 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
711
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
712 // internal only, use removeClass("class")
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
713 remove: function( elem, classNames ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
714 if (elem.nodeType == 1)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
715 elem.className = classNames !== undefined ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
716 jQuery.grep(elem.className.split(/\s+/), function(className){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
717 return !jQuery.className.has( classNames, className );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
718 }).join(" ") :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
719 "";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
720 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
721
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
722 // internal only, use hasClass("class")
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
723 has: function( elem, className ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
724 return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
725 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
726 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
727
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
728 // A method for quickly swapping in/out CSS properties to get correct calculations
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
729 swap: function( elem, options, callback ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
730 var old = {};
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
731 // Remember the old values, and insert the new ones
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
732 for ( var name in options ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
733 old[ name ] = elem.style[ name ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
734 elem.style[ name ] = options[ name ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
735 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
736
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
737 callback.call( elem );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
738
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
739 // Revert the old values
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
740 for ( var name in options )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
741 elem.style[ name ] = old[ name ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
742 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
743
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
744 css: function( elem, name, force ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
745 if ( name == "width" || name == "height" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
746 var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
747
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
748 function getWH() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
749 val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
750 var padding = 0, border = 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
751 jQuery.each( which, function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
752 padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
753 border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
754 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
755 val -= Math.round(padding + border);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
756 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
757
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
758 if ( jQuery(elem).is(":visible") )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
759 getWH();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
760 else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
761 jQuery.swap( elem, props, getWH );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
762
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
763 return Math.max(0, val);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
764 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
765
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
766 return jQuery.curCSS( elem, name, force );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
767 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
768
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
769 curCSS: function( elem, name, force ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
770 var ret, style = elem.style;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
771
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
772 // We need to handle opacity special in IE
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
773 if ( name == "opacity" && !jQuery.support.opacity ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
774 ret = jQuery.attr( style, "opacity" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
775
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
776 return ret == "" ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
777 "1" :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
778 ret;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
779 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
780
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
781 // Make sure we're using the right name for getting the float value
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
782 if ( name.match( /float/i ) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
783 name = styleFloat;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
784
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
785 if ( !force && style && style[ name ] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
786 ret = style[ name ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
787
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
788 else if ( defaultView.getComputedStyle ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
789
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
790 // Only "float" is needed here
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
791 if ( name.match( /float/i ) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
792 name = "float";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
793
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
794 name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
795
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
796 var computedStyle = defaultView.getComputedStyle( elem, null );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
797
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
798 if ( computedStyle )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
799 ret = computedStyle.getPropertyValue( name );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
800
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
801 // We should always get a number back from opacity
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
802 if ( name == "opacity" && ret == "" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
803 ret = "1";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
804
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
805 } else if ( elem.currentStyle ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
806 var camelCase = name.replace(/\-(\w)/g, function(all, letter){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
807 return letter.toUpperCase();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
808 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
809
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
810 ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
811
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
812 // From the awesome hack by Dean Edwards
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
813 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
814
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
815 // If we're not dealing with a regular pixel number
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
816 // but a number that has a weird ending, we need to convert it to pixels
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
817 if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
818 // Remember the original values
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
819 var left = style.left, rsLeft = elem.runtimeStyle.left;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
820
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
821 // Put in the new values to get a computed value out
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
822 elem.runtimeStyle.left = elem.currentStyle.left;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
823 style.left = ret || 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
824 ret = style.pixelLeft + "px";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
825
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
826 // Revert the changed values
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
827 style.left = left;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
828 elem.runtimeStyle.left = rsLeft;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
829 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
830 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
831
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
832 return ret;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
833 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
834
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
835 clean: function( elems, context, fragment ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
836 context = context || document;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
837
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
838 // !context.createElement fails in IE with an error but returns typeof 'object'
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
839 if ( typeof context.createElement === "undefined" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
840 context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
841
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
842 // If a single string is passed in and it's a single tag
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
843 // just do a createElement and skip the rest
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
844 if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
845 var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
846 if ( match )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
847 return [ context.createElement( match[1] ) ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
848 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
849
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
850 var ret = [], scripts = [], div = context.createElement("div");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
851
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
852 jQuery.each(elems, function(i, elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
853 if ( typeof elem === "number" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
854 elem += '';
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
855
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
856 if ( !elem )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
857 return;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
858
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
859 // Convert html string into DOM nodes
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
860 if ( typeof elem === "string" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
861 // Fix "XHTML"-style tags in all browsers
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
862 elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
863 return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
864 all :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
865 front + "></" + tag + ">";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
866 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
867
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
868 // Trim whitespace, otherwise indexOf won't work as expected
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
869 var tags = jQuery.trim( elem ).toLowerCase();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
870
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
871 var wrap =
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
872 // option or optgroup
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
873 !tags.indexOf("<opt") &&
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
874 [ 1, "<select multiple='multiple'>", "</select>" ] ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
875
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
876 !tags.indexOf("<leg") &&
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
877 [ 1, "<fieldset>", "</fieldset>" ] ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
878
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
879 tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
880 [ 1, "<table>", "</table>" ] ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
881
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
882 !tags.indexOf("<tr") &&
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
883 [ 2, "<table><tbody>", "</tbody></table>" ] ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
884
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
885 // <thead> matched above
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
886 (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
887 [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
888
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
889 !tags.indexOf("<col") &&
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
890 [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
891
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
892 // IE can't serialize <link> and <script> tags normally
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
893 !jQuery.support.htmlSerialize &&
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
894 [ 1, "div<div>", "</div>" ] ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
895
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
896 [ 0, "", "" ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
897
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
898 // Go to html and back, then peel off extra wrappers
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
899 div.innerHTML = wrap[1] + elem + wrap[2];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
900
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
901 // Move to the right depth
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
902 while ( wrap[0]-- )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
903 div = div.lastChild;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
904
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
905 // Remove IE's autoinserted <tbody> from table fragments
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
906 if ( !jQuery.support.tbody ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
907
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
908 // String was a <table>, *may* have spurious <tbody>
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
909 var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
910 div.firstChild && div.firstChild.childNodes :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
911
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
912 // String was a bare <thead> or <tfoot>
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
913 wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
914 div.childNodes :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
915 [];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
916
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
917 for ( var j = tbody.length - 1; j >= 0 ; --j )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
918 if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
919 tbody[ j ].parentNode.removeChild( tbody[ j ] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
920
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
921 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
922
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
923 // IE completely kills leading whitespace when innerHTML is used
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
924 if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
925 div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
926
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
927 elem = jQuery.makeArray( div.childNodes );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
928 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
929
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
930 if ( elem.nodeType )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
931 ret.push( elem );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
932 else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
933 ret = jQuery.merge( ret, elem );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
934
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
935 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
936
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
937 if ( fragment ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
938 for ( var i = 0; ret[i]; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
939 if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
940 scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
941 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
942 if ( ret[i].nodeType === 1 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
943 ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
944 fragment.appendChild( ret[i] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
945 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
946 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
947
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
948 return scripts;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
949 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
950
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
951 return ret;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
952 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
953
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
954 attr: function( elem, name, value ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
955 // don't set attributes on text and comment nodes
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
956 if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
957 return undefined;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
958
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
959 var notxml = !jQuery.isXMLDoc( elem ),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
960 // Whether we are setting (or getting)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
961 set = value !== undefined;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
962
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
963 // Try to normalize/fix the name
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
964 name = notxml && jQuery.props[ name ] || name;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
965
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
966 // Only do all the following if this is a node (faster for style)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
967 // IE elem.getAttribute passes even for style
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
968 if ( elem.tagName ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
969
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
970 // These attributes require special treatment
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
971 var special = /href|src|style/.test( name );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
972
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
973 // Safari mis-reports the default selected property of a hidden option
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
974 // Accessing the parent's selectedIndex property fixes it
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
975 if ( name == "selected" && elem.parentNode )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
976 elem.parentNode.selectedIndex;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
977
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
978 // If applicable, access the attribute via the DOM 0 way
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
979 if ( name in elem && notxml && !special ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
980 if ( set ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
981 // We can't allow the type property to be changed (since it causes problems in IE)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
982 if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
983 throw "type property can't be changed";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
984
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
985 elem[ name ] = value;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
986 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
987
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
988 // browsers index elements by id/name on forms, give priority to attributes.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
989 if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
990 return elem.getAttributeNode( name ).nodeValue;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
991
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
992 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
993 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
994 if ( name == "tabIndex" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
995 var attributeNode = elem.getAttributeNode( "tabIndex" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
996 return attributeNode && attributeNode.specified
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
997 ? attributeNode.value
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
998 : elem.nodeName.match(/(button|input|object|select|textarea)/i)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
999 ? 0
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1000 : elem.nodeName.match(/^(a|area)$/i) && elem.href
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1001 ? 0
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1002 : undefined;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1003 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1004
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1005 return elem[ name ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1006 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1007
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1008 if ( !jQuery.support.style && notxml && name == "style" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1009 return jQuery.attr( elem.style, "cssText", value );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1010
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1011 if ( set )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1012 // convert the value to a string (all browsers do this but IE) see #1070
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1013 elem.setAttribute( name, "" + value );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1014
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1015 var attr = !jQuery.support.hrefNormalized && notxml && special
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1016 // Some attributes require a special call on IE
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1017 ? elem.getAttribute( name, 2 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1018 : elem.getAttribute( name );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1019
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1020 // Non-existent attributes return null, we normalize to undefined
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1021 return attr === null ? undefined : attr;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1022 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1023
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1024 // elem is actually elem.style ... set the style
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1025
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1026 // IE uses filters for opacity
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1027 if ( !jQuery.support.opacity && name == "opacity" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1028 if ( set ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1029 // IE has trouble with opacity if it does not have layout
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1030 // Force it by setting the zoom level
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1031 elem.zoom = 1;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1032
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1033 // Set the alpha filter to set the opacity
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1034 elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1035 (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1036 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1037
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1038 return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1039 (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1040 "";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1041 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1042
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1043 name = name.replace(/-([a-z])/ig, function(all, letter){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1044 return letter.toUpperCase();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1045 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1046
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1047 if ( set )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1048 elem[ name ] = value;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1049
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1050 return elem[ name ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1051 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1052
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1053 trim: function( text ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1054 return (text || "").replace( /^\s+|\s+$/g, "" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1055 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1056
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1057 makeArray: function( array ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1058 var ret = [];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1059
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1060 if( array != null ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1061 var i = array.length;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1062 // The window, strings (and functions) also have 'length'
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1063 if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1064 ret[0] = array;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1065 else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1066 while( i )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1067 ret[--i] = array[i];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1068 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1069
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1070 return ret;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1071 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1072
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1073 inArray: function( elem, array ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1074 for ( var i = 0, length = array.length; i < length; i++ )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1075 // Use === because on IE, window == document
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1076 if ( array[ i ] === elem )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1077 return i;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1078
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1079 return -1;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1080 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1081
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1082 merge: function( first, second ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1083 // We have to loop this way because IE & Opera overwrite the length
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1084 // expando of getElementsByTagName
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1085 var i = 0, elem, pos = first.length;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1086 // Also, we need to make sure that the correct elements are being returned
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1087 // (IE returns comment nodes in a '*' query)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1088 if ( !jQuery.support.getAll ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1089 while ( (elem = second[ i++ ]) != null )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1090 if ( elem.nodeType != 8 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1091 first[ pos++ ] = elem;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1092
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1093 } else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1094 while ( (elem = second[ i++ ]) != null )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1095 first[ pos++ ] = elem;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1096
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1097 return first;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1098 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1099
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1100 unique: function( array ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1101 var ret = [], done = {};
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1102
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1103 try {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1104
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1105 for ( var i = 0, length = array.length; i < length; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1106 var id = jQuery.data( array[ i ] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1107
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1108 if ( !done[ id ] ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1109 done[ id ] = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1110 ret.push( array[ i ] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1111 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1112 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1113
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1114 } catch( e ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1115 ret = array;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1116 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1117
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1118 return ret;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1119 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1120
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1121 grep: function( elems, callback, inv ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1122 var ret = [];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1123
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1124 // Go through the array, only saving the items
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1125 // that pass the validator function
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1126 for ( var i = 0, length = elems.length; i < length; i++ )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1127 if ( !inv != !callback( elems[ i ], i ) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1128 ret.push( elems[ i ] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1129
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1130 return ret;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1131 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1132
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1133 map: function( elems, callback ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1134 var ret = [];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1135
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1136 // Go through the array, translating each of the items to their
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1137 // new value (or values).
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1138 for ( var i = 0, length = elems.length; i < length; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1139 var value = callback( elems[ i ], i );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1140
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1141 if ( value != null )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1142 ret[ ret.length ] = value;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1143 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1144
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1145 return ret.concat.apply( [], ret );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1146 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1147 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1148
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1149 // Use of jQuery.browser is deprecated.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1150 // It's included for backwards compatibility and plugins,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1151 // although they should work to migrate away.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1152
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1153 var userAgent = navigator.userAgent.toLowerCase();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1154
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1155 // Figure out what browser is being used
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1156 jQuery.browser = {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1157 version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1158 safari: /webkit/.test( userAgent ),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1159 opera: /opera/.test( userAgent ),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1160 msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1161 mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1162 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1163
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1164 jQuery.each({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1165 parent: function(elem){return elem.parentNode;},
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1166 parents: function(elem){return jQuery.dir(elem,"parentNode");},
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1167 next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1168 prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1169 nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1170 prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1171 siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1172 children: function(elem){return jQuery.sibling(elem.firstChild);},
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1173 contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1174 }, function(name, fn){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1175 jQuery.fn[ name ] = function( selector ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1176 var ret = jQuery.map( this, fn );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1177
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1178 if ( selector && typeof selector == "string" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1179 ret = jQuery.multiFilter( selector, ret );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1180
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1181 return this.pushStack( jQuery.unique( ret ), name, selector );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1182 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1183 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1184
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1185 jQuery.each({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1186 appendTo: "append",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1187 prependTo: "prepend",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1188 insertBefore: "before",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1189 insertAfter: "after",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1190 replaceAll: "replaceWith"
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1191 }, function(name, original){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1192 jQuery.fn[ name ] = function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1193 var args = arguments;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1194
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1195 return this.each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1196 for ( var i = 0, length = args.length; i < length; i++ )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1197 jQuery( args[ i ] )[ original ]( this );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1198 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1199 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1200 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1201
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1202 jQuery.each({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1203 removeAttr: function( name ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1204 jQuery.attr( this, name, "" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1205 if (this.nodeType == 1)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1206 this.removeAttribute( name );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1207 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1208
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1209 addClass: function( classNames ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1210 jQuery.className.add( this, classNames );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1211 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1212
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1213 removeClass: function( classNames ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1214 jQuery.className.remove( this, classNames );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1215 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1216
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1217 toggleClass: function( classNames, state ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1218 if( typeof state !== "boolean" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1219 state = !jQuery.className.has( this, classNames );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1220 jQuery.className[ state ? "add" : "remove" ]( this, classNames );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1221 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1222
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1223 remove: function( selector ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1224 if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1225 // Prevent memory leaks
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1226 jQuery( "*", this ).add([this]).each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1227 jQuery.event.remove(this);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1228 jQuery.removeData(this);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1229 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1230 if (this.parentNode)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1231 this.parentNode.removeChild( this );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1232 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1233 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1234
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1235 empty: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1236 // Remove element nodes and prevent memory leaks
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1237 jQuery( ">*", this ).remove();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1238
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1239 // Remove any remaining nodes
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1240 while ( this.firstChild )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1241 this.removeChild( this.firstChild );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1242 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1243 }, function(name, fn){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1244 jQuery.fn[ name ] = function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1245 return this.each( fn, arguments );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1246 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1247 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1248
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1249 // Helper function used by the dimensions and offset modules
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1250 function num(elem, prop) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1251 return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1252 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1253 var expando = "jQuery" + now(), uuid = 0, windowData = {};
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1254
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1255 jQuery.extend({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1256 cache: {},
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1257
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1258 data: function( elem, name, data ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1259 elem = elem == window ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1260 windowData :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1261 elem;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1262
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1263 var id = elem[ expando ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1264
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1265 // Compute a unique ID for the element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1266 if ( !id )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1267 id = elem[ expando ] = ++uuid;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1268
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1269 // Only generate the data cache if we're
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1270 // trying to access or manipulate it
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1271 if ( name && !jQuery.cache[ id ] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1272 jQuery.cache[ id ] = {};
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1273
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1274 // Prevent overriding the named cache with undefined values
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1275 if ( data !== undefined )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1276 jQuery.cache[ id ][ name ] = data;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1277
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1278 // Return the named cache data, or the ID for the element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1279 return name ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1280 jQuery.cache[ id ][ name ] :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1281 id;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1282 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1283
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1284 removeData: function( elem, name ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1285 elem = elem == window ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1286 windowData :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1287 elem;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1288
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1289 var id = elem[ expando ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1290
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1291 // If we want to remove a specific section of the element's data
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1292 if ( name ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1293 if ( jQuery.cache[ id ] ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1294 // Remove the section of cache data
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1295 delete jQuery.cache[ id ][ name ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1296
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1297 // If we've removed all the data, remove the element's cache
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1298 name = "";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1299
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1300 for ( name in jQuery.cache[ id ] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1301 break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1302
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1303 if ( !name )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1304 jQuery.removeData( elem );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1305 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1306
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1307 // Otherwise, we want to remove all of the element's data
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1308 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1309 // Clean up the element expando
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1310 try {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1311 delete elem[ expando ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1312 } catch(e){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1313 // IE has trouble directly removing the expando
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1314 // but it's ok with using removeAttribute
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1315 if ( elem.removeAttribute )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1316 elem.removeAttribute( expando );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1317 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1318
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1319 // Completely remove the data cache
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1320 delete jQuery.cache[ id ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1321 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1322 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1323 queue: function( elem, type, data ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1324 if ( elem ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1325
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1326 type = (type || "fx") + "queue";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1327
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1328 var q = jQuery.data( elem, type );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1329
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1330 if ( !q || jQuery.isArray(data) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1331 q = jQuery.data( elem, type, jQuery.makeArray(data) );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1332 else if( data )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1333 q.push( data );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1334
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1335 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1336 return q;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1337 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1338
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1339 dequeue: function( elem, type ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1340 var queue = jQuery.queue( elem, type ),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1341 fn = queue.shift();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1342
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1343 if( !type || type === "fx" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1344 fn = queue[0];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1345
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1346 if( fn !== undefined )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1347 fn.call(elem);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1348 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1349 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1350
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1351 jQuery.fn.extend({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1352 data: function( key, value ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1353 var parts = key.split(".");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1354 parts[1] = parts[1] ? "." + parts[1] : "";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1355
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1356 if ( value === undefined ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1357 var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1358
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1359 if ( data === undefined && this.length )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1360 data = jQuery.data( this[0], key );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1361
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1362 return data === undefined && parts[1] ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1363 this.data( parts[0] ) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1364 data;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1365 } else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1366 return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1367 jQuery.data( this, key, value );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1368 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1369 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1370
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1371 removeData: function( key ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1372 return this.each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1373 jQuery.removeData( this, key );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1374 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1375 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1376 queue: function(type, data){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1377 if ( typeof type !== "string" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1378 data = type;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1379 type = "fx";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1380 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1381
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1382 if ( data === undefined )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1383 return jQuery.queue( this[0], type );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1384
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1385 return this.each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1386 var queue = jQuery.queue( this, type, data );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1387
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1388 if( type == "fx" && queue.length == 1 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1389 queue[0].call(this);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1390 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1391 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1392 dequeue: function(type){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1393 return this.each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1394 jQuery.dequeue( this, type );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1395 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1396 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1397 });/*!
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1398 * Sizzle CSS Selector Engine - v0.9.3
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1399 * Copyright 2009, The Dojo Foundation
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1400 * Released under the MIT, BSD, and GPL Licenses.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1401 * More information: http://sizzlejs.com/
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1402 */
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1403 (function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1404
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1405 var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]+['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1406 done = 0,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1407 toString = Object.prototype.toString;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1408
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1409 var Sizzle = function(selector, context, results, seed) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1410 results = results || [];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1411 context = context || document;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1412
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1413 if ( context.nodeType !== 1 && context.nodeType !== 9 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1414 return [];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1415
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1416 if ( !selector || typeof selector !== "string" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1417 return results;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1418 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1419
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1420 var parts = [], m, set, checkSet, check, mode, extra, prune = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1421
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1422 // Reset the position of the chunker regexp (start from head)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1423 chunker.lastIndex = 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1424
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1425 while ( (m = chunker.exec(selector)) !== null ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1426 parts.push( m[1] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1427
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1428 if ( m[2] ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1429 extra = RegExp.rightContext;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1430 break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1431 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1432 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1433
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1434 if ( parts.length > 1 && origPOS.exec( selector ) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1435 if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1436 set = posProcess( parts[0] + parts[1], context );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1437 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1438 set = Expr.relative[ parts[0] ] ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1439 [ context ] :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1440 Sizzle( parts.shift(), context );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1441
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1442 while ( parts.length ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1443 selector = parts.shift();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1444
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1445 if ( Expr.relative[ selector ] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1446 selector += parts.shift();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1447
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1448 set = posProcess( selector, set );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1449 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1450 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1451 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1452 var ret = seed ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1453 { expr: parts.pop(), set: makeArray(seed) } :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1454 Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1455 set = Sizzle.filter( ret.expr, ret.set );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1456
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1457 if ( parts.length > 0 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1458 checkSet = makeArray(set);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1459 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1460 prune = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1461 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1462
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1463 while ( parts.length ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1464 var cur = parts.pop(), pop = cur;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1465
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1466 if ( !Expr.relative[ cur ] ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1467 cur = "";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1468 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1469 pop = parts.pop();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1470 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1471
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1472 if ( pop == null ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1473 pop = context;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1474 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1475
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1476 Expr.relative[ cur ]( checkSet, pop, isXML(context) );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1477 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1478 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1479
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1480 if ( !checkSet ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1481 checkSet = set;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1482 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1483
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1484 if ( !checkSet ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1485 throw "Syntax error, unrecognized expression: " + (cur || selector);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1486 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1487
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1488 if ( toString.call(checkSet) === "[object Array]" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1489 if ( !prune ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1490 results.push.apply( results, checkSet );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1491 } else if ( context.nodeType === 1 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1492 for ( var i = 0; checkSet[i] != null; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1493 if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1494 results.push( set[i] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1495 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1496 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1497 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1498 for ( var i = 0; checkSet[i] != null; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1499 if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1500 results.push( set[i] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1501 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1502 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1503 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1504 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1505 makeArray( checkSet, results );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1506 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1507
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1508 if ( extra ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1509 Sizzle( extra, context, results, seed );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1510 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1511
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1512 return results;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1513 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1514
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1515 Sizzle.matches = function(expr, set){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1516 return Sizzle(expr, null, null, set);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1517 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1518
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1519 Sizzle.find = function(expr, context, isXML){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1520 var set, match;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1521
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1522 if ( !expr ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1523 return [];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1524 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1525
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1526 for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1527 var type = Expr.order[i], match;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1528
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1529 if ( (match = Expr.match[ type ].exec( expr )) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1530 var left = RegExp.leftContext;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1531
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1532 if ( left.substr( left.length - 1 ) !== "\\" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1533 match[1] = (match[1] || "").replace(/\\/g, "");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1534 set = Expr.find[ type ]( match, context, isXML );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1535 if ( set != null ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1536 expr = expr.replace( Expr.match[ type ], "" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1537 break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1538 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1539 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1540 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1541 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1542
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1543 if ( !set ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1544 set = context.getElementsByTagName("*");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1545 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1546
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1547 return {set: set, expr: expr};
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1548 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1549
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1550 Sizzle.filter = function(expr, set, inplace, not){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1551 var old = expr, result = [], curLoop = set, match, anyFound;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1552
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1553 while ( expr && set.length ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1554 for ( var type in Expr.filter ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1555 if ( (match = Expr.match[ type ].exec( expr )) != null ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1556 var filter = Expr.filter[ type ], found, item;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1557 anyFound = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1558
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1559 if ( curLoop == result ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1560 result = [];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1561 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1562
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1563 if ( Expr.preFilter[ type ] ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1564 match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1565
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1566 if ( !match ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1567 anyFound = found = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1568 } else if ( match === true ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1569 continue;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1570 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1571 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1572
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1573 if ( match ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1574 for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1575 if ( item ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1576 found = filter( item, match, i, curLoop );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1577 var pass = not ^ !!found;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1578
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1579 if ( inplace && found != null ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1580 if ( pass ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1581 anyFound = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1582 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1583 curLoop[i] = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1584 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1585 } else if ( pass ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1586 result.push( item );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1587 anyFound = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1588 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1589 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1590 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1591 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1592
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1593 if ( found !== undefined ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1594 if ( !inplace ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1595 curLoop = result;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1596 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1597
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1598 expr = expr.replace( Expr.match[ type ], "" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1599
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1600 if ( !anyFound ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1601 return [];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1602 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1603
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1604 break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1605 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1606 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1607 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1608
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1609 expr = expr.replace(/\s*,\s*/, "");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1610
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1611 // Improper expression
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1612 if ( expr == old ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1613 if ( anyFound == null ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1614 throw "Syntax error, unrecognized expression: " + expr;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1615 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1616 break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1617 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1618 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1619
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1620 old = expr;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1621 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1622
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1623 return curLoop;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1624 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1625
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1626 var Expr = Sizzle.selectors = {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1627 order: [ "ID", "NAME", "TAG" ],
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1628 match: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1629 ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1630 CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1631 NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1632 ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1633 TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1634 CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1635 POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1636 PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1637 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1638 attrMap: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1639 "class": "className",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1640 "for": "htmlFor"
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1641 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1642 attrHandle: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1643 href: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1644 return elem.getAttribute("href");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1645 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1646 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1647 relative: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1648 "+": function(checkSet, part){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1649 for ( var i = 0, l = checkSet.length; i < l; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1650 var elem = checkSet[i];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1651 if ( elem ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1652 var cur = elem.previousSibling;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1653 while ( cur && cur.nodeType !== 1 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1654 cur = cur.previousSibling;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1655 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1656 checkSet[i] = typeof part === "string" ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1657 cur || false :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1658 cur === part;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1659 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1660 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1661
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1662 if ( typeof part === "string" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1663 Sizzle.filter( part, checkSet, true );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1664 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1665 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1666 ">": function(checkSet, part, isXML){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1667 if ( typeof part === "string" && !/\W/.test(part) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1668 part = isXML ? part : part.toUpperCase();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1669
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1670 for ( var i = 0, l = checkSet.length; i < l; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1671 var elem = checkSet[i];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1672 if ( elem ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1673 var parent = elem.parentNode;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1674 checkSet[i] = parent.nodeName === part ? parent : false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1675 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1676 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1677 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1678 for ( var i = 0, l = checkSet.length; i < l; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1679 var elem = checkSet[i];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1680 if ( elem ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1681 checkSet[i] = typeof part === "string" ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1682 elem.parentNode :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1683 elem.parentNode === part;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1684 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1685 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1686
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1687 if ( typeof part === "string" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1688 Sizzle.filter( part, checkSet, true );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1689 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1690 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1691 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1692 "": function(checkSet, part, isXML){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1693 var doneName = "done" + (done++), checkFn = dirCheck;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1694
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1695 if ( !part.match(/\W/) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1696 var nodeCheck = part = isXML ? part : part.toUpperCase();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1697 checkFn = dirNodeCheck;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1698 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1699
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1700 checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1701 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1702 "~": function(checkSet, part, isXML){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1703 var doneName = "done" + (done++), checkFn = dirCheck;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1704
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1705 if ( typeof part === "string" && !part.match(/\W/) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1706 var nodeCheck = part = isXML ? part : part.toUpperCase();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1707 checkFn = dirNodeCheck;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1708 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1709
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1710 checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1711 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1712 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1713 find: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1714 ID: function(match, context, isXML){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1715 if ( typeof context.getElementById !== "undefined" && !isXML ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1716 var m = context.getElementById(match[1]);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1717 return m ? [m] : [];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1718 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1719 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1720 NAME: function(match, context, isXML){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1721 if ( typeof context.getElementsByName !== "undefined" && !isXML ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1722 return context.getElementsByName(match[1]);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1723 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1724 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1725 TAG: function(match, context){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1726 return context.getElementsByTagName(match[1]);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1727 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1728 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1729 preFilter: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1730 CLASS: function(match, curLoop, inplace, result, not){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1731 match = " " + match[1].replace(/\\/g, "") + " ";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1732
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1733 var elem;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1734 for ( var i = 0; (elem = curLoop[i]) != null; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1735 if ( elem ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1736 if ( not ^ (" " + elem.className + " ").indexOf(match) >= 0 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1737 if ( !inplace )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1738 result.push( elem );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1739 } else if ( inplace ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1740 curLoop[i] = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1741 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1742 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1743 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1744
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1745 return false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1746 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1747 ID: function(match){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1748 return match[1].replace(/\\/g, "");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1749 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1750 TAG: function(match, curLoop){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1751 for ( var i = 0; curLoop[i] === false; i++ ){}
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1752 return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1753 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1754 CHILD: function(match){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1755 if ( match[1] == "nth" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1756 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1757 var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1758 match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1759 !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1760
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1761 // calculate the numbers (first)n+(last) including if they are negative
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1762 match[2] = (test[1] + (test[2] || 1)) - 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1763 match[3] = test[3] - 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1764 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1765
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1766 // TODO: Move to normal caching system
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1767 match[0] = "done" + (done++);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1768
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1769 return match;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1770 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1771 ATTR: function(match){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1772 var name = match[1].replace(/\\/g, "");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1773
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1774 if ( Expr.attrMap[name] ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1775 match[1] = Expr.attrMap[name];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1776 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1777
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1778 if ( match[2] === "~=" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1779 match[4] = " " + match[4] + " ";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1780 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1781
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1782 return match;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1783 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1784 PSEUDO: function(match, curLoop, inplace, result, not){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1785 if ( match[1] === "not" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1786 // If we're dealing with a complex expression, or a simple one
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1787 if ( match[3].match(chunker).length > 1 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1788 match[3] = Sizzle(match[3], null, null, curLoop);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1789 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1790 var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1791 if ( !inplace ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1792 result.push.apply( result, ret );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1793 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1794 return false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1795 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1796 } else if ( Expr.match.POS.test( match[0] ) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1797 return true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1798 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1799
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1800 return match;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1801 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1802 POS: function(match){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1803 match.unshift( true );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1804 return match;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1805 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1806 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1807 filters: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1808 enabled: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1809 return elem.disabled === false && elem.type !== "hidden";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1810 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1811 disabled: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1812 return elem.disabled === true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1813 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1814 checked: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1815 return elem.checked === true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1816 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1817 selected: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1818 // Accessing this property makes selected-by-default
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1819 // options in Safari work properly
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1820 elem.parentNode.selectedIndex;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1821 return elem.selected === true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1822 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1823 parent: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1824 return !!elem.firstChild;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1825 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1826 empty: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1827 return !elem.firstChild;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1828 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1829 has: function(elem, i, match){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1830 return !!Sizzle( match[3], elem ).length;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1831 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1832 header: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1833 return /h\d/i.test( elem.nodeName );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1834 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1835 text: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1836 return "text" === elem.type;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1837 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1838 radio: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1839 return "radio" === elem.type;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1840 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1841 checkbox: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1842 return "checkbox" === elem.type;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1843 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1844 file: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1845 return "file" === elem.type;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1846 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1847 password: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1848 return "password" === elem.type;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1849 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1850 submit: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1851 return "submit" === elem.type;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1852 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1853 image: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1854 return "image" === elem.type;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1855 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1856 reset: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1857 return "reset" === elem.type;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1858 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1859 button: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1860 return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1861 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1862 input: function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1863 return /input|select|textarea|button/i.test(elem.nodeName);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1864 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1865 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1866 setFilters: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1867 first: function(elem, i){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1868 return i === 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1869 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1870 last: function(elem, i, match, array){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1871 return i === array.length - 1;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1872 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1873 even: function(elem, i){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1874 return i % 2 === 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1875 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1876 odd: function(elem, i){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1877 return i % 2 === 1;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1878 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1879 lt: function(elem, i, match){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1880 return i < match[3] - 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1881 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1882 gt: function(elem, i, match){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1883 return i > match[3] - 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1884 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1885 nth: function(elem, i, match){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1886 return match[3] - 0 == i;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1887 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1888 eq: function(elem, i, match){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1889 return match[3] - 0 == i;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1890 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1891 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1892 filter: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1893 CHILD: function(elem, match){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1894 var type = match[1], parent = elem.parentNode;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1895
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1896 var doneName = match[0];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1897
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1898 if ( parent && (!parent[ doneName ] || !elem.nodeIndex) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1899 var count = 1;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1900
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1901 for ( var node = parent.firstChild; node; node = node.nextSibling ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1902 if ( node.nodeType == 1 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1903 node.nodeIndex = count++;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1904 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1905 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1906
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1907 parent[ doneName ] = count - 1;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1908 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1909
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1910 if ( type == "first" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1911 return elem.nodeIndex == 1;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1912 } else if ( type == "last" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1913 return elem.nodeIndex == parent[ doneName ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1914 } else if ( type == "only" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1915 return parent[ doneName ] == 1;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1916 } else if ( type == "nth" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1917 var add = false, first = match[2], last = match[3];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1918
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1919 if ( first == 1 && last == 0 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1920 return true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1921 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1922
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1923 if ( first == 0 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1924 if ( elem.nodeIndex == last ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1925 add = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1926 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1927 } else if ( (elem.nodeIndex - last) % first == 0 && (elem.nodeIndex - last) / first >= 0 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1928 add = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1929 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1930
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1931 return add;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1932 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1933 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1934 PSEUDO: function(elem, match, i, array){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1935 var name = match[1], filter = Expr.filters[ name ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1936
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1937 if ( filter ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1938 return filter( elem, i, match, array );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1939 } else if ( name === "contains" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1940 return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1941 } else if ( name === "not" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1942 var not = match[3];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1943
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1944 for ( var i = 0, l = not.length; i < l; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1945 if ( not[i] === elem ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1946 return false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1947 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1948 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1949
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1950 return true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1951 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1952 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1953 ID: function(elem, match){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1954 return elem.nodeType === 1 && elem.getAttribute("id") === match;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1955 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1956 TAG: function(elem, match){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1957 return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1958 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1959 CLASS: function(elem, match){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1960 return match.test( elem.className );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1961 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1962 ATTR: function(elem, match){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1963 var result = Expr.attrHandle[ match[1] ] ? Expr.attrHandle[ match[1] ]( elem ) : elem[ match[1] ] || elem.getAttribute( match[1] ), value = result + "", type = match[2], check = match[4];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1964 return result == null ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1965 type === "!=" :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1966 type === "=" ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1967 value === check :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1968 type === "*=" ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1969 value.indexOf(check) >= 0 :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1970 type === "~=" ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1971 (" " + value + " ").indexOf(check) >= 0 :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1972 !match[4] ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1973 result :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1974 type === "!=" ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1975 value != check :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1976 type === "^=" ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1977 value.indexOf(check) === 0 :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1978 type === "$=" ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1979 value.substr(value.length - check.length) === check :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1980 type === "|=" ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1981 value === check || value.substr(0, check.length + 1) === check + "-" :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1982 false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1983 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1984 POS: function(elem, match, i, array){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1985 var name = match[2], filter = Expr.setFilters[ name ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1986
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1987 if ( filter ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1988 return filter( elem, i, match, array );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1989 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1990 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1991 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1992 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1993
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1994 var origPOS = Expr.match.POS;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1995
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1996 for ( var type in Expr.match ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1997 Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1998 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
1999
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2000 var makeArray = function(array, results) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2001 array = Array.prototype.slice.call( array );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2002
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2003 if ( results ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2004 results.push.apply( results, array );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2005 return results;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2006 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2007
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2008 return array;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2009 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2010
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2011 // Perform a simple check to determine if the browser is capable of
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2012 // converting a NodeList to an array using builtin methods.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2013 try {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2014 Array.prototype.slice.call( document.documentElement.childNodes );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2015
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2016 // Provide a fallback method if it does not work
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2017 } catch(e){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2018 makeArray = function(array, results) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2019 var ret = results || [];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2020
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2021 if ( toString.call(array) === "[object Array]" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2022 Array.prototype.push.apply( ret, array );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2023 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2024 if ( typeof array.length === "number" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2025 for ( var i = 0, l = array.length; i < l; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2026 ret.push( array[i] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2027 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2028 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2029 for ( var i = 0; array[i]; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2030 ret.push( array[i] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2031 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2032 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2033 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2034
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2035 return ret;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2036 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2037 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2038
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2039 // Check to see if the browser returns elements by name when
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2040 // querying by getElementById (and provide a workaround)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2041 (function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2042 // We're going to inject a fake input element with a specified name
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2043 var form = document.createElement("form"),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2044 id = "script" + (new Date).getTime();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2045 form.innerHTML = "<input name='" + id + "'/>";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2046
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2047 // Inject it into the root element, check its status, and remove it quickly
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2048 var root = document.documentElement;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2049 root.insertBefore( form, root.firstChild );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2050
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2051 // The workaround has to do additional checks after a getElementById
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2052 // Which slows things down for other browsers (hence the branching)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2053 if ( !!document.getElementById( id ) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2054 Expr.find.ID = function(match, context, isXML){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2055 if ( typeof context.getElementById !== "undefined" && !isXML ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2056 var m = context.getElementById(match[1]);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2057 return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2058 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2059 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2060
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2061 Expr.filter.ID = function(elem, match){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2062 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2063 return elem.nodeType === 1 && node && node.nodeValue === match;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2064 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2065 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2066
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2067 root.removeChild( form );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2068 })();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2069
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2070 (function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2071 // Check to see if the browser returns only elements
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2072 // when doing getElementsByTagName("*")
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2073
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2074 // Create a fake element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2075 var div = document.createElement("div");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2076 div.appendChild( document.createComment("") );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2077
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2078 // Make sure no comments are found
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2079 if ( div.getElementsByTagName("*").length > 0 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2080 Expr.find.TAG = function(match, context){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2081 var results = context.getElementsByTagName(match[1]);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2082
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2083 // Filter out possible comments
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2084 if ( match[1] === "*" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2085 var tmp = [];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2086
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2087 for ( var i = 0; results[i]; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2088 if ( results[i].nodeType === 1 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2089 tmp.push( results[i] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2090 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2091 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2092
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2093 results = tmp;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2094 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2095
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2096 return results;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2097 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2098 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2099
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2100 // Check to see if an attribute returns normalized href attributes
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2101 div.innerHTML = "<a href='#'></a>";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2102 if ( div.firstChild && div.firstChild.getAttribute("href") !== "#" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2103 Expr.attrHandle.href = function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2104 return elem.getAttribute("href", 2);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2105 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2106 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2107 })();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2108
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2109 if ( document.querySelectorAll ) (function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2110 var oldSizzle = Sizzle, div = document.createElement("div");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2111 div.innerHTML = "<p class='TEST'></p>";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2112
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2113 // Safari can't handle uppercase or unicode characters when
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2114 // in quirks mode.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2115 if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2116 return;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2117 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2118
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2119 Sizzle = function(query, context, extra, seed){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2120 context = context || document;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2121
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2122 // Only use querySelectorAll on non-XML documents
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2123 // (ID selectors don't work in non-HTML documents)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2124 if ( !seed && context.nodeType === 9 && !isXML(context) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2125 try {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2126 return makeArray( context.querySelectorAll(query), extra );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2127 } catch(e){}
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2128 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2129
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2130 return oldSizzle(query, context, extra, seed);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2131 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2132
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2133 Sizzle.find = oldSizzle.find;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2134 Sizzle.filter = oldSizzle.filter;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2135 Sizzle.selectors = oldSizzle.selectors;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2136 Sizzle.matches = oldSizzle.matches;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2137 })();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2138
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2139 if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2140 Expr.order.splice(1, 0, "CLASS");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2141 Expr.find.CLASS = function(match, context) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2142 return context.getElementsByClassName(match[1]);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2143 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2144 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2145
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2146 function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2147 for ( var i = 0, l = checkSet.length; i < l; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2148 var elem = checkSet[i];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2149 if ( elem ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2150 elem = elem[dir];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2151 var match = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2152
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2153 while ( elem && elem.nodeType ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2154 var done = elem[doneName];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2155 if ( done ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2156 match = checkSet[ done ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2157 break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2158 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2159
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2160 if ( elem.nodeType === 1 && !isXML )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2161 elem[doneName] = i;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2162
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2163 if ( elem.nodeName === cur ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2164 match = elem;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2165 break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2166 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2167
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2168 elem = elem[dir];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2169 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2170
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2171 checkSet[i] = match;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2172 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2173 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2174 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2175
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2176 function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2177 for ( var i = 0, l = checkSet.length; i < l; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2178 var elem = checkSet[i];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2179 if ( elem ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2180 elem = elem[dir];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2181 var match = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2182
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2183 while ( elem && elem.nodeType ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2184 if ( elem[doneName] ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2185 match = checkSet[ elem[doneName] ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2186 break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2187 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2188
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2189 if ( elem.nodeType === 1 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2190 if ( !isXML )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2191 elem[doneName] = i;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2192
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2193 if ( typeof cur !== "string" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2194 if ( elem === cur ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2195 match = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2196 break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2197 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2198
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2199 } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2200 match = elem;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2201 break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2202 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2203 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2204
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2205 elem = elem[dir];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2206 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2207
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2208 checkSet[i] = match;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2209 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2210 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2211 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2212
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2213 var contains = document.compareDocumentPosition ? function(a, b){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2214 return a.compareDocumentPosition(b) & 16;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2215 } : function(a, b){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2216 return a !== b && (a.contains ? a.contains(b) : true);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2217 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2218
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2219 var isXML = function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2220 return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2221 !!elem.ownerDocument && isXML( elem.ownerDocument );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2222 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2223
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2224 var posProcess = function(selector, context){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2225 var tmpSet = [], later = "", match,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2226 root = context.nodeType ? [context] : context;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2227
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2228 // Position selectors must be done after the filter
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2229 // And so must :not(positional) so we move all PSEUDOs to the end
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2230 while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2231 later += match[0];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2232 selector = selector.replace( Expr.match.PSEUDO, "" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2233 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2234
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2235 selector = Expr.relative[selector] ? selector + "*" : selector;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2236
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2237 for ( var i = 0, l = root.length; i < l; i++ ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2238 Sizzle( selector, root[i], tmpSet );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2239 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2240
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2241 return Sizzle.filter( later, tmpSet );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2242 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2243
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2244 // EXPOSE
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2245 jQuery.find = Sizzle;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2246 jQuery.filter = Sizzle.filter;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2247 jQuery.expr = Sizzle.selectors;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2248 jQuery.expr[":"] = jQuery.expr.filters;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2249
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2250 Sizzle.selectors.filters.hidden = function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2251 return "hidden" === elem.type ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2252 jQuery.css(elem, "display") === "none" ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2253 jQuery.css(elem, "visibility") === "hidden";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2254 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2255
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2256 Sizzle.selectors.filters.visible = function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2257 return "hidden" !== elem.type &&
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2258 jQuery.css(elem, "display") !== "none" &&
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2259 jQuery.css(elem, "visibility") !== "hidden";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2260 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2261
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2262 Sizzle.selectors.filters.animated = function(elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2263 return jQuery.grep(jQuery.timers, function(fn){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2264 return elem === fn.elem;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2265 }).length;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2266 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2267
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2268 jQuery.multiFilter = function( expr, elems, not ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2269 if ( not ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2270 expr = ":not(" + expr + ")";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2271 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2272
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2273 return Sizzle.matches(expr, elems);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2274 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2275
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2276 jQuery.dir = function( elem, dir ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2277 var matched = [], cur = elem[dir];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2278 while ( cur && cur != document ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2279 if ( cur.nodeType == 1 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2280 matched.push( cur );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2281 cur = cur[dir];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2282 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2283 return matched;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2284 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2285
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2286 jQuery.nth = function(cur, result, dir, elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2287 result = result || 1;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2288 var num = 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2289
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2290 for ( ; cur; cur = cur[dir] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2291 if ( cur.nodeType == 1 && ++num == result )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2292 break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2293
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2294 return cur;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2295 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2296
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2297 jQuery.sibling = function(n, elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2298 var r = [];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2299
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2300 for ( ; n; n = n.nextSibling ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2301 if ( n.nodeType == 1 && n != elem )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2302 r.push( n );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2303 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2304
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2305 return r;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2306 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2307
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2308 return;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2309
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2310 window.Sizzle = Sizzle;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2311
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2312 })();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2313 /*
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2314 * A number of helper functions used for managing events.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2315 * Many of the ideas behind this code originated from
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2316 * Dean Edwards' addEvent library.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2317 */
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2318 jQuery.event = {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2319
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2320 // Bind an event to an element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2321 // Original by Dean Edwards
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2322 add: function(elem, types, handler, data) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2323 if ( elem.nodeType == 3 || elem.nodeType == 8 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2324 return;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2325
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2326 // For whatever reason, IE has trouble passing the window object
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2327 // around, causing it to be cloned in the process
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2328 if ( elem.setInterval && elem != window )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2329 elem = window;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2330
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2331 // Make sure that the function being executed has a unique ID
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2332 if ( !handler.guid )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2333 handler.guid = this.guid++;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2334
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2335 // if data is passed, bind to handler
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2336 if ( data !== undefined ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2337 // Create temporary function pointer to original handler
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2338 var fn = handler;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2339
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2340 // Create unique handler function, wrapped around original handler
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2341 handler = this.proxy( fn );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2342
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2343 // Store data in unique handler
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2344 handler.data = data;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2345 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2346
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2347 // Init the element's event structure
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2348 var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2349 handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2350 // Handle the second event of a trigger and when
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2351 // an event is called after a page has unloaded
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2352 return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2353 jQuery.event.handle.apply(arguments.callee.elem, arguments) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2354 undefined;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2355 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2356 // Add elem as a property of the handle function
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2357 // This is to prevent a memory leak with non-native
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2358 // event in IE.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2359 handle.elem = elem;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2360
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2361 // Handle multiple events separated by a space
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2362 // jQuery(...).bind("mouseover mouseout", fn);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2363 jQuery.each(types.split(/\s+/), function(index, type) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2364 // Namespaced event handlers
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2365 var namespaces = type.split(".");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2366 type = namespaces.shift();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2367 handler.type = namespaces.slice().sort().join(".");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2368
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2369 // Get the current list of functions bound to this event
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2370 var handlers = events[type];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2371
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2372 if ( jQuery.event.specialAll[type] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2373 jQuery.event.specialAll[type].setup.call(elem, data, namespaces);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2374
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2375 // Init the event handler queue
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2376 if (!handlers) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2377 handlers = events[type] = {};
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2378
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2379 // Check for a special event handler
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2380 // Only use addEventListener/attachEvent if the special
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2381 // events handler returns false
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2382 if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem, data, namespaces) === false ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2383 // Bind the global event handler to the element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2384 if (elem.addEventListener)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2385 elem.addEventListener(type, handle, false);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2386 else if (elem.attachEvent)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2387 elem.attachEvent("on" + type, handle);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2388 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2389 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2390
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2391 // Add the function to the element's handler list
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2392 handlers[handler.guid] = handler;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2393
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2394 // Keep track of which events have been used, for global triggering
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2395 jQuery.event.global[type] = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2396 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2397
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2398 // Nullify elem to prevent memory leaks in IE
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2399 elem = null;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2400 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2401
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2402 guid: 1,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2403 global: {},
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2404
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2405 // Detach an event or set of events from an element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2406 remove: function(elem, types, handler) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2407 // don't do events on text and comment nodes
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2408 if ( elem.nodeType == 3 || elem.nodeType == 8 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2409 return;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2410
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2411 var events = jQuery.data(elem, "events"), ret, index;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2412
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2413 if ( events ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2414 // Unbind all events for the element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2415 if ( types === undefined || (typeof types === "string" && types.charAt(0) == ".") )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2416 for ( var type in events )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2417 this.remove( elem, type + (types || "") );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2418 else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2419 // types is actually an event object here
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2420 if ( types.type ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2421 handler = types.handler;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2422 types = types.type;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2423 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2424
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2425 // Handle multiple events seperated by a space
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2426 // jQuery(...).unbind("mouseover mouseout", fn);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2427 jQuery.each(types.split(/\s+/), function(index, type){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2428 // Namespaced event handlers
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2429 var namespaces = type.split(".");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2430 type = namespaces.shift();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2431 var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2432
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2433 if ( events[type] ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2434 // remove the given handler for the given type
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2435 if ( handler )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2436 delete events[type][handler.guid];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2437
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2438 // remove all handlers for the given type
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2439 else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2440 for ( var handle in events[type] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2441 // Handle the removal of namespaced events
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2442 if ( namespace.test(events[type][handle].type) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2443 delete events[type][handle];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2444
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2445 if ( jQuery.event.specialAll[type] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2446 jQuery.event.specialAll[type].teardown.call(elem, namespaces);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2447
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2448 // remove generic event handler if no more handlers exist
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2449 for ( ret in events[type] ) break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2450 if ( !ret ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2451 if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem, namespaces) === false ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2452 if (elem.removeEventListener)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2453 elem.removeEventListener(type, jQuery.data(elem, "handle"), false);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2454 else if (elem.detachEvent)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2455 elem.detachEvent("on" + type, jQuery.data(elem, "handle"));
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2456 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2457 ret = null;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2458 delete events[type];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2459 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2460 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2461 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2462 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2463
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2464 // Remove the expando if it's no longer used
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2465 for ( ret in events ) break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2466 if ( !ret ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2467 var handle = jQuery.data( elem, "handle" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2468 if ( handle ) handle.elem = null;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2469 jQuery.removeData( elem, "events" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2470 jQuery.removeData( elem, "handle" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2471 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2472 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2473 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2474
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2475 // bubbling is internal
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2476 trigger: function( event, data, elem, bubbling ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2477 // Event object or event type
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2478 var type = event.type || event;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2479
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2480 if( !bubbling ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2481 event = typeof event === "object" ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2482 // jQuery.Event object
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2483 event[expando] ? event :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2484 // Object literal
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2485 jQuery.extend( jQuery.Event(type), event ) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2486 // Just the event type (string)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2487 jQuery.Event(type);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2488
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2489 if ( type.indexOf("!") >= 0 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2490 event.type = type = type.slice(0, -1);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2491 event.exclusive = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2492 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2493
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2494 // Handle a global trigger
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2495 if ( !elem ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2496 // Don't bubble custom events when global (to avoid too much overhead)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2497 event.stopPropagation();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2498 // Only trigger if we've ever bound an event for it
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2499 if ( this.global[type] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2500 jQuery.each( jQuery.cache, function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2501 if ( this.events && this.events[type] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2502 jQuery.event.trigger( event, data, this.handle.elem );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2503 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2504 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2505
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2506 // Handle triggering a single element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2507
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2508 // don't do events on text and comment nodes
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2509 if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2510 return undefined;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2511
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2512 // Clean up in case it is reused
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2513 event.result = undefined;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2514 event.target = elem;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2515
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2516 // Clone the incoming data, if any
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2517 data = jQuery.makeArray(data);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2518 data.unshift( event );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2519 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2520
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2521 event.currentTarget = elem;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2522
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2523 // Trigger the event, it is assumed that "handle" is a function
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2524 var handle = jQuery.data(elem, "handle");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2525 if ( handle )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2526 handle.apply( elem, data );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2527
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2528 // Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2529 if ( (!elem[type] || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2530 event.result = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2531
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2532 // Trigger the native events (except for clicks on links)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2533 if ( !bubbling && elem[type] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type == "click") ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2534 this.triggered = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2535 try {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2536 elem[ type ]();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2537 // prevent IE from throwing an error for some hidden elements
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2538 } catch (e) {}
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2539 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2540
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2541 this.triggered = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2542
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2543 if ( !event.isPropagationStopped() ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2544 var parent = elem.parentNode || elem.ownerDocument;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2545 if ( parent )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2546 jQuery.event.trigger(event, data, parent, true);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2547 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2548 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2549
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2550 handle: function(event) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2551 // returned undefined or false
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2552 var all, handlers;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2553
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2554 event = arguments[0] = jQuery.event.fix( event || window.event );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2555
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2556 // Namespaced event handlers
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2557 var namespaces = event.type.split(".");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2558 event.type = namespaces.shift();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2559
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2560 // Cache this now, all = true means, any handler
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2561 all = !namespaces.length && !event.exclusive;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2562
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2563 var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2564
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2565 handlers = ( jQuery.data(this, "events") || {} )[event.type];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2566
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2567 for ( var j in handlers ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2568 var handler = handlers[j];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2569
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2570 // Filter the functions by class
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2571 if ( all || namespace.test(handler.type) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2572 // Pass in a reference to the handler function itself
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2573 // So that we can later remove it
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2574 event.handler = handler;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2575 event.data = handler.data;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2576
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2577 var ret = handler.apply(this, arguments);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2578
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2579 if( ret !== undefined ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2580 event.result = ret;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2581 if ( ret === false ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2582 event.preventDefault();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2583 event.stopPropagation();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2584 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2585 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2586
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2587 if( event.isImmediatePropagationStopped() )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2588 break;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2589
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2590 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2591 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2592 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2593
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2594 props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2595
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2596 fix: function(event) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2597 if ( event[expando] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2598 return event;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2599
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2600 // store a copy of the original event object
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2601 // and "clone" to set read-only properties
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2602 var originalEvent = event;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2603 event = jQuery.Event( originalEvent );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2604
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2605 for ( var i = this.props.length, prop; i; ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2606 prop = this.props[ --i ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2607 event[ prop ] = originalEvent[ prop ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2608 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2609
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2610 // Fix target property, if necessary
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2611 if ( !event.target )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2612 event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2613
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2614 // check if target is a textnode (safari)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2615 if ( event.target.nodeType == 3 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2616 event.target = event.target.parentNode;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2617
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2618 // Add relatedTarget, if necessary
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2619 if ( !event.relatedTarget && event.fromElement )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2620 event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2621
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2622 // Calculate pageX/Y if missing and clientX/Y available
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2623 if ( event.pageX == null && event.clientX != null ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2624 var doc = document.documentElement, body = document.body;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2625 event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2626 event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2627 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2628
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2629 // Add which for key events
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2630 if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2631 event.which = event.charCode || event.keyCode;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2632
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2633 // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2634 if ( !event.metaKey && event.ctrlKey )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2635 event.metaKey = event.ctrlKey;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2636
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2637 // Add which for click: 1 == left; 2 == middle; 3 == right
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2638 // Note: button is not normalized, so don't use it
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2639 if ( !event.which && event.button )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2640 event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2641
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2642 return event;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2643 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2644
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2645 proxy: function( fn, proxy ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2646 proxy = proxy || function(){ return fn.apply(this, arguments); };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2647 // Set the guid of unique handler to the same of original handler, so it can be removed
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2648 proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2649 // So proxy can be declared as an argument
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2650 return proxy;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2651 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2652
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2653 special: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2654 ready: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2655 // Make sure the ready event is setup
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2656 setup: bindReady,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2657 teardown: function() {}
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2658 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2659 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2660
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2661 specialAll: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2662 live: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2663 setup: function( selector, namespaces ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2664 jQuery.event.add( this, namespaces[0], liveHandler );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2665 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2666 teardown: function( namespaces ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2667 if ( namespaces.length ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2668 var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2669
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2670 jQuery.each( (jQuery.data(this, "events").live || {}), function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2671 if ( name.test(this.type) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2672 remove++;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2673 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2674
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2675 if ( remove < 1 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2676 jQuery.event.remove( this, namespaces[0], liveHandler );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2677 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2678 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2679 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2680 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2681 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2682
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2683 jQuery.Event = function( src ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2684 // Allow instantiation without the 'new' keyword
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2685 if( !this.preventDefault )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2686 return new jQuery.Event(src);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2687
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2688 // Event object
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2689 if( src && src.type ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2690 this.originalEvent = src;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2691 this.type = src.type;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2692 // Event type
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2693 }else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2694 this.type = src;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2695
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2696 // timeStamp is buggy for some events on Firefox(#3843)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2697 // So we won't rely on the native value
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2698 this.timeStamp = now();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2699
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2700 // Mark it as fixed
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2701 this[expando] = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2702 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2703
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2704 function returnFalse(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2705 return false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2706 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2707 function returnTrue(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2708 return true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2709 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2710
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2711 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2712 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2713 jQuery.Event.prototype = {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2714 preventDefault: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2715 this.isDefaultPrevented = returnTrue;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2716
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2717 var e = this.originalEvent;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2718 if( !e )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2719 return;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2720 // if preventDefault exists run it on the original event
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2721 if (e.preventDefault)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2722 e.preventDefault();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2723 // otherwise set the returnValue property of the original event to false (IE)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2724 e.returnValue = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2725 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2726 stopPropagation: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2727 this.isPropagationStopped = returnTrue;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2728
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2729 var e = this.originalEvent;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2730 if( !e )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2731 return;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2732 // if stopPropagation exists run it on the original event
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2733 if (e.stopPropagation)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2734 e.stopPropagation();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2735 // otherwise set the cancelBubble property of the original event to true (IE)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2736 e.cancelBubble = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2737 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2738 stopImmediatePropagation:function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2739 this.isImmediatePropagationStopped = returnTrue;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2740 this.stopPropagation();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2741 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2742 isDefaultPrevented: returnFalse,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2743 isPropagationStopped: returnFalse,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2744 isImmediatePropagationStopped: returnFalse
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2745 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2746 // Checks if an event happened on an element within another element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2747 // Used in jQuery.event.special.mouseenter and mouseleave handlers
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2748 var withinElement = function(event) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2749 // Check if mouse(over|out) are still within the same parent element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2750 var parent = event.relatedTarget;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2751 // Traverse up the tree
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2752 while ( parent && parent != this )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2753 try { parent = parent.parentNode; }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2754 catch(e) { parent = this; }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2755
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2756 if( parent != this ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2757 // set the correct event type
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2758 event.type = event.data;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2759 // handle event if we actually just moused on to a non sub-element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2760 jQuery.event.handle.apply( this, arguments );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2761 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2762 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2763
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2764 jQuery.each({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2765 mouseover: 'mouseenter',
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2766 mouseout: 'mouseleave'
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2767 }, function( orig, fix ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2768 jQuery.event.special[ fix ] = {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2769 setup: function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2770 jQuery.event.add( this, orig, withinElement, fix );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2771 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2772 teardown: function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2773 jQuery.event.remove( this, orig, withinElement );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2774 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2775 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2776 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2777
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2778 jQuery.fn.extend({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2779 bind: function( type, data, fn ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2780 return type == "unload" ? this.one(type, data, fn) : this.each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2781 jQuery.event.add( this, type, fn || data, fn && data );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2782 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2783 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2784
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2785 one: function( type, data, fn ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2786 var one = jQuery.event.proxy( fn || data, function(event) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2787 jQuery(this).unbind(event, one);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2788 return (fn || data).apply( this, arguments );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2789 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2790 return this.each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2791 jQuery.event.add( this, type, one, fn && data);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2792 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2793 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2794
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2795 unbind: function( type, fn ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2796 return this.each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2797 jQuery.event.remove( this, type, fn );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2798 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2799 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2800
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2801 trigger: function( type, data ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2802 return this.each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2803 jQuery.event.trigger( type, data, this );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2804 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2805 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2806
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2807 triggerHandler: function( type, data ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2808 if( this[0] ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2809 var event = jQuery.Event(type);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2810 event.preventDefault();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2811 event.stopPropagation();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2812 jQuery.event.trigger( event, data, this[0] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2813 return event.result;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2814 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2815 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2816
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2817 toggle: function( fn ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2818 // Save reference to arguments for access in closure
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2819 var args = arguments, i = 1;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2820
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2821 // link all the functions, so any of them can unbind this click handler
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2822 while( i < args.length )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2823 jQuery.event.proxy( fn, args[i++] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2824
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2825 return this.click( jQuery.event.proxy( fn, function(event) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2826 // Figure out which function to execute
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2827 this.lastToggle = ( this.lastToggle || 0 ) % i;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2828
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2829 // Make sure that clicks stop
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2830 event.preventDefault();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2831
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2832 // and execute the function
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2833 return args[ this.lastToggle++ ].apply( this, arguments ) || false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2834 }));
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2835 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2836
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2837 hover: function(fnOver, fnOut) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2838 return this.mouseenter(fnOver).mouseleave(fnOut);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2839 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2840
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2841 ready: function(fn) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2842 // Attach the listeners
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2843 bindReady();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2844
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2845 // If the DOM is already ready
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2846 if ( jQuery.isReady )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2847 // Execute the function immediately
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2848 fn.call( document, jQuery );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2849
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2850 // Otherwise, remember the function for later
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2851 else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2852 // Add the function to the wait list
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2853 jQuery.readyList.push( fn );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2854
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2855 return this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2856 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2857
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2858 live: function( type, fn ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2859 var proxy = jQuery.event.proxy( fn );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2860 proxy.guid += this.selector + type;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2861
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2862 jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2863
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2864 return this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2865 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2866
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2867 die: function( type, fn ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2868 jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2869 return this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2870 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2871 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2872
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2873 function liveHandler( event ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2874 var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2875 stop = true,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2876 elems = [];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2877
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2878 jQuery.each(jQuery.data(this, "events").live || [], function(i, fn){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2879 if ( check.test(fn.type) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2880 var elem = jQuery(event.target).closest(fn.data)[0];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2881 if ( elem )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2882 elems.push({ elem: elem, fn: fn });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2883 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2884 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2885
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2886 jQuery.each(elems, function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2887 if ( this.fn.call(this.elem, event, this.fn.data) === false )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2888 stop = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2889 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2890
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2891 return stop;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2892 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2893
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2894 function liveConvert(type, selector){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2895 return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "|")].join(".");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2896 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2897
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2898 jQuery.extend({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2899 isReady: false,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2900 readyList: [],
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2901 // Handle when the DOM is ready
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2902 ready: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2903 // Make sure that the DOM is not already loaded
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2904 if ( !jQuery.isReady ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2905 // Remember that the DOM is ready
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2906 jQuery.isReady = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2907
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2908 // If there are functions bound, to execute
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2909 if ( jQuery.readyList ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2910 // Execute all of them
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2911 jQuery.each( jQuery.readyList, function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2912 this.call( document, jQuery );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2913 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2914
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2915 // Reset the list of functions
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2916 jQuery.readyList = null;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2917 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2918
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2919 // Trigger any bound ready events
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2920 jQuery(document).triggerHandler("ready");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2921 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2922 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2923 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2924
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2925 var readyBound = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2926
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2927 function bindReady(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2928 if ( readyBound ) return;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2929 readyBound = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2930
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2931 // Mozilla, Opera and webkit nightlies currently support this event
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2932 if ( document.addEventListener ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2933 // Use the handy event callback
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2934 document.addEventListener( "DOMContentLoaded", function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2935 document.removeEventListener( "DOMContentLoaded", arguments.callee, false );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2936 jQuery.ready();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2937 }, false );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2938
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2939 // If IE event model is used
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2940 } else if ( document.attachEvent ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2941 // ensure firing before onload,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2942 // maybe late but safe also for iframes
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2943 document.attachEvent("onreadystatechange", function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2944 if ( document.readyState === "complete" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2945 document.detachEvent( "onreadystatechange", arguments.callee );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2946 jQuery.ready();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2947 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2948 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2949
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2950 // If IE and not an iframe
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2951 // continually check to see if the document is ready
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2952 if ( document.documentElement.doScroll && typeof window.frameElement === "undefined" ) (function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2953 if ( jQuery.isReady ) return;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2954
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2955 try {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2956 // If IE is used, use the trick by Diego Perini
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2957 // http://javascript.nwbox.com/IEContentLoaded/
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2958 document.documentElement.doScroll("left");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2959 } catch( error ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2960 setTimeout( arguments.callee, 0 );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2961 return;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2962 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2963
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2964 // and execute any waiting functions
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2965 jQuery.ready();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2966 })();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2967 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2968
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2969 // A fallback to window.onload, that will always work
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2970 jQuery.event.add( window, "load", jQuery.ready );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2971 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2972
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2973 jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2974 "mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," +
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2975 "change,select,submit,keydown,keypress,keyup,error").split(","), function(i, name){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2976
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2977 // Handle event binding
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2978 jQuery.fn[name] = function(fn){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2979 return fn ? this.bind(name, fn) : this.trigger(name);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2980 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2981 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2982
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2983 // Prevent memory leaks in IE
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2984 // And prevent errors on refresh with events like mouseover in other browsers
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2985 // Window isn't included so as not to unbind existing unload events
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2986 jQuery( window ).bind( 'unload', function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2987 for ( var id in jQuery.cache )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2988 // Skip the window
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2989 if ( id != 1 && jQuery.cache[ id ].handle )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2990 jQuery.event.remove( jQuery.cache[ id ].handle.elem );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2991 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2992 (function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2993
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2994 jQuery.support = {};
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2995
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2996 var root = document.documentElement,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2997 script = document.createElement("script"),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2998 div = document.createElement("div"),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
2999 id = "script" + (new Date).getTime();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3000
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3001 div.style.display = "none";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3002 div.innerHTML = ' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3003
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3004 var all = div.getElementsByTagName("*"),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3005 a = div.getElementsByTagName("a")[0];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3006
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3007 // Can't get basic test support
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3008 if ( !all || !all.length || !a ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3009 return;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3010 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3011
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3012 jQuery.support = {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3013 // IE strips leading whitespace when .innerHTML is used
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3014 leadingWhitespace: div.firstChild.nodeType == 3,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3015
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3016 // Make sure that tbody elements aren't automatically inserted
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3017 // IE will insert them into empty tables
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3018 tbody: !div.getElementsByTagName("tbody").length,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3019
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3020 // Make sure that you can get all elements in an <object> element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3021 // IE 7 always returns no results
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3022 objectAll: !!div.getElementsByTagName("object")[0]
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3023 .getElementsByTagName("*").length,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3024
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3025 // Make sure that link elements get serialized correctly by innerHTML
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3026 // This requires a wrapper element in IE
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3027 htmlSerialize: !!div.getElementsByTagName("link").length,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3028
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3029 // Get the style information from getAttribute
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3030 // (IE uses .cssText insted)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3031 style: /red/.test( a.getAttribute("style") ),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3032
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3033 // Make sure that URLs aren't manipulated
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3034 // (IE normalizes it by default)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3035 hrefNormalized: a.getAttribute("href") === "/a",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3036
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3037 // Make sure that element opacity exists
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3038 // (IE uses filter instead)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3039 opacity: a.style.opacity === "0.5",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3040
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3041 // Verify style float existence
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3042 // (IE uses styleFloat instead of cssFloat)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3043 cssFloat: !!a.style.cssFloat,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3044
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3045 // Will be defined later
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3046 scriptEval: false,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3047 noCloneEvent: true,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3048 boxModel: null
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3049 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3050
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3051 script.type = "text/javascript";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3052 try {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3053 script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3054 } catch(e){}
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3055
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3056 root.insertBefore( script, root.firstChild );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3057
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3058 // Make sure that the execution of code works by injecting a script
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3059 // tag with appendChild/createTextNode
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3060 // (IE doesn't support this, fails, and uses .text instead)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3061 if ( window[ id ] ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3062 jQuery.support.scriptEval = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3063 delete window[ id ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3064 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3065
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3066 root.removeChild( script );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3067
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3068 if ( div.attachEvent && div.fireEvent ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3069 div.attachEvent("onclick", function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3070 // Cloning a node shouldn't copy over any
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3071 // bound event handlers (IE does this)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3072 jQuery.support.noCloneEvent = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3073 div.detachEvent("onclick", arguments.callee);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3074 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3075 div.cloneNode(true).fireEvent("onclick");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3076 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3077
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3078 // Figure out if the W3C box model works as expected
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3079 // document.body must exist before we can do this
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3080 jQuery(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3081 var div = document.createElement("div");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3082 div.style.width = "1px";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3083 div.style.paddingLeft = "1px";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3084
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3085 document.body.appendChild( div );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3086 jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3087 document.body.removeChild( div );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3088 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3089 })();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3090
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3091 var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3092
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3093 jQuery.props = {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3094 "for": "htmlFor",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3095 "class": "className",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3096 "float": styleFloat,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3097 cssFloat: styleFloat,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3098 styleFloat: styleFloat,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3099 readonly: "readOnly",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3100 maxlength: "maxLength",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3101 cellspacing: "cellSpacing",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3102 rowspan: "rowSpan",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3103 tabindex: "tabIndex"
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3104 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3105 jQuery.fn.extend({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3106 // Keep a copy of the old load
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3107 _load: jQuery.fn.load,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3108
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3109 load: function( url, params, callback ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3110 if ( typeof url !== "string" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3111 return this._load( url );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3112
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3113 var off = url.indexOf(" ");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3114 if ( off >= 0 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3115 var selector = url.slice(off, url.length);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3116 url = url.slice(0, off);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3117 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3118
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3119 // Default to a GET request
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3120 var type = "GET";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3121
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3122 // If the second parameter was provided
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3123 if ( params )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3124 // If it's a function
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3125 if ( jQuery.isFunction( params ) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3126 // We assume that it's the callback
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3127 callback = params;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3128 params = null;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3129
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3130 // Otherwise, build a param string
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3131 } else if( typeof params === "object" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3132 params = jQuery.param( params );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3133 type = "POST";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3134 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3135
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3136 var self = this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3137
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3138 // Request the remote document
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3139 jQuery.ajax({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3140 url: url,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3141 type: type,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3142 dataType: "html",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3143 data: params,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3144 complete: function(res, status){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3145 // If successful, inject the HTML into all the matched elements
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3146 if ( status == "success" || status == "notmodified" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3147 // See if a selector was specified
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3148 self.html( selector ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3149 // Create a dummy div to hold the results
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3150 jQuery("<div/>")
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3151 // inject the contents of the document in, removing the scripts
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3152 // to avoid any 'Permission Denied' errors in IE
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3153 .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3154
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3155 // Locate the specified elements
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3156 .find(selector) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3157
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3158 // If not, just inject the full result
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3159 res.responseText );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3160
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3161 if( callback )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3162 self.each( callback, [res.responseText, status, res] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3163 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3164 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3165 return this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3166 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3167
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3168 serialize: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3169 return jQuery.param(this.serializeArray());
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3170 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3171 serializeArray: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3172 return this.map(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3173 return this.elements ? jQuery.makeArray(this.elements) : this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3174 })
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3175 .filter(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3176 return this.name && !this.disabled &&
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3177 (this.checked || /select|textarea/i.test(this.nodeName) ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3178 /text|hidden|password/i.test(this.type));
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3179 })
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3180 .map(function(i, elem){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3181 var val = jQuery(this).val();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3182 return val == null ? null :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3183 jQuery.isArray(val) ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3184 jQuery.map( val, function(val, i){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3185 return {name: elem.name, value: val};
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3186 }) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3187 {name: elem.name, value: val};
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3188 }).get();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3189 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3190 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3191
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3192 // Attach a bunch of functions for handling common AJAX events
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3193 jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3194 jQuery.fn[o] = function(f){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3195 return this.bind(o, f);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3196 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3197 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3198
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3199 var jsc = now();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3200
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3201 jQuery.extend({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3202
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3203 get: function( url, data, callback, type ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3204 // shift arguments if data argument was ommited
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3205 if ( jQuery.isFunction( data ) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3206 callback = data;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3207 data = null;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3208 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3209
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3210 return jQuery.ajax({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3211 type: "GET",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3212 url: url,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3213 data: data,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3214 success: callback,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3215 dataType: type
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3216 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3217 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3218
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3219 getScript: function( url, callback ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3220 return jQuery.get(url, null, callback, "script");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3221 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3222
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3223 getJSON: function( url, data, callback ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3224 return jQuery.get(url, data, callback, "json");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3225 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3226
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3227 post: function( url, data, callback, type ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3228 if ( jQuery.isFunction( data ) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3229 callback = data;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3230 data = {};
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3231 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3232
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3233 return jQuery.ajax({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3234 type: "POST",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3235 url: url,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3236 data: data,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3237 success: callback,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3238 dataType: type
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3239 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3240 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3241
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3242 ajaxSetup: function( settings ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3243 jQuery.extend( jQuery.ajaxSettings, settings );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3244 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3245
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3246 ajaxSettings: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3247 url: location.href,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3248 global: true,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3249 type: "GET",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3250 contentType: "application/x-www-form-urlencoded",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3251 processData: true,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3252 async: true,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3253 /*
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3254 timeout: 0,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3255 data: null,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3256 username: null,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3257 password: null,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3258 */
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3259 // Create the request object; Microsoft failed to properly
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3260 // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3261 // This function can be overriden by calling jQuery.ajaxSetup
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3262 xhr:function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3263 return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3264 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3265 accepts: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3266 xml: "application/xml, text/xml",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3267 html: "text/html",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3268 script: "text/javascript, application/javascript",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3269 json: "application/json, text/javascript",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3270 text: "text/plain",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3271 _default: "*/*"
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3272 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3273 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3274
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3275 // Last-Modified header cache for next request
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3276 lastModified: {},
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3277
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3278 ajax: function( s ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3279 // Extend the settings, but re-extend 's' so that it can be
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3280 // checked again later (in the test suite, specifically)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3281 s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3282
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3283 var jsonp, jsre = /=\?(&|$)/g, status, data,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3284 type = s.type.toUpperCase();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3285
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3286 // convert data if not already a string
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3287 if ( s.data && s.processData && typeof s.data !== "string" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3288 s.data = jQuery.param(s.data);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3289
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3290 // Handle JSONP Parameter Callbacks
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3291 if ( s.dataType == "jsonp" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3292 if ( type == "GET" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3293 if ( !s.url.match(jsre) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3294 s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3295 } else if ( !s.data || !s.data.match(jsre) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3296 s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3297 s.dataType = "json";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3298 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3299
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3300 // Build temporary JSONP function
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3301 if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3302 jsonp = "jsonp" + jsc++;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3303
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3304 // Replace the =? sequence both in the query string and the data
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3305 if ( s.data )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3306 s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3307 s.url = s.url.replace(jsre, "=" + jsonp + "$1");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3308
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3309 // We need to make sure
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3310 // that a JSONP style response is executed properly
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3311 s.dataType = "script";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3312
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3313 // Handle JSONP-style loading
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3314 window[ jsonp ] = function(tmp){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3315 data = tmp;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3316 success();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3317 complete();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3318 // Garbage collect
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3319 window[ jsonp ] = undefined;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3320 try{ delete window[ jsonp ]; } catch(e){}
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3321 if ( head )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3322 head.removeChild( script );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3323 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3324 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3325
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3326 if ( s.dataType == "script" && s.cache == null )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3327 s.cache = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3328
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3329 if ( s.cache === false && type == "GET" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3330 var ts = now();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3331 // try replacing _= if it is there
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3332 var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3333 // if nothing was replaced, add timestamp to the end
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3334 s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3335 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3336
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3337 // If data is available, append data to url for get requests
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3338 if ( s.data && type == "GET" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3339 s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3340
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3341 // IE likes to send both get and post data, prevent this
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3342 s.data = null;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3343 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3344
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3345 // Watch for a new set of requests
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3346 if ( s.global && ! jQuery.active++ )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3347 jQuery.event.trigger( "ajaxStart" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3348
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3349 // Matches an absolute URL, and saves the domain
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3350 var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3351
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3352 // If we're requesting a remote document
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3353 // and trying to load JSON or Script with a GET
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3354 if ( s.dataType == "script" && type == "GET" && parts
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3355 && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3356
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3357 var head = document.getElementsByTagName("head")[0];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3358 var script = document.createElement("script");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3359 script.src = s.url;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3360 if (s.scriptCharset)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3361 script.charset = s.scriptCharset;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3362
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3363 // Handle Script loading
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3364 if ( !jsonp ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3365 var done = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3366
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3367 // Attach handlers for all browsers
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3368 script.onload = script.onreadystatechange = function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3369 if ( !done && (!this.readyState ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3370 this.readyState == "loaded" || this.readyState == "complete") ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3371 done = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3372 success();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3373 complete();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3374 head.removeChild( script );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3375 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3376 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3377 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3378
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3379 head.appendChild(script);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3380
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3381 // We handle everything using the script element injection
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3382 return undefined;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3383 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3384
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3385 var requestDone = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3386
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3387 // Create the request object
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3388 var xhr = s.xhr();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3389
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3390 // Open the socket
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3391 // Passing null username, generates a login popup on Opera (#2865)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3392 if( s.username )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3393 xhr.open(type, s.url, s.async, s.username, s.password);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3394 else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3395 xhr.open(type, s.url, s.async);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3396
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3397 // Need an extra try/catch for cross domain requests in Firefox 3
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3398 try {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3399 // Set the correct header, if data is being sent
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3400 if ( s.data )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3401 xhr.setRequestHeader("Content-Type", s.contentType);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3402
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3403 // Set the If-Modified-Since header, if ifModified mode.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3404 if ( s.ifModified )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3405 xhr.setRequestHeader("If-Modified-Since",
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3406 jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3407
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3408 // Set header so the called script knows that it's an XMLHttpRequest
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3409 xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3410
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3411 // Set the Accepts header for the server, depending on the dataType
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3412 xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3413 s.accepts[ s.dataType ] + ", */*" :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3414 s.accepts._default );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3415 } catch(e){}
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3416
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3417 // Allow custom headers/mimetypes and early abort
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3418 if ( s.beforeSend && s.beforeSend(xhr, s) === false ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3419 // Handle the global AJAX counter
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3420 if ( s.global && ! --jQuery.active )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3421 jQuery.event.trigger( "ajaxStop" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3422 // close opended socket
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3423 xhr.abort();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3424 return false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3425 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3426
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3427 if ( s.global )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3428 jQuery.event.trigger("ajaxSend", [xhr, s]);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3429
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3430 // Wait for a response to come back
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3431 var onreadystatechange = function(isTimeout){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3432 // The request was aborted, clear the interval and decrement jQuery.active
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3433 if (xhr.readyState == 0) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3434 if (ival) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3435 // clear poll interval
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3436 clearInterval(ival);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3437 ival = null;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3438 // Handle the global AJAX counter
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3439 if ( s.global && ! --jQuery.active )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3440 jQuery.event.trigger( "ajaxStop" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3441 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3442 // The transfer is complete and the data is available, or the request timed out
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3443 } else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3444 requestDone = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3445
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3446 // clear poll interval
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3447 if (ival) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3448 clearInterval(ival);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3449 ival = null;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3450 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3451
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3452 status = isTimeout == "timeout" ? "timeout" :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3453 !jQuery.httpSuccess( xhr ) ? "error" :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3454 s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3455 "success";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3456
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3457 if ( status == "success" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3458 // Watch for, and catch, XML document parse errors
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3459 try {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3460 // process the data (runs the xml through httpData regardless of callback)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3461 data = jQuery.httpData( xhr, s.dataType, s );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3462 } catch(e) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3463 status = "parsererror";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3464 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3465 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3466
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3467 // Make sure that the request was successful or notmodified
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3468 if ( status == "success" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3469 // Cache Last-Modified header, if ifModified mode.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3470 var modRes;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3471 try {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3472 modRes = xhr.getResponseHeader("Last-Modified");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3473 } catch(e) {} // swallow exception thrown by FF if header is not available
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3474
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3475 if ( s.ifModified && modRes )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3476 jQuery.lastModified[s.url] = modRes;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3477
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3478 // JSONP handles its own success callback
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3479 if ( !jsonp )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3480 success();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3481 } else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3482 jQuery.handleError(s, xhr, status);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3483
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3484 // Fire the complete handlers
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3485 complete();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3486
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3487 if ( isTimeout )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3488 xhr.abort();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3489
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3490 // Stop memory leaks
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3491 if ( s.async )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3492 xhr = null;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3493 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3494 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3495
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3496 if ( s.async ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3497 // don't attach the handler to the request, just poll it instead
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3498 var ival = setInterval(onreadystatechange, 13);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3499
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3500 // Timeout checker
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3501 if ( s.timeout > 0 )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3502 setTimeout(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3503 // Check to see if the request is still happening
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3504 if ( xhr && !requestDone )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3505 onreadystatechange( "timeout" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3506 }, s.timeout);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3507 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3508
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3509 // Send the data
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3510 try {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3511 xhr.send(s.data);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3512 } catch(e) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3513 jQuery.handleError(s, xhr, null, e);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3514 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3515
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3516 // firefox 1.5 doesn't fire statechange for sync requests
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3517 if ( !s.async )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3518 onreadystatechange();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3519
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3520 function success(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3521 // If a local callback was specified, fire it and pass it the data
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3522 if ( s.success )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3523 s.success( data, status );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3524
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3525 // Fire the global callback
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3526 if ( s.global )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3527 jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3528 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3529
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3530 function complete(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3531 // Process result
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3532 if ( s.complete )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3533 s.complete(xhr, status);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3534
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3535 // The request was completed
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3536 if ( s.global )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3537 jQuery.event.trigger( "ajaxComplete", [xhr, s] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3538
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3539 // Handle the global AJAX counter
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3540 if ( s.global && ! --jQuery.active )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3541 jQuery.event.trigger( "ajaxStop" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3542 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3543
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3544 // return XMLHttpRequest to allow aborting the request etc.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3545 return xhr;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3546 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3547
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3548 handleError: function( s, xhr, status, e ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3549 // If a local callback was specified, fire it
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3550 if ( s.error ) s.error( xhr, status, e );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3551
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3552 // Fire the global callback
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3553 if ( s.global )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3554 jQuery.event.trigger( "ajaxError", [xhr, s, e] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3555 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3556
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3557 // Counter for holding the number of active queries
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3558 active: 0,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3559
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3560 // Determines if an XMLHttpRequest was successful or not
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3561 httpSuccess: function( xhr ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3562 try {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3563 // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3564 return !xhr.status && location.protocol == "file:" ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3565 ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3566 } catch(e){}
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3567 return false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3568 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3569
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3570 // Determines if an XMLHttpRequest returns NotModified
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3571 httpNotModified: function( xhr, url ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3572 try {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3573 var xhrRes = xhr.getResponseHeader("Last-Modified");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3574
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3575 // Firefox always returns 200. check Last-Modified date
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3576 return xhr.status == 304 || xhrRes == jQuery.lastModified[url];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3577 } catch(e){}
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3578 return false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3579 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3580
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3581 httpData: function( xhr, type, s ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3582 var ct = xhr.getResponseHeader("content-type"),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3583 xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3584 data = xml ? xhr.responseXML : xhr.responseText;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3585
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3586 if ( xml && data.documentElement.tagName == "parsererror" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3587 throw "parsererror";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3588
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3589 // Allow a pre-filtering function to sanitize the response
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3590 // s != null is checked to keep backwards compatibility
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3591 if( s && s.dataFilter )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3592 data = s.dataFilter( data, type );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3593
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3594 // The filter can actually parse the response
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3595 if( typeof data === "string" ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3596
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3597 // If the type is "script", eval it in global context
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3598 if ( type == "script" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3599 jQuery.globalEval( data );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3600
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3601 // Get the JavaScript object, if JSON is used.
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3602 if ( type == "json" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3603 data = window["eval"]("(" + data + ")");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3604 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3605
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3606 return data;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3607 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3608
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3609 // Serialize an array of form elements or a set of
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3610 // key/values into a query string
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3611 param: function( a ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3612 var s = [ ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3613
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3614 function add( key, value ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3615 s[ s.length ] = encodeURIComponent(key) + '=' + encodeURIComponent(value);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3616 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3617
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3618 // If an array was passed in, assume that it is an array
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3619 // of form elements
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3620 if ( jQuery.isArray(a) || a.jquery )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3621 // Serialize the form elements
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3622 jQuery.each( a, function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3623 add( this.name, this.value );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3624 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3625
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3626 // Otherwise, assume that it's an object of key/value pairs
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3627 else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3628 // Serialize the key/values
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3629 for ( var j in a )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3630 // If the value is an array then the key names need to be repeated
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3631 if ( jQuery.isArray(a[j]) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3632 jQuery.each( a[j], function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3633 add( j, this );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3634 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3635 else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3636 add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3637
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3638 // Return the resulting serialization
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3639 return s.join("&").replace(/%20/g, "+");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3640 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3641
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3642 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3643 var elemdisplay = {},
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3644 timerId,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3645 fxAttrs = [
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3646 // height animations
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3647 [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3648 // width animations
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3649 [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3650 // opacity animations
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3651 [ "opacity" ]
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3652 ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3653
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3654 function genFx( type, num ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3655 var obj = {};
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3656 jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3657 obj[ this ] = type;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3658 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3659 return obj;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3660 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3661
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3662 jQuery.fn.extend({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3663 show: function(speed,callback){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3664 if ( speed ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3665 return this.animate( genFx("show", 3), speed, callback);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3666 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3667 for ( var i = 0, l = this.length; i < l; i++ ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3668 var old = jQuery.data(this[i], "olddisplay");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3669
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3670 this[i].style.display = old || "";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3671
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3672 if ( jQuery.css(this[i], "display") === "none" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3673 var tagName = this[i].tagName, display;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3674
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3675 if ( elemdisplay[ tagName ] ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3676 display = elemdisplay[ tagName ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3677 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3678 var elem = jQuery("<" + tagName + " />").appendTo("body");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3679
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3680 display = elem.css("display");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3681 if ( display === "none" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3682 display = "block";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3683
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3684 elem.remove();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3685
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3686 elemdisplay[ tagName ] = display;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3687 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3688
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3689 this[i].style.display = jQuery.data(this[i], "olddisplay", display);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3690 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3691 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3692
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3693 return this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3694 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3695 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3696
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3697 hide: function(speed,callback){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3698 if ( speed ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3699 return this.animate( genFx("hide", 3), speed, callback);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3700 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3701 for ( var i = 0, l = this.length; i < l; i++ ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3702 var old = jQuery.data(this[i], "olddisplay");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3703 if ( !old && old !== "none" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3704 jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3705 this[i].style.display = "none";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3706 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3707 return this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3708 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3709 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3710
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3711 // Save the old toggle function
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3712 _toggle: jQuery.fn.toggle,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3713
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3714 toggle: function( fn, fn2 ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3715 var bool = typeof fn === "boolean";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3716
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3717 return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3718 this._toggle.apply( this, arguments ) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3719 fn == null || bool ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3720 this.each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3721 var state = bool ? fn : jQuery(this).is(":hidden");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3722 jQuery(this)[ state ? "show" : "hide" ]();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3723 }) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3724 this.animate(genFx("toggle", 3), fn, fn2);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3725 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3726
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3727 fadeTo: function(speed,to,callback){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3728 return this.animate({opacity: to}, speed, callback);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3729 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3730
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3731 animate: function( prop, speed, easing, callback ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3732 var optall = jQuery.speed(speed, easing, callback);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3733
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3734 return this[ optall.queue === false ? "each" : "queue" ](function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3735
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3736 var opt = jQuery.extend({}, optall), p,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3737 hidden = this.nodeType == 1 && jQuery(this).is(":hidden"),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3738 self = this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3739
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3740 for ( p in prop ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3741 if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3742 return opt.complete.call(this);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3743
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3744 if ( ( p == "height" || p == "width" ) && this.style ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3745 // Store display property
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3746 opt.display = jQuery.css(this, "display");
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3747
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3748 // Make sure that nothing sneaks out
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3749 opt.overflow = this.style.overflow;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3750 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3751 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3752
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3753 if ( opt.overflow != null )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3754 this.style.overflow = "hidden";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3755
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3756 opt.curAnim = jQuery.extend({}, prop);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3757
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3758 jQuery.each( prop, function(name, val){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3759 var e = new jQuery.fx( self, opt, name );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3760
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3761 if ( /toggle|show|hide/.test(val) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3762 e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3763 else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3764 var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3765 start = e.cur(true) || 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3766
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3767 if ( parts ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3768 var end = parseFloat(parts[2]),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3769 unit = parts[3] || "px";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3770
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3771 // We need to compute starting value
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3772 if ( unit != "px" ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3773 self.style[ name ] = (end || 1) + unit;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3774 start = ((end || 1) / e.cur(true)) * start;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3775 self.style[ name ] = start + unit;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3776 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3777
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3778 // If a +=/-= token was provided, we're doing a relative animation
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3779 if ( parts[1] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3780 end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3781
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3782 e.custom( start, end, unit );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3783 } else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3784 e.custom( start, val, "" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3785 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3786 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3787
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3788 // For JS strict compliance
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3789 return true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3790 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3791 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3792
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3793 stop: function(clearQueue, gotoEnd){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3794 var timers = jQuery.timers;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3795
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3796 if (clearQueue)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3797 this.queue([]);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3798
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3799 this.each(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3800 // go in reverse order so anything added to the queue during the loop is ignored
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3801 for ( var i = timers.length - 1; i >= 0; i-- )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3802 if ( timers[i].elem == this ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3803 if (gotoEnd)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3804 // force the next step to be the last
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3805 timers[i](true);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3806 timers.splice(i, 1);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3807 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3808 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3809
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3810 // start the next in the queue if the last step wasn't forced
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3811 if (!gotoEnd)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3812 this.dequeue();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3813
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3814 return this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3815 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3816
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3817 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3818
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3819 // Generate shortcuts for custom animations
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3820 jQuery.each({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3821 slideDown: genFx("show", 1),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3822 slideUp: genFx("hide", 1),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3823 slideToggle: genFx("toggle", 1),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3824 fadeIn: { opacity: "show" },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3825 fadeOut: { opacity: "hide" }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3826 }, function( name, props ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3827 jQuery.fn[ name ] = function( speed, callback ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3828 return this.animate( props, speed, callback );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3829 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3830 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3831
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3832 jQuery.extend({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3833
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3834 speed: function(speed, easing, fn) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3835 var opt = typeof speed === "object" ? speed : {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3836 complete: fn || !fn && easing ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3837 jQuery.isFunction( speed ) && speed,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3838 duration: speed,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3839 easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3840 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3841
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3842 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3843 jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3844
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3845 // Queueing
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3846 opt.old = opt.complete;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3847 opt.complete = function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3848 if ( opt.queue !== false )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3849 jQuery(this).dequeue();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3850 if ( jQuery.isFunction( opt.old ) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3851 opt.old.call( this );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3852 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3853
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3854 return opt;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3855 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3856
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3857 easing: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3858 linear: function( p, n, firstNum, diff ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3859 return firstNum + diff * p;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3860 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3861 swing: function( p, n, firstNum, diff ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3862 return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3863 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3864 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3865
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3866 timers: [],
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3867
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3868 fx: function( elem, options, prop ){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3869 this.options = options;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3870 this.elem = elem;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3871 this.prop = prop;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3872
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3873 if ( !options.orig )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3874 options.orig = {};
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3875 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3876
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3877 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3878
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3879 jQuery.fx.prototype = {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3880
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3881 // Simple function for setting a style value
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3882 update: function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3883 if ( this.options.step )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3884 this.options.step.call( this.elem, this.now, this );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3885
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3886 (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3887
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3888 // Set display property to block for height/width animations
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3889 if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3890 this.elem.style.display = "block";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3891 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3892
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3893 // Get the current size
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3894 cur: function(force){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3895 if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3896 return this.elem[ this.prop ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3897
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3898 var r = parseFloat(jQuery.css(this.elem, this.prop, force));
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3899 return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3900 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3901
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3902 // Start an animation from one number to another
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3903 custom: function(from, to, unit){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3904 this.startTime = now();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3905 this.start = from;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3906 this.end = to;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3907 this.unit = unit || this.unit || "px";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3908 this.now = this.start;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3909 this.pos = this.state = 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3910
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3911 var self = this;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3912 function t(gotoEnd){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3913 return self.step(gotoEnd);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3914 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3915
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3916 t.elem = this.elem;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3917
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3918 if ( t() && jQuery.timers.push(t) == 1 ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3919 timerId = setInterval(function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3920 var timers = jQuery.timers;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3921
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3922 for ( var i = 0; i < timers.length; i++ )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3923 if ( !timers[i]() )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3924 timers.splice(i--, 1);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3925
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3926 if ( !timers.length ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3927 clearInterval( timerId );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3928 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3929 }, 13);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3930 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3931 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3932
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3933 // Simple 'show' function
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3934 show: function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3935 // Remember where we started, so that we can go back to it later
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3936 this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3937 this.options.show = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3938
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3939 // Begin the animation
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3940 // Make sure that we start at a small width/height to avoid any
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3941 // flash of content
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3942 this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur());
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3943
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3944 // Start by showing the element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3945 jQuery(this.elem).show();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3946 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3947
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3948 // Simple 'hide' function
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3949 hide: function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3950 // Remember where we started, so that we can go back to it later
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3951 this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3952 this.options.hide = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3953
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3954 // Begin the animation
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3955 this.custom(this.cur(), 0);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3956 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3957
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3958 // Each step of an animation
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3959 step: function(gotoEnd){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3960 var t = now();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3961
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3962 if ( gotoEnd || t >= this.options.duration + this.startTime ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3963 this.now = this.end;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3964 this.pos = this.state = 1;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3965 this.update();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3966
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3967 this.options.curAnim[ this.prop ] = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3968
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3969 var done = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3970 for ( var i in this.options.curAnim )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3971 if ( this.options.curAnim[i] !== true )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3972 done = false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3973
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3974 if ( done ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3975 if ( this.options.display != null ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3976 // Reset the overflow
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3977 this.elem.style.overflow = this.options.overflow;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3978
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3979 // Reset the display
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3980 this.elem.style.display = this.options.display;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3981 if ( jQuery.css(this.elem, "display") == "none" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3982 this.elem.style.display = "block";
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3983 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3984
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3985 // Hide the element if the "hide" operation was done
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3986 if ( this.options.hide )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3987 jQuery(this.elem).hide();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3988
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3989 // Reset the properties, if the item has been hidden or shown
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3990 if ( this.options.hide || this.options.show )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3991 for ( var p in this.options.curAnim )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3992 jQuery.attr(this.elem.style, p, this.options.orig[p]);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3993
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3994 // Execute the complete function
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3995 this.options.complete.call( this.elem );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3996 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3997
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3998 return false;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
3999 } else {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4000 var n = t - this.startTime;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4001 this.state = n / this.options.duration;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4002
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4003 // Perform the easing function, defaults to swing
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4004 this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4005 this.now = this.start + ((this.end - this.start) * this.pos);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4006
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4007 // Perform the next step of the animation
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4008 this.update();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4009 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4010
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4011 return true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4012 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4013
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4014 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4015
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4016 jQuery.extend( jQuery.fx, {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4017 speeds:{
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4018 slow: 600,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4019 fast: 200,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4020 // Default speed
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4021 _default: 400
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4022 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4023 step: {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4024
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4025 opacity: function(fx){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4026 jQuery.attr(fx.elem.style, "opacity", fx.now);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4027 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4028
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4029 _default: function(fx){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4030 if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4031 fx.elem.style[ fx.prop ] = fx.now + fx.unit;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4032 else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4033 fx.elem[ fx.prop ] = fx.now;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4034 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4035 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4036 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4037 if ( document.documentElement["getBoundingClientRect"] )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4038 jQuery.fn.offset = function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4039 if ( !this[0] ) return { top: 0, left: 0 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4040 if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4041 var box = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4042 clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4043 top = box.top + (self.pageYOffset || jQuery.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4044 left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4045 return { top: top, left: left };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4046 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4047 else
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4048 jQuery.fn.offset = function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4049 if ( !this[0] ) return { top: 0, left: 0 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4050 if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4051 jQuery.offset.initialized || jQuery.offset.initialize();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4052
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4053 var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4054 doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4055 body = doc.body, defaultView = doc.defaultView,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4056 prevComputedStyle = defaultView.getComputedStyle(elem, null),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4057 top = elem.offsetTop, left = elem.offsetLeft;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4058
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4059 while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4060 computedStyle = defaultView.getComputedStyle(elem, null);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4061 top -= elem.scrollTop, left -= elem.scrollLeft;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4062 if ( elem === offsetParent ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4063 top += elem.offsetTop, left += elem.offsetLeft;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4064 if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4065 top += parseInt( computedStyle.borderTopWidth, 10) || 0,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4066 left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4067 prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4068 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4069 if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4070 top += parseInt( computedStyle.borderTopWidth, 10) || 0,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4071 left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4072 prevComputedStyle = computedStyle;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4073 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4074
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4075 if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4076 top += body.offsetTop,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4077 left += body.offsetLeft;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4078
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4079 if ( prevComputedStyle.position === "fixed" )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4080 top += Math.max(docElem.scrollTop, body.scrollTop),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4081 left += Math.max(docElem.scrollLeft, body.scrollLeft);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4082
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4083 return { top: top, left: left };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4084 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4085
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4086 jQuery.offset = {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4087 initialize: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4088 if ( this.initialized ) return;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4089 var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4090 html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4091
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4092 rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4093 for ( prop in rules ) container.style[prop] = rules[prop];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4094
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4095 container.innerHTML = html;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4096 body.insertBefore(container, body.firstChild);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4097 innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4098
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4099 this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4100 this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4101
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4102 innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4103 this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4104
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4105 body.style.marginTop = '1px';
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4106 this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4107 body.style.marginTop = bodyMarginTop;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4108
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4109 body.removeChild(container);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4110 this.initialized = true;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4111 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4112
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4113 bodyOffset: function(body) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4114 jQuery.offset.initialized || jQuery.offset.initialize();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4115 var top = body.offsetTop, left = body.offsetLeft;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4116 if ( jQuery.offset.doesNotIncludeMarginInBodyOffset )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4117 top += parseInt( jQuery.curCSS(body, 'marginTop', true), 10 ) || 0,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4118 left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4119 return { top: top, left: left };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4120 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4121 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4122
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4123
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4124 jQuery.fn.extend({
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4125 position: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4126 var left = 0, top = 0, results;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4127
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4128 if ( this[0] ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4129 // Get *real* offsetParent
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4130 var offsetParent = this.offsetParent(),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4131
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4132 // Get correct offsets
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4133 offset = this.offset(),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4134 parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4135
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4136 // Subtract element margins
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4137 // note: when an element has margin: auto the offsetLeft and marginLeft
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4138 // are the same in Safari causing offset.left to incorrectly be 0
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4139 offset.top -= num( this, 'marginTop' );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4140 offset.left -= num( this, 'marginLeft' );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4141
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4142 // Add offsetParent borders
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4143 parentOffset.top += num( offsetParent, 'borderTopWidth' );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4144 parentOffset.left += num( offsetParent, 'borderLeftWidth' );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4145
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4146 // Subtract the two offsets
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4147 results = {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4148 top: offset.top - parentOffset.top,
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4149 left: offset.left - parentOffset.left
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4150 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4151 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4152
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4153 return results;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4154 },
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4155
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4156 offsetParent: function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4157 var offsetParent = this[0].offsetParent || document.body;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4158 while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') )
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4159 offsetParent = offsetParent.offsetParent;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4160 return jQuery(offsetParent);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4161 }
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4162 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4163
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4164
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4165 // Create scrollLeft and scrollTop methods
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4166 jQuery.each( ['Left', 'Top'], function(i, name) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4167 var method = 'scroll' + name;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4168
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4169 jQuery.fn[ method ] = function(val) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4170 if (!this[0]) return null;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4171
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4172 return val !== undefined ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4173
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4174 // Set the scroll offset
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4175 this.each(function() {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4176 this == window || this == document ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4177 window.scrollTo(
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4178 !i ? val : jQuery(window).scrollLeft(),
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4179 i ? val : jQuery(window).scrollTop()
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4180 ) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4181 this[ method ] = val;
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4182 }) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4183
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4184 // Return the scroll offset
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4185 this[0] == window || this[0] == document ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4186 self[ i ? 'pageYOffset' : 'pageXOffset' ] ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4187 jQuery.boxModel && document.documentElement[ method ] ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4188 document.body[ method ] :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4189 this[0][ method ];
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4190 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4191 });
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4192 // Create innerHeight, innerWidth, outerHeight and outerWidth methods
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4193 jQuery.each([ "Height", "Width" ], function(i, name){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4194
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4195 var tl = i ? "Left" : "Top", // top or left
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4196 br = i ? "Right" : "Bottom"; // bottom or right
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4197
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4198 // innerHeight and innerWidth
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4199 jQuery.fn["inner" + name] = function(){
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4200 return this[ name.toLowerCase() ]() +
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4201 num(this, "padding" + tl) +
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4202 num(this, "padding" + br);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4203 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4204
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4205 // outerHeight and outerWidth
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4206 jQuery.fn["outer" + name] = function(margin) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4207 return this["inner" + name]() +
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4208 num(this, "border" + tl + "Width") +
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4209 num(this, "border" + br + "Width") +
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4210 (margin ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4211 num(this, "margin" + tl) + num(this, "margin" + br) : 0);
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4212 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4213
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4214 var type = name.toLowerCase();
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4215
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4216 jQuery.fn[ type ] = function( size ) {
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4217 // Get window width or height
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4218 return this[0] == window ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4219 // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4220 document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] ||
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4221 document.body[ "client" + name ] :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4222
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4223 // Get document width or height
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4224 this[0] == document ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4225 // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4226 Math.max(
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4227 document.documentElement["client" + name],
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4228 document.body["scroll" + name], document.documentElement["scroll" + name],
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4229 document.body["offset" + name], document.documentElement["offset" + name]
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4230 ) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4231
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4232 // Get or set width or height on the element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4233 size === undefined ?
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4234 // Get width or height on the element
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4235 (this.length ? jQuery.css( this[0], type ) : null) :
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4236
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4237 // Set the width or height on the element (default to pixels if value is unitless)
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4238 this.css( type, typeof size === "string" ? size : size + "px" );
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4239 };
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4240
01439f28d0bd Check-in primitive integrated madbuilder code.
wycc
parents:
diff changeset
4241 });})();