annotate Agendas/trunk/src/Agendas.Web/Scripts/jquery-1.4.4.js @ 302:11dddcc9a862 tip

Historico de Eventos, no muestra bien la Url del Patrocinador.
author juanjose.montesdeocaarbos
date Tue, 14 Aug 2012 21:54:30 -0300
parents c62b77fc33f4
children
rev   line source
10
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1 /*!
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2 * Note: While Microsoft is not the author of this file, Microsoft is
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3 * offering you a license subject to the terms of the Microsoft Software
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4 * License Terms for Microsoft ASP.NET Model View Controller 3.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5 * Microsoft reserves all other rights. The notices below are provided
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6 * for informational purposes only and are not the license terms under
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7 * which Microsoft distributed this file.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8 *
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9 * jQuery JavaScript Library v1.4.4
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
10 * http://jquery.com/
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
11 *
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
12 * Copyright 2010, John Resig
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
13 *
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
14 * Includes Sizzle.js
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
15 * http://sizzlejs.com/
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
16 * Copyright 2010, The Dojo Foundation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
17 *
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
18 * Date: Thu Nov 11 19:04:53 2010 -0500
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
19 */
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
20 (function( window, undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
21
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
22 // Use the correct document accordingly with window argument (sandbox)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
23 var document = window.document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
24 var jQuery = (function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
25
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
26 // Define a local copy of jQuery
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
27 var jQuery = function( selector, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
28 // The jQuery object is actually just the init constructor 'enhanced'
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
29 return new jQuery.fn.init( selector, context );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
30 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
31
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
32 // Map over jQuery in case of overwrite
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
33 _jQuery = window.jQuery,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
34
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
35 // Map over the $ in case of overwrite
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
36 _$ = window.$,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
37
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
38 // A central reference to the root jQuery(document)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
39 rootjQuery,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
40
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
41 // A simple way to check for HTML strings or ID strings
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
42 // (both of which we optimize for)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
43 quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
44
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
45 // Is it a simple selector
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
46 isSimple = /^.[^:#\[\.,]*$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
47
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
48 // Check if a string has a non-whitespace character in it
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
49 rnotwhite = /\S/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
50 rwhite = /\s/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
51
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
52 // Used for trimming whitespace
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
53 trimLeft = /^\s+/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
54 trimRight = /\s+$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
55
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
56 // Check for non-word characters
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
57 rnonword = /\W/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
58
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
59 // Check for digits
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
60 rdigit = /\d/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
61
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
62 // Match a standalone tag
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
63 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
64
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
65 // JSON RegExp
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
66 rvalidchars = /^[\],:{}\s]*$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
67 rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
68 rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
69 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
70
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
71 // Useragent RegExp
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
72 rwebkit = /(webkit)[ \/]([\w.]+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
73 ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
74 rmsie = /(msie) ([\w.]+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
75 rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
76
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
77 // Keep a UserAgent string for use with jQuery.browser
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
78 userAgent = navigator.userAgent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
79
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
80 // For matching the engine and version of the browser
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
81 browserMatch,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
82
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
83 // Has the ready events already been bound?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
84 readyBound = false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
85
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
86 // The functions to execute on DOM ready
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
87 readyList = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
88
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
89 // The ready event handler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
90 DOMContentLoaded,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
91
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
92 // Save a reference to some core methods
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
93 toString = Object.prototype.toString,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
94 hasOwn = Object.prototype.hasOwnProperty,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
95 push = Array.prototype.push,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
96 slice = Array.prototype.slice,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
97 trim = String.prototype.trim,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
98 indexOf = Array.prototype.indexOf,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
99
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
100 // [[Class]] -> type pairs
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
101 class2type = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
102
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
103 jQuery.fn = jQuery.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
104 init: function( selector, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
105 var match, elem, ret, doc;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
106
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
107 // Handle $(""), $(null), or $(undefined)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
108 if ( !selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
109 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
110 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
111
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
112 // Handle $(DOMElement)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
113 if ( selector.nodeType ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
114 this.context = this[0] = selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
115 this.length = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
116 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
117 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
118
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
119 // The body element only exists once, optimize finding it
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
120 if ( selector === "body" && !context && document.body ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
121 this.context = document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
122 this[0] = document.body;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
123 this.selector = "body";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
124 this.length = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
125 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
126 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
127
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
128 // Handle HTML strings
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
129 if ( typeof selector === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
130 // Are we dealing with HTML string or an ID?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
131 match = quickExpr.exec( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
132
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
133 // Verify a match, and that no context was specified for #id
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
134 if ( match && (match[1] || !context) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
135
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
136 // HANDLE: $(html) -> $(array)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
137 if ( match[1] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
138 doc = (context ? context.ownerDocument || context : document);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
139
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
140 // If a single string is passed in and it's a single tag
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
141 // just do a createElement and skip the rest
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
142 ret = rsingleTag.exec( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
143
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
144 if ( ret ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
145 if ( jQuery.isPlainObject( context ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
146 selector = [ document.createElement( ret[1] ) ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
147 jQuery.fn.attr.call( selector, context, true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
148
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
149 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
150 selector = [ doc.createElement( ret[1] ) ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
151 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
152
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
153 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
154 ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
155 selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
156 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
157
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
158 return jQuery.merge( this, selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
159
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
160 // HANDLE: $("#id")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
161 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
162 elem = document.getElementById( match[2] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
163
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
164 // Check parentNode to catch when Blackberry 4.6 returns
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
165 // nodes that are no longer in the document #6963
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
166 if ( elem && elem.parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
167 // Handle the case where IE and Opera return items
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
168 // by name instead of ID
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
169 if ( elem.id !== match[2] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
170 return rootjQuery.find( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
171 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
172
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
173 // Otherwise, we inject the element directly into the jQuery object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
174 this.length = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
175 this[0] = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
176 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
177
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
178 this.context = document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
179 this.selector = selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
180 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
181 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
182
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
183 // HANDLE: $("TAG")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
184 } else if ( !context && !rnonword.test( selector ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
185 this.selector = selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
186 this.context = document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
187 selector = document.getElementsByTagName( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
188 return jQuery.merge( this, selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
189
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
190 // HANDLE: $(expr, $(...))
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
191 } else if ( !context || context.jquery ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
192 return (context || rootjQuery).find( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
193
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
194 // HANDLE: $(expr, context)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
195 // (which is just equivalent to: $(context).find(expr)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
196 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
197 return jQuery( context ).find( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
198 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
199
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
200 // HANDLE: $(function)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
201 // Shortcut for document ready
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
202 } else if ( jQuery.isFunction( selector ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
203 return rootjQuery.ready( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
204 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
205
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
206 if (selector.selector !== undefined) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
207 this.selector = selector.selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
208 this.context = selector.context;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
209 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
210
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
211 return jQuery.makeArray( selector, this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
212 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
213
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
214 // Start with an empty selector
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
215 selector: "",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
216
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
217 // The current version of jQuery being used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
218 jquery: "1.4.4",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
219
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
220 // The default length of a jQuery object is 0
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
221 length: 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
222
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
223 // The number of elements contained in the matched element set
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
224 size: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
225 return this.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
226 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
227
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
228 toArray: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
229 return slice.call( this, 0 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
230 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
231
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
232 // Get the Nth element in the matched element set OR
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
233 // Get the whole matched element set as a clean array
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
234 get: function( num ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
235 return num == null ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
236
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
237 // Return a 'clean' array
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
238 this.toArray() :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
239
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
240 // Return just the object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
241 ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
242 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
243
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
244 // Take an array of elements and push it onto the stack
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
245 // (returning the new matched element set)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
246 pushStack: function( elems, name, selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
247 // Build a new jQuery matched element set
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
248 var ret = jQuery();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
249
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
250 if ( jQuery.isArray( elems ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
251 push.apply( ret, elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
252
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
253 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
254 jQuery.merge( ret, elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
255 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
256
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
257 // Add the old object onto the stack (as a reference)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
258 ret.prevObject = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
259
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
260 ret.context = this.context;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
261
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
262 if ( name === "find" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
263 ret.selector = this.selector + (this.selector ? " " : "") + selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
264 } else if ( name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
265 ret.selector = this.selector + "." + name + "(" + selector + ")";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
266 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
267
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
268 // Return the newly-formed element set
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
269 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
270 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
271
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
272 // Execute a callback for every element in the matched set.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
273 // (You can seed the arguments with an array of args, but this is
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
274 // only used internally.)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
275 each: function( callback, args ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
276 return jQuery.each( this, callback, args );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
277 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
278
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
279 ready: function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
280 // Attach the listeners
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
281 jQuery.bindReady();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
282
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
283 // If the DOM is already ready
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
284 if ( jQuery.isReady ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
285 // Execute the function immediately
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
286 fn.call( document, jQuery );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
287
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
288 // Otherwise, remember the function for later
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
289 } else if ( readyList ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
290 // Add the function to the wait list
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
291 readyList.push( fn );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
292 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
293
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
294 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
295 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
296
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
297 eq: function( i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
298 return i === -1 ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
299 this.slice( i ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
300 this.slice( i, +i + 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
301 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
302
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
303 first: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
304 return this.eq( 0 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
305 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
306
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
307 last: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
308 return this.eq( -1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
309 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
310
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
311 slice: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
312 return this.pushStack( slice.apply( this, arguments ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
313 "slice", slice.call(arguments).join(",") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
314 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
315
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
316 map: function( callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
317 return this.pushStack( jQuery.map(this, function( elem, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
318 return callback.call( elem, i, elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
319 }));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
320 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
321
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
322 end: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
323 return this.prevObject || jQuery(null);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
324 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
325
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
326 // For internal use only.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
327 // Behaves like an Array's method, not like a jQuery method.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
328 push: push,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
329 sort: [].sort,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
330 splice: [].splice
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
331 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
332
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
333 // Give the init function the jQuery prototype for later instantiation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
334 jQuery.fn.init.prototype = jQuery.fn;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
335
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
336 jQuery.extend = jQuery.fn.extend = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
337 var options, name, src, copy, copyIsArray, clone,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
338 target = arguments[0] || {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
339 i = 1,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
340 length = arguments.length,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
341 deep = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
342
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
343 // Handle a deep copy situation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
344 if ( typeof target === "boolean" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
345 deep = target;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
346 target = arguments[1] || {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
347 // skip the boolean and the target
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
348 i = 2;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
349 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
350
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
351 // Handle case when target is a string or something (possible in deep copy)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
352 if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
353 target = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
354 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
355
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
356 // extend jQuery itself if only one argument is passed
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
357 if ( length === i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
358 target = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
359 --i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
360 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
361
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
362 for ( ; i < length; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
363 // Only deal with non-null/undefined values
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
364 if ( (options = arguments[ i ]) != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
365 // Extend the base object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
366 for ( name in options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
367 src = target[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
368 copy = options[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
369
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
370 // Prevent never-ending loop
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
371 if ( target === copy ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
372 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
373 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
374
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
375 // Recurse if we're merging plain objects or arrays
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
376 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
377 if ( copyIsArray ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
378 copyIsArray = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
379 clone = src && jQuery.isArray(src) ? src : [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
380
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
381 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
382 clone = src && jQuery.isPlainObject(src) ? src : {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
383 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
384
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
385 // Never move original objects, clone them
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
386 target[ name ] = jQuery.extend( deep, clone, copy );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
387
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
388 // Don't bring in undefined values
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
389 } else if ( copy !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
390 target[ name ] = copy;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
391 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
392 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
393 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
394 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
395
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
396 // Return the modified object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
397 return target;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
398 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
399
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
400 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
401 noConflict: function( deep ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
402 window.$ = _$;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
403
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
404 if ( deep ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
405 window.jQuery = _jQuery;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
406 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
407
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
408 return jQuery;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
409 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
410
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
411 // Is the DOM ready to be used? Set to true once it occurs.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
412 isReady: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
413
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
414 // A counter to track how many items to wait for before
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
415 // the ready event fires. See #6781
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
416 readyWait: 1,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
417
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
418 // Handle when the DOM is ready
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
419 ready: function( wait ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
420 // A third-party is pushing the ready event forwards
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
421 if ( wait === true ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
422 jQuery.readyWait--;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
423 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
424
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
425 // Make sure that the DOM is not already loaded
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
426 if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
427 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
428 if ( !document.body ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
429 return setTimeout( jQuery.ready, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
430 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
431
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
432 // Remember that the DOM is ready
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
433 jQuery.isReady = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
434
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
435 // If a normal DOM Ready event fired, decrement, and wait if need be
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
436 if ( wait !== true && --jQuery.readyWait > 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
437 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
438 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
439
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
440 // If there are functions bound, to execute
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
441 if ( readyList ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
442 // Execute all of them
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
443 var fn,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
444 i = 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
445 ready = readyList;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
446
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
447 // Reset the list of functions
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
448 readyList = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
449
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
450 while ( (fn = ready[ i++ ]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
451 fn.call( document, jQuery );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
452 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
453
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
454 // Trigger any bound ready events
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
455 if ( jQuery.fn.trigger ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
456 jQuery( document ).trigger( "ready" ).unbind( "ready" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
457 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
458 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
459 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
460 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
461
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
462 bindReady: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
463 if ( readyBound ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
464 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
465 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
466
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
467 readyBound = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
468
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
469 // Catch cases where $(document).ready() is called after the
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
470 // browser event has already occurred.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
471 if ( document.readyState === "complete" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
472 // Handle it asynchronously to allow scripts the opportunity to delay ready
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
473 return setTimeout( jQuery.ready, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
474 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
475
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
476 // Mozilla, Opera and webkit nightlies currently support this event
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
477 if ( document.addEventListener ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
478 // Use the handy event callback
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
479 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
480
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
481 // A fallback to window.onload, that will always work
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
482 window.addEventListener( "load", jQuery.ready, false );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
483
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
484 // If IE event model is used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
485 } else if ( document.attachEvent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
486 // ensure firing before onload,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
487 // maybe late but safe also for iframes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
488 document.attachEvent("onreadystatechange", DOMContentLoaded);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
489
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
490 // A fallback to window.onload, that will always work
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
491 window.attachEvent( "onload", jQuery.ready );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
492
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
493 // If IE and not a frame
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
494 // continually check to see if the document is ready
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
495 var toplevel = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
496
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
497 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
498 toplevel = window.frameElement == null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
499 } catch(e) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
500
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
501 if ( document.documentElement.doScroll && toplevel ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
502 doScrollCheck();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
503 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
504 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
505 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
506
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
507 // See test/unit/core.js for details concerning isFunction.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
508 // Since version 1.3, DOM methods and functions like alert
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
509 // aren't supported. They return false on IE (#2968).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
510 isFunction: function( obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
511 return jQuery.type(obj) === "function";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
512 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
513
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
514 isArray: Array.isArray || function( obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
515 return jQuery.type(obj) === "array";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
516 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
517
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
518 // A crude way of determining if an object is a window
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
519 isWindow: function( obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
520 return obj && typeof obj === "object" && "setInterval" in obj;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
521 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
522
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
523 isNaN: function( obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
524 return obj == null || !rdigit.test( obj ) || isNaN( obj );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
525 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
526
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
527 type: function( obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
528 return obj == null ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
529 String( obj ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
530 class2type[ toString.call(obj) ] || "object";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
531 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
532
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
533 isPlainObject: function( obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
534 // Must be an Object.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
535 // Because of IE, we also have to check the presence of the constructor property.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
536 // Make sure that DOM nodes and window objects don't pass through, as well
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
537 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
538 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
539 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
540
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
541 // Not own constructor property must be Object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
542 if ( obj.constructor &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
543 !hasOwn.call(obj, "constructor") &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
544 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
545 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
546 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
547
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
548 // Own properties are enumerated firstly, so to speed up,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
549 // if last one is own, then all properties are own.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
550
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
551 var key;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
552 for ( key in obj ) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
553
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
554 return key === undefined || hasOwn.call( obj, key );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
555 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
556
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
557 isEmptyObject: function( obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
558 for ( var name in obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
559 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
560 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
561 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
562 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
563
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
564 error: function( msg ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
565 throw msg;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
566 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
567
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
568 parseJSON: function( data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
569 if ( typeof data !== "string" || !data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
570 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
571 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
572
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
573 // Make sure leading/trailing whitespace is removed (IE can't handle it)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
574 data = jQuery.trim( data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
575
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
576 // Make sure the incoming data is actual JSON
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
577 // Logic borrowed from http://json.org/json2.js
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
578 if ( rvalidchars.test(data.replace(rvalidescape, "@")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
579 .replace(rvalidtokens, "]")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
580 .replace(rvalidbraces, "")) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
581
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
582 // Try to use the native JSON parser first
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
583 return window.JSON && window.JSON.parse ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
584 window.JSON.parse( data ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
585 (new Function("return " + data))();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
586
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
587 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
588 jQuery.error( "Invalid JSON: " + data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
589 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
590 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
591
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
592 noop: function() {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
593
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
594 // Evalulates a script in a global context
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
595 globalEval: function( data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
596 if ( data && rnotwhite.test(data) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
597 // Inspired by code by Andrea Giammarchi
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
598 // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
599 var head = document.getElementsByTagName("head")[0] || document.documentElement,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
600 script = document.createElement("script");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
601
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
602 script.type = "text/javascript";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
603
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
604 if ( jQuery.support.scriptEval ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
605 script.appendChild( document.createTextNode( data ) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
606 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
607 script.text = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
608 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
609
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
610 // Use insertBefore instead of appendChild to circumvent an IE6 bug.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
611 // This arises when a base node is used (#2709).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
612 head.insertBefore( script, head.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
613 head.removeChild( script );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
614 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
615 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
616
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
617 nodeName: function( elem, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
618 return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
619 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
620
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
621 // args is for internal usage only
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
622 each: function( object, callback, args ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
623 var name, i = 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
624 length = object.length,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
625 isObj = length === undefined || jQuery.isFunction(object);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
626
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
627 if ( args ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
628 if ( isObj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
629 for ( name in object ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
630 if ( callback.apply( object[ name ], args ) === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
631 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
632 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
633 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
634 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
635 for ( ; i < length; ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
636 if ( callback.apply( object[ i++ ], args ) === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
637 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
638 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
639 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
640 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
641
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
642 // A special, fast, case for the most common use of each
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
643 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
644 if ( isObj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
645 for ( name in object ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
646 if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
647 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
648 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
649 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
650 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
651 for ( var value = object[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
652 i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
653 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
654 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
655
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
656 return object;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
657 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
658
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
659 // Use native String.trim function wherever possible
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
660 trim: trim ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
661 function( text ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
662 return text == null ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
663 "" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
664 trim.call( text );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
665 } :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
666
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
667 // Otherwise use our own trimming functionality
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
668 function( text ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
669 return text == null ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
670 "" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
671 text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
672 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
673
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
674 // results is for internal usage only
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
675 makeArray: function( array, results ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
676 var ret = results || [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
677
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
678 if ( array != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
679 // The window, strings (and functions) also have 'length'
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
680 // The extra typeof function check is to prevent crashes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
681 // in Safari 2 (See: #3039)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
682 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
683 var type = jQuery.type(array);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
684
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
685 if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
686 push.call( ret, array );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
687 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
688 jQuery.merge( ret, array );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
689 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
690 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
691
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
692 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
693 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
694
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
695 inArray: function( elem, array ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
696 if ( array.indexOf ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
697 return array.indexOf( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
698 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
699
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
700 for ( var i = 0, length = array.length; i < length; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
701 if ( array[ i ] === elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
702 return i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
703 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
704 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
705
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
706 return -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
707 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
708
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
709 merge: function( first, second ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
710 var i = first.length,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
711 j = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
712
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
713 if ( typeof second.length === "number" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
714 for ( var l = second.length; j < l; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
715 first[ i++ ] = second[ j ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
716 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
717
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
718 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
719 while ( second[j] !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
720 first[ i++ ] = second[ j++ ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
721 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
722 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
723
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
724 first.length = i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
725
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
726 return first;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
727 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
728
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
729 grep: function( elems, callback, inv ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
730 var ret = [], retVal;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
731 inv = !!inv;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
732
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
733 // Go through the array, only saving the items
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
734 // that pass the validator function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
735 for ( var i = 0, length = elems.length; i < length; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
736 retVal = !!callback( elems[ i ], i );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
737 if ( inv !== retVal ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
738 ret.push( elems[ i ] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
739 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
740 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
741
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
742 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
743 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
744
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
745 // arg is for internal usage only
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
746 map: function( elems, callback, arg ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
747 var ret = [], value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
748
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
749 // Go through the array, translating each of the items to their
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
750 // new value (or values).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
751 for ( var i = 0, length = elems.length; i < length; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
752 value = callback( elems[ i ], i, arg );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
753
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
754 if ( value != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
755 ret[ ret.length ] = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
756 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
757 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
758
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
759 return ret.concat.apply( [], ret );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
760 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
761
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
762 // A global GUID counter for objects
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
763 guid: 1,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
764
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
765 proxy: function( fn, proxy, thisObject ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
766 if ( arguments.length === 2 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
767 if ( typeof proxy === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
768 thisObject = fn;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
769 fn = thisObject[ proxy ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
770 proxy = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
771
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
772 } else if ( proxy && !jQuery.isFunction( proxy ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
773 thisObject = proxy;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
774 proxy = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
775 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
776 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
777
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
778 if ( !proxy && fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
779 proxy = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
780 return fn.apply( thisObject || this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
781 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
782 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
783
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
784 // Set the guid of unique handler to the same of original handler, so it can be removed
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
785 if ( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
786 proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
787 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
788
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
789 // So proxy can be declared as an argument
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
790 return proxy;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
791 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
792
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
793 // Mutifunctional method to get and set values to a collection
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
794 // The value/s can be optionally by executed if its a function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
795 access: function( elems, key, value, exec, fn, pass ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
796 var length = elems.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
797
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
798 // Setting many attributes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
799 if ( typeof key === "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
800 for ( var k in key ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
801 jQuery.access( elems, k, key[k], exec, fn, value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
802 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
803 return elems;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
804 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
805
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
806 // Setting one attribute
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
807 if ( value !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
808 // Optionally, function values get executed if exec is true
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
809 exec = !pass && exec && jQuery.isFunction(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
810
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
811 for ( var i = 0; i < length; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
812 fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
813 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
814
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
815 return elems;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
816 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
817
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
818 // Getting an attribute
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
819 return length ? fn( elems[0], key ) : undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
820 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
821
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
822 now: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
823 return (new Date()).getTime();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
824 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
825
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
826 // Use of jQuery.browser is frowned upon.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
827 // More details: http://docs.jquery.com/Utilities/jQuery.browser
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
828 uaMatch: function( ua ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
829 ua = ua.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
830
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
831 var match = rwebkit.exec( ua ) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
832 ropera.exec( ua ) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
833 rmsie.exec( ua ) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
834 ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
835 [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
836
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
837 return { browser: match[1] || "", version: match[2] || "0" };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
838 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
839
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
840 browser: {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
841 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
842
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
843 // Populate the class2type map
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
844 jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
845 class2type[ "[object " + name + "]" ] = name.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
846 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
847
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
848 browserMatch = jQuery.uaMatch( userAgent );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
849 if ( browserMatch.browser ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
850 jQuery.browser[ browserMatch.browser ] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
851 jQuery.browser.version = browserMatch.version;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
852 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
853
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
854 // Deprecated, use jQuery.browser.webkit instead
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
855 if ( jQuery.browser.webkit ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
856 jQuery.browser.safari = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
857 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
858
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
859 if ( indexOf ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
860 jQuery.inArray = function( elem, array ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
861 return indexOf.call( array, elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
862 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
863 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
864
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
865 // Verify that \s matches non-breaking spaces
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
866 // (IE fails on this test)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
867 if ( !rwhite.test( "\xA0" ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
868 trimLeft = /^[\s\xA0]+/;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
869 trimRight = /[\s\xA0]+$/;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
870 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
871
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
872 // All jQuery objects should point back to these
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
873 rootjQuery = jQuery(document);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
874
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
875 // Cleanup functions for the document ready method
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
876 if ( document.addEventListener ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
877 DOMContentLoaded = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
878 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
879 jQuery.ready();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
880 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
881
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
882 } else if ( document.attachEvent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
883 DOMContentLoaded = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
884 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
885 if ( document.readyState === "complete" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
886 document.detachEvent( "onreadystatechange", DOMContentLoaded );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
887 jQuery.ready();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
888 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
889 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
890 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
891
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
892 // The DOM ready check for Internet Explorer
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
893 function doScrollCheck() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
894 if ( jQuery.isReady ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
895 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
896 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
897
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
898 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
899 // If IE is used, use the trick by Diego Perini
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
900 // http://javascript.nwbox.com/IEContentLoaded/
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
901 document.documentElement.doScroll("left");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
902 } catch(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
903 setTimeout( doScrollCheck, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
904 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
905 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
906
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
907 // and execute any waiting functions
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
908 jQuery.ready();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
909 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
910
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
911 // Expose jQuery to the global object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
912 return (window.jQuery = window.$ = jQuery);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
913
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
914 })();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
915
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
916
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
917 (function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
918
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
919 jQuery.support = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
920
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
921 var root = document.documentElement,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
922 script = document.createElement("script"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
923 div = document.createElement("div"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
924 id = "script" + jQuery.now();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
925
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
926 div.style.display = "none";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
927 div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
928
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
929 var all = div.getElementsByTagName("*"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
930 a = div.getElementsByTagName("a")[0],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
931 select = document.createElement("select"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
932 opt = select.appendChild( document.createElement("option") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
933
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
934 // Can't get basic test support
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
935 if ( !all || !all.length || !a ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
936 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
937 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
938
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
939 jQuery.support = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
940 // IE strips leading whitespace when .innerHTML is used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
941 leadingWhitespace: div.firstChild.nodeType === 3,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
942
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
943 // Make sure that tbody elements aren't automatically inserted
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
944 // IE will insert them into empty tables
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
945 tbody: !div.getElementsByTagName("tbody").length,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
946
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
947 // Make sure that link elements get serialized correctly by innerHTML
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
948 // This requires a wrapper element in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
949 htmlSerialize: !!div.getElementsByTagName("link").length,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
950
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
951 // Get the style information from getAttribute
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
952 // (IE uses .cssText insted)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
953 style: /red/.test( a.getAttribute("style") ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
954
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
955 // Make sure that URLs aren't manipulated
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
956 // (IE normalizes it by default)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
957 hrefNormalized: a.getAttribute("href") === "/a",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
958
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
959 // Make sure that element opacity exists
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
960 // (IE uses filter instead)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
961 // Use a regex to work around a WebKit issue. See #5145
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
962 opacity: /^0.55$/.test( a.style.opacity ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
963
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
964 // Verify style float existence
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
965 // (IE uses styleFloat instead of cssFloat)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
966 cssFloat: !!a.style.cssFloat,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
967
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
968 // Make sure that if no value is specified for a checkbox
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
969 // that it defaults to "on".
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
970 // (WebKit defaults to "" instead)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
971 checkOn: div.getElementsByTagName("input")[0].value === "on",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
972
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
973 // Make sure that a selected-by-default option has a working selected property.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
974 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
975 optSelected: opt.selected,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
976
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
977 // Will be defined later
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
978 deleteExpando: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
979 optDisabled: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
980 checkClone: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
981 scriptEval: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
982 noCloneEvent: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
983 boxModel: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
984 inlineBlockNeedsLayout: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
985 shrinkWrapBlocks: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
986 reliableHiddenOffsets: true
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
987 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
988
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
989 // Make sure that the options inside disabled selects aren't marked as disabled
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
990 // (WebKit marks them as diabled)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
991 select.disabled = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
992 jQuery.support.optDisabled = !opt.disabled;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
993
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
994 script.type = "text/javascript";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
995 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
996 script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
997 } catch(e) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
998
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
999 root.insertBefore( script, root.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1000
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1001 // Make sure that the execution of code works by injecting a script
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1002 // tag with appendChild/createTextNode
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1003 // (IE doesn't support this, fails, and uses .text instead)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1004 if ( window[ id ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1005 jQuery.support.scriptEval = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1006 delete window[ id ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1007 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1008
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1009 // Test to see if it's possible to delete an expando from an element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1010 // Fails in Internet Explorer
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1011 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1012 delete script.test;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1013
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1014 } catch(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1015 jQuery.support.deleteExpando = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1016 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1017
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1018 root.removeChild( script );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1019
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1020 if ( div.attachEvent && div.fireEvent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1021 div.attachEvent("onclick", function click() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1022 // Cloning a node shouldn't copy over any
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1023 // bound event handlers (IE does this)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1024 jQuery.support.noCloneEvent = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1025 div.detachEvent("onclick", click);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1026 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1027 div.cloneNode(true).fireEvent("onclick");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1028 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1029
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1030 div = document.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1031 div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1032
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1033 var fragment = document.createDocumentFragment();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1034 fragment.appendChild( div.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1035
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1036 // WebKit doesn't clone checked state correctly in fragments
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1037 jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1038
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1039 // Figure out if the W3C box model works as expected
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1040 // document.body must exist before we can do this
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1041 jQuery(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1042 var div = document.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1043 div.style.width = div.style.paddingLeft = "1px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1044
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1045 document.body.appendChild( div );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1046 jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1047
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1048 if ( "zoom" in div.style ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1049 // Check if natively block-level elements act like inline-block
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1050 // elements when setting their display to 'inline' and giving
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1051 // them layout
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1052 // (IE < 8 does this)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1053 div.style.display = "inline";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1054 div.style.zoom = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1055 jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1056
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1057 // Check if elements with layout shrink-wrap their children
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1058 // (IE 6 does this)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1059 div.style.display = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1060 div.innerHTML = "<div style='width:4px;'></div>";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1061 jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1062 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1063
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1064 div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1065 var tds = div.getElementsByTagName("td");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1066
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1067 // Check if table cells still have offsetWidth/Height when they are set
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1068 // to display:none and there are still other visible table cells in a
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1069 // table row; if so, offsetWidth/Height are not reliable for use when
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1070 // determining if an element has been hidden directly using
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1071 // display:none (it is still safe to use offsets if a parent element is
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1072 // hidden; don safety goggles and see bug #4512 for more information).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1073 // (only IE 8 fails this test)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1074 jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1075
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1076 tds[0].style.display = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1077 tds[1].style.display = "none";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1078
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1079 // Check if empty table cells still have offsetWidth/Height
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1080 // (IE < 8 fail this test)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1081 jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1082 div.innerHTML = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1083
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1084 document.body.removeChild( div ).style.display = "none";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1085 div = tds = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1086 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1087
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1088 // Technique from Juriy Zaytsev
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1089 // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1090 var eventSupported = function( eventName ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1091 var el = document.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1092 eventName = "on" + eventName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1093
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1094 var isSupported = (eventName in el);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1095 if ( !isSupported ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1096 el.setAttribute(eventName, "return;");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1097 isSupported = typeof el[eventName] === "function";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1098 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1099 el = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1100
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1101 return isSupported;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1102 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1103
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1104 jQuery.support.submitBubbles = eventSupported("submit");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1105 jQuery.support.changeBubbles = eventSupported("change");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1106
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1107 // release memory in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1108 root = script = div = all = a = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1109 })();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1110
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1111
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1112
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1113 var windowData = {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1114 rbrace = /^(?:\{.*\}|\[.*\])$/;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1115
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1116 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1117 cache: {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1118
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1119 // Please use with caution
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1120 uuid: 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1121
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1122 // Unique for each copy of jQuery on the page
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1123 expando: "jQuery" + jQuery.now(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1124
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1125 // The following elements throw uncatchable exceptions if you
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1126 // attempt to add expando properties to them.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1127 noData: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1128 "embed": true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1129 // Ban all objects except for Flash (which handle expandos)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1130 "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1131 "applet": true
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1132 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1133
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1134 data: function( elem, name, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1135 if ( !jQuery.acceptData( elem ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1136 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1137 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1138
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1139 elem = elem == window ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1140 windowData :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1141 elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1142
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1143 var isNode = elem.nodeType,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1144 id = isNode ? elem[ jQuery.expando ] : null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1145 cache = jQuery.cache, thisCache;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1146
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1147 if ( isNode && !id && typeof name === "string" && data === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1148 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1149 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1150
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1151 // Get the data from the object directly
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1152 if ( !isNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1153 cache = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1154
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1155 // Compute a unique ID for the element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1156 } else if ( !id ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1157 elem[ jQuery.expando ] = id = ++jQuery.uuid;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1158 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1159
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1160 // Avoid generating a new cache unless none exists and we
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1161 // want to manipulate it.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1162 if ( typeof name === "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1163 if ( isNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1164 cache[ id ] = jQuery.extend(cache[ id ], name);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1165
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1166 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1167 jQuery.extend( cache, name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1168 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1169
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1170 } else if ( isNode && !cache[ id ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1171 cache[ id ] = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1172 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1173
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1174 thisCache = isNode ? cache[ id ] : cache;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1175
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1176 // Prevent overriding the named cache with undefined values
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1177 if ( data !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1178 thisCache[ name ] = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1179 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1180
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1181 return typeof name === "string" ? thisCache[ name ] : thisCache;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1182 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1183
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1184 removeData: function( elem, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1185 if ( !jQuery.acceptData( elem ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1186 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1187 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1188
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1189 elem = elem == window ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1190 windowData :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1191 elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1192
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1193 var isNode = elem.nodeType,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1194 id = isNode ? elem[ jQuery.expando ] : elem,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1195 cache = jQuery.cache,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1196 thisCache = isNode ? cache[ id ] : id;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1197
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1198 // If we want to remove a specific section of the element's data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1199 if ( name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1200 if ( thisCache ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1201 // Remove the section of cache data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1202 delete thisCache[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1203
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1204 // If we've removed all the data, remove the element's cache
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1205 if ( isNode && jQuery.isEmptyObject(thisCache) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1206 jQuery.removeData( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1207 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1208 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1209
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1210 // Otherwise, we want to remove all of the element's data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1211 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1212 if ( isNode && jQuery.support.deleteExpando ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1213 delete elem[ jQuery.expando ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1214
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1215 } else if ( elem.removeAttribute ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1216 elem.removeAttribute( jQuery.expando );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1217
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1218 // Completely remove the data cache
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1219 } else if ( isNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1220 delete cache[ id ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1221
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1222 // Remove all fields from the object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1223 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1224 for ( var n in elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1225 delete elem[ n ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1226 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1227 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1228 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1229 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1230
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1231 // A method for determining if a DOM node can handle the data expando
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1232 acceptData: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1233 if ( elem.nodeName ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1234 var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1235
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1236 if ( match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1237 return !(match === true || elem.getAttribute("classid") !== match);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1238 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1239 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1240
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1241 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1242 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1243 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1244
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1245 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1246 data: function( key, value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1247 var data = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1248
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1249 if ( typeof key === "undefined" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1250 if ( this.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1251 var attr = this[0].attributes, name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1252 data = jQuery.data( this[0] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1253
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1254 for ( var i = 0, l = attr.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1255 name = attr[i].name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1256
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1257 if ( name.indexOf( "data-" ) === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1258 name = name.substr( 5 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1259 dataAttr( this[0], name, data[ name ] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1260 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1261 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1262 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1263
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1264 return data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1265
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1266 } else if ( typeof key === "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1267 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1268 jQuery.data( this, key );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1269 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1270 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1271
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1272 var parts = key.split(".");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1273 parts[1] = parts[1] ? "." + parts[1] : "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1274
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1275 if ( value === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1276 data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1277
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1278 // Try to fetch any internally stored data first
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1279 if ( data === undefined && this.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1280 data = jQuery.data( this[0], key );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1281 data = dataAttr( this[0], key, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1282 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1283
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1284 return data === undefined && parts[1] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1285 this.data( parts[0] ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1286 data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1287
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1288 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1289 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1290 var $this = jQuery( this ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1291 args = [ parts[0], value ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1292
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1293 $this.triggerHandler( "setData" + parts[1] + "!", args );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1294 jQuery.data( this, key, value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1295 $this.triggerHandler( "changeData" + parts[1] + "!", args );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1296 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1297 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1298 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1299
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1300 removeData: function( key ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1301 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1302 jQuery.removeData( this, key );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1303 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1304 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1305 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1306
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1307 function dataAttr( elem, key, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1308 // If nothing was found internally, try to fetch any
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1309 // data from the HTML5 data-* attribute
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1310 if ( data === undefined && elem.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1311 data = elem.getAttribute( "data-" + key );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1312
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1313 if ( typeof data === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1314 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1315 data = data === "true" ? true :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1316 data === "false" ? false :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1317 data === "null" ? null :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1318 !jQuery.isNaN( data ) ? parseFloat( data ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1319 rbrace.test( data ) ? jQuery.parseJSON( data ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1320 data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1321 } catch( e ) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1322
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1323 // Make sure we set the data so it isn't changed later
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1324 jQuery.data( elem, key, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1325
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1326 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1327 data = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1328 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1329 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1330
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1331 return data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1332 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1333
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1334
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1335
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1336
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1337 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1338 queue: function( elem, type, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1339 if ( !elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1340 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1341 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1342
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1343 type = (type || "fx") + "queue";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1344 var q = jQuery.data( elem, type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1345
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1346 // Speed up dequeue by getting out quickly if this is just a lookup
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1347 if ( !data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1348 return q || [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1349 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1350
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1351 if ( !q || jQuery.isArray(data) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1352 q = jQuery.data( elem, type, jQuery.makeArray(data) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1353
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1354 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1355 q.push( data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1356 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1357
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1358 return q;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1359 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1360
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1361 dequeue: function( elem, type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1362 type = type || "fx";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1363
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1364 var queue = jQuery.queue( elem, type ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1365 fn = queue.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1366
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1367 // If the fx queue is dequeued, always remove the progress sentinel
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1368 if ( fn === "inprogress" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1369 fn = queue.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1370 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1371
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1372 if ( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1373 // Add a progress sentinel to prevent the fx queue from being
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1374 // automatically dequeued
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1375 if ( type === "fx" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1376 queue.unshift("inprogress");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1377 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1378
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1379 fn.call(elem, function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1380 jQuery.dequeue(elem, type);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1381 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1382 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1383 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1384 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1385
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1386 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1387 queue: function( type, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1388 if ( typeof type !== "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1389 data = type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1390 type = "fx";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1391 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1392
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1393 if ( data === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1394 return jQuery.queue( this[0], type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1395 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1396 return this.each(function( i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1397 var queue = jQuery.queue( this, type, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1398
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1399 if ( type === "fx" && queue[0] !== "inprogress" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1400 jQuery.dequeue( this, type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1401 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1402 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1403 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1404 dequeue: function( type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1405 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1406 jQuery.dequeue( this, type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1407 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1408 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1409
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1410 // Based off of the plugin by Clint Helfers, with permission.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1411 // http://blindsignals.com/index.php/2009/07/jquery-delay/
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1412 delay: function( time, type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1413 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1414 type = type || "fx";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1415
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1416 return this.queue( type, function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1417 var elem = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1418 setTimeout(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1419 jQuery.dequeue( elem, type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1420 }, time );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1421 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1422 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1423
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1424 clearQueue: function( type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1425 return this.queue( type || "fx", [] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1426 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1427 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1428
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1429
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1430
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1431
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1432 var rclass = /[\n\t]/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1433 rspaces = /\s+/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1434 rreturn = /\r/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1435 rspecialurl = /^(?:href|src|style)$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1436 rtype = /^(?:button|input)$/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1437 rfocusable = /^(?:button|input|object|select|textarea)$/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1438 rclickable = /^a(?:rea)?$/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1439 rradiocheck = /^(?:radio|checkbox)$/i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1440
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1441 jQuery.props = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1442 "for": "htmlFor",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1443 "class": "className",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1444 readonly: "readOnly",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1445 maxlength: "maxLength",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1446 cellspacing: "cellSpacing",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1447 rowspan: "rowSpan",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1448 colspan: "colSpan",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1449 tabindex: "tabIndex",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1450 usemap: "useMap",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1451 frameborder: "frameBorder"
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1452 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1453
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1454 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1455 attr: function( name, value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1456 return jQuery.access( this, name, value, true, jQuery.attr );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1457 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1458
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1459 removeAttr: function( name, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1460 return this.each(function(){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1461 jQuery.attr( this, name, "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1462 if ( this.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1463 this.removeAttribute( name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1464 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1465 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1466 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1467
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1468 addClass: function( value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1469 if ( jQuery.isFunction(value) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1470 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1471 var self = jQuery(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1472 self.addClass( value.call(this, i, self.attr("class")) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1473 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1474 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1475
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1476 if ( value && typeof value === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1477 var classNames = (value || "").split( rspaces );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1478
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1479 for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1480 var elem = this[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1481
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1482 if ( elem.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1483 if ( !elem.className ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1484 elem.className = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1485
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1486 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1487 var className = " " + elem.className + " ",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1488 setClass = elem.className;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1489
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1490 for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1491 if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1492 setClass += " " + classNames[c];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1493 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1494 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1495 elem.className = jQuery.trim( setClass );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1496 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1497 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1498 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1499 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1500
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1501 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1502 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1503
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1504 removeClass: function( value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1505 if ( jQuery.isFunction(value) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1506 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1507 var self = jQuery(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1508 self.removeClass( value.call(this, i, self.attr("class")) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1509 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1510 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1511
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1512 if ( (value && typeof value === "string") || value === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1513 var classNames = (value || "").split( rspaces );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1514
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1515 for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1516 var elem = this[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1517
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1518 if ( elem.nodeType === 1 && elem.className ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1519 if ( value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1520 var className = (" " + elem.className + " ").replace(rclass, " ");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1521 for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1522 className = className.replace(" " + classNames[c] + " ", " ");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1523 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1524 elem.className = jQuery.trim( className );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1525
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1526 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1527 elem.className = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1528 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1529 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1530 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1531 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1532
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1533 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1534 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1535
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1536 toggleClass: function( value, stateVal ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1537 var type = typeof value,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1538 isBool = typeof stateVal === "boolean";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1539
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1540 if ( jQuery.isFunction( value ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1541 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1542 var self = jQuery(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1543 self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1544 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1545 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1546
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1547 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1548 if ( type === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1549 // toggle individual class names
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1550 var className,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1551 i = 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1552 self = jQuery( this ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1553 state = stateVal,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1554 classNames = value.split( rspaces );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1555
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1556 while ( (className = classNames[ i++ ]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1557 // check each className given, space seperated list
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1558 state = isBool ? state : !self.hasClass( className );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1559 self[ state ? "addClass" : "removeClass" ]( className );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1560 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1561
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1562 } else if ( type === "undefined" || type === "boolean" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1563 if ( this.className ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1564 // store className if set
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1565 jQuery.data( this, "__className__", this.className );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1566 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1567
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1568 // toggle whole className
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1569 this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1570 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1571 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1572 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1573
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1574 hasClass: function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1575 var className = " " + selector + " ";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1576 for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1577 if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1578 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1579 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1580 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1581
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1582 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1583 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1584
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1585 val: function( value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1586 if ( !arguments.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1587 var elem = this[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1588
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1589 if ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1590 if ( jQuery.nodeName( elem, "option" ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1591 // attributes.value is undefined in Blackberry 4.7 but
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1592 // uses .value. See #6932
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1593 var val = elem.attributes.value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1594 return !val || val.specified ? elem.value : elem.text;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1595 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1596
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1597 // We need to handle select boxes special
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1598 if ( jQuery.nodeName( elem, "select" ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1599 var index = elem.selectedIndex,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1600 values = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1601 options = elem.options,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1602 one = elem.type === "select-one";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1603
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1604 // Nothing was selected
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1605 if ( index < 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1606 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1607 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1608
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1609 // Loop through all the selected options
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1610 for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1611 var option = options[ i ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1612
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1613 // Don't return options that are disabled or in a disabled optgroup
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1614 if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1615 (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1616
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1617 // Get the specific value for the option
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1618 value = jQuery(option).val();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1619
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1620 // We don't need an array for one selects
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1621 if ( one ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1622 return value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1623 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1624
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1625 // Multi-Selects return an array
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1626 values.push( value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1627 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1628 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1629
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1630 return values;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1631 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1632
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1633 // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1634 if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1635 return elem.getAttribute("value") === null ? "on" : elem.value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1636 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1637
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1638
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1639 // Everything else, we just grab the value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1640 return (elem.value || "").replace(rreturn, "");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1641
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1642 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1643
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1644 return undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1645 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1646
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1647 var isFunction = jQuery.isFunction(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1648
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1649 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1650 var self = jQuery(this), val = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1651
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1652 if ( this.nodeType !== 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1653 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1654 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1655
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1656 if ( isFunction ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1657 val = value.call(this, i, self.val());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1658 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1659
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1660 // Treat null/undefined as ""; convert numbers to string
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1661 if ( val == null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1662 val = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1663 } else if ( typeof val === "number" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1664 val += "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1665 } else if ( jQuery.isArray(val) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1666 val = jQuery.map(val, function (value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1667 return value == null ? "" : value + "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1668 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1669 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1670
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1671 if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1672 this.checked = jQuery.inArray( self.val(), val ) >= 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1673
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1674 } else if ( jQuery.nodeName( this, "select" ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1675 var values = jQuery.makeArray(val);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1676
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1677 jQuery( "option", this ).each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1678 this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1679 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1680
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1681 if ( !values.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1682 this.selectedIndex = -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1683 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1684
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1685 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1686 this.value = val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1687 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1688 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1689 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1690 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1691
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1692 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1693 attrFn: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1694 val: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1695 css: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1696 html: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1697 text: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1698 data: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1699 width: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1700 height: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1701 offset: true
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1702 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1703
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1704 attr: function( elem, name, value, pass ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1705 // don't set attributes on text and comment nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1706 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1707 return undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1708 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1709
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1710 if ( pass && name in jQuery.attrFn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1711 return jQuery(elem)[name](value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1712 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1713
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1714 var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1715 // Whether we are setting (or getting)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1716 set = value !== undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1717
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1718 // Try to normalize/fix the name
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1719 name = notxml && jQuery.props[ name ] || name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1720
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1721 // These attributes require special treatment
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1722 var special = rspecialurl.test( name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1723
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1724 // Safari mis-reports the default selected property of an option
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1725 // Accessing the parent's selectedIndex property fixes it
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1726 if ( name === "selected" && !jQuery.support.optSelected ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1727 var parent = elem.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1728 if ( parent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1729 parent.selectedIndex;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1730
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1731 // Make sure that it also works with optgroups, see #5701
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1732 if ( parent.parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1733 parent.parentNode.selectedIndex;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1734 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1735 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1736 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1737
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1738 // If applicable, access the attribute via the DOM 0 way
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1739 // 'in' checks fail in Blackberry 4.7 #6931
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1740 if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1741 if ( set ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1742 // We can't allow the type property to be changed (since it causes problems in IE)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1743 if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1744 jQuery.error( "type property can't be changed" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1745 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1746
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1747 if ( value === null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1748 if ( elem.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1749 elem.removeAttribute( name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1750 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1751
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1752 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1753 elem[ name ] = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1754 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1755 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1756
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1757 // browsers index elements by id/name on forms, give priority to attributes.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1758 if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1759 return elem.getAttributeNode( name ).nodeValue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1760 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1761
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1762 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1763 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1764 if ( name === "tabIndex" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1765 var attributeNode = elem.getAttributeNode( "tabIndex" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1766
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1767 return attributeNode && attributeNode.specified ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1768 attributeNode.value :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1769 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1770 0 :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1771 undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1772 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1773
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1774 return elem[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1775 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1776
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1777 if ( !jQuery.support.style && notxml && name === "style" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1778 if ( set ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1779 elem.style.cssText = "" + value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1780 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1781
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1782 return elem.style.cssText;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1783 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1784
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1785 if ( set ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1786 // convert the value to a string (all browsers do this but IE) see #1070
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1787 elem.setAttribute( name, "" + value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1788 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1789
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1790 // Ensure that missing attributes return undefined
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1791 // Blackberry 4.7 returns "" from getAttribute #6938
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1792 if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1793 return undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1794 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1795
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1796 var attr = !jQuery.support.hrefNormalized && notxml && special ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1797 // Some attributes require a special call on IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1798 elem.getAttribute( name, 2 ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1799 elem.getAttribute( name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1800
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1801 // Non-existent attributes return null, we normalize to undefined
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1802 return attr === null ? undefined : attr;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1803 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1804 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1805
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1806
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1807
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1808
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1809 var rnamespaces = /\.(.*)$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1810 rformElems = /^(?:textarea|input|select)$/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1811 rperiod = /\./g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1812 rspace = / /g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1813 rescape = /[^\w\s.|`]/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1814 fcleanup = function( nm ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1815 return nm.replace(rescape, "\\$&");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1816 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1817 focusCounts = { focusin: 0, focusout: 0 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1818
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1819 /*
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1820 * A number of helper functions used for managing events.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1821 * Many of the ideas behind this code originated from
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1822 * Dean Edwards' addEvent library.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1823 */
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1824 jQuery.event = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1825
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1826 // Bind an event to an element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1827 // Original by Dean Edwards
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1828 add: function( elem, types, handler, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1829 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1830 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1831 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1832
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1833 // For whatever reason, IE has trouble passing the window object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1834 // around, causing it to be cloned in the process
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1835 if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1836 elem = window;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1837 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1838
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1839 if ( handler === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1840 handler = returnFalse;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1841 } else if ( !handler ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1842 // Fixes bug #7229. Fix recommended by jdalton
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1843 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1844 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1845
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1846 var handleObjIn, handleObj;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1847
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1848 if ( handler.handler ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1849 handleObjIn = handler;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1850 handler = handleObjIn.handler;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1851 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1852
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1853 // Make sure that the function being executed has a unique ID
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1854 if ( !handler.guid ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1855 handler.guid = jQuery.guid++;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1856 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1857
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1858 // Init the element's event structure
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1859 var elemData = jQuery.data( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1860
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1861 // If no elemData is found then we must be trying to bind to one of the
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1862 // banned noData elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1863 if ( !elemData ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1864 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1865 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1866
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1867 // Use a key less likely to result in collisions for plain JS objects.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1868 // Fixes bug #7150.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1869 var eventKey = elem.nodeType ? "events" : "__events__",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1870 events = elemData[ eventKey ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1871 eventHandle = elemData.handle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1872
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1873 if ( typeof events === "function" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1874 // On plain objects events is a fn that holds the the data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1875 // which prevents this data from being JSON serialized
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1876 // the function does not need to be called, it just contains the data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1877 eventHandle = events.handle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1878 events = events.events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1879
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1880 } else if ( !events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1881 if ( !elem.nodeType ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1882 // On plain objects, create a fn that acts as the holder
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1883 // of the values to avoid JSON serialization of event data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1884 elemData[ eventKey ] = elemData = function(){};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1885 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1886
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1887 elemData.events = events = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1888 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1889
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1890 if ( !eventHandle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1891 elemData.handle = eventHandle = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1892 // Handle the second event of a trigger and when
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1893 // an event is called after a page has unloaded
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1894 return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1895 jQuery.event.handle.apply( eventHandle.elem, arguments ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1896 undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1897 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1898 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1899
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1900 // Add elem as a property of the handle function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1901 // This is to prevent a memory leak with non-native events in IE.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1902 eventHandle.elem = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1903
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1904 // Handle multiple events separated by a space
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1905 // jQuery(...).bind("mouseover mouseout", fn);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1906 types = types.split(" ");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1907
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1908 var type, i = 0, namespaces;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1909
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1910 while ( (type = types[ i++ ]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1911 handleObj = handleObjIn ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1912 jQuery.extend({}, handleObjIn) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1913 { handler: handler, data: data };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1914
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1915 // Namespaced event handlers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1916 if ( type.indexOf(".") > -1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1917 namespaces = type.split(".");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1918 type = namespaces.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1919 handleObj.namespace = namespaces.slice(0).sort().join(".");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1920
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1921 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1922 namespaces = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1923 handleObj.namespace = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1924 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1925
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1926 handleObj.type = type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1927 if ( !handleObj.guid ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1928 handleObj.guid = handler.guid;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1929 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1930
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1931 // Get the current list of functions bound to this event
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1932 var handlers = events[ type ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1933 special = jQuery.event.special[ type ] || {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1934
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1935 // Init the event handler queue
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1936 if ( !handlers ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1937 handlers = events[ type ] = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1938
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1939 // Check for a special event handler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1940 // Only use addEventListener/attachEvent if the special
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1941 // events handler returns false
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1942 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1943 // Bind the global event handler to the element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1944 if ( elem.addEventListener ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1945 elem.addEventListener( type, eventHandle, false );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1946
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1947 } else if ( elem.attachEvent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1948 elem.attachEvent( "on" + type, eventHandle );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1949 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1950 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1951 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1952
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1953 if ( special.add ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1954 special.add.call( elem, handleObj );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1955
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1956 if ( !handleObj.handler.guid ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1957 handleObj.handler.guid = handler.guid;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1958 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1959 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1960
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1961 // Add the function to the element's handler list
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1962 handlers.push( handleObj );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1963
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1964 // Keep track of which events have been used, for global triggering
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1965 jQuery.event.global[ type ] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1966 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1967
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1968 // Nullify elem to prevent memory leaks in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1969 elem = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1970 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1971
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1972 global: {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1973
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1974 // Detach an event or set of events from an element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1975 remove: function( elem, types, handler, pos ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1976 // don't do events on text and comment nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1977 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1978 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1979 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1980
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1981 if ( handler === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1982 handler = returnFalse;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1983 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1984
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1985 var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1986 eventKey = elem.nodeType ? "events" : "__events__",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1987 elemData = jQuery.data( elem ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1988 events = elemData && elemData[ eventKey ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1989
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1990 if ( !elemData || !events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1991 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1992 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1993
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1994 if ( typeof events === "function" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1995 elemData = events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1996 events = events.events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1997 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1998
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1999 // types is actually an event object here
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2000 if ( types && types.type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2001 handler = types.handler;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2002 types = types.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2003 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2004
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2005 // Unbind all events for the element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2006 if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2007 types = types || "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2008
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2009 for ( type in events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2010 jQuery.event.remove( elem, type + types );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2011 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2012
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2013 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2014 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2015
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2016 // Handle multiple events separated by a space
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2017 // jQuery(...).unbind("mouseover mouseout", fn);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2018 types = types.split(" ");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2019
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2020 while ( (type = types[ i++ ]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2021 origType = type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2022 handleObj = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2023 all = type.indexOf(".") < 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2024 namespaces = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2025
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2026 if ( !all ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2027 // Namespaced event handlers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2028 namespaces = type.split(".");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2029 type = namespaces.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2030
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2031 namespace = new RegExp("(^|\\.)" +
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2032 jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2033 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2034
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2035 eventType = events[ type ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2036
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2037 if ( !eventType ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2038 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2039 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2040
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2041 if ( !handler ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2042 for ( j = 0; j < eventType.length; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2043 handleObj = eventType[ j ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2044
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2045 if ( all || namespace.test( handleObj.namespace ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2046 jQuery.event.remove( elem, origType, handleObj.handler, j );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2047 eventType.splice( j--, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2048 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2049 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2050
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2051 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2052 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2053
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2054 special = jQuery.event.special[ type ] || {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2055
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2056 for ( j = pos || 0; j < eventType.length; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2057 handleObj = eventType[ j ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2058
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2059 if ( handler.guid === handleObj.guid ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2060 // remove the given handler for the given type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2061 if ( all || namespace.test( handleObj.namespace ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2062 if ( pos == null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2063 eventType.splice( j--, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2064 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2065
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2066 if ( special.remove ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2067 special.remove.call( elem, handleObj );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2068 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2069 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2070
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2071 if ( pos != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2072 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2073 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2074 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2075 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2076
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2077 // remove generic event handler if no more handlers exist
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2078 if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2079 if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2080 jQuery.removeEvent( elem, type, elemData.handle );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2081 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2082
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2083 ret = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2084 delete events[ type ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2085 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2086 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2087
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2088 // Remove the expando if it's no longer used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2089 if ( jQuery.isEmptyObject( events ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2090 var handle = elemData.handle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2091 if ( handle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2092 handle.elem = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2093 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2094
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2095 delete elemData.events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2096 delete elemData.handle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2097
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2098 if ( typeof elemData === "function" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2099 jQuery.removeData( elem, eventKey );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2100
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2101 } else if ( jQuery.isEmptyObject( elemData ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2102 jQuery.removeData( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2103 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2104 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2105 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2106
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2107 // bubbling is internal
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2108 trigger: function( event, data, elem /*, bubbling */ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2109 // Event object or event type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2110 var type = event.type || event,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2111 bubbling = arguments[3];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2112
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2113 if ( !bubbling ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2114 event = typeof event === "object" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2115 // jQuery.Event object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2116 event[ jQuery.expando ] ? event :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2117 // Object literal
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2118 jQuery.extend( jQuery.Event(type), event ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2119 // Just the event type (string)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2120 jQuery.Event(type);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2121
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2122 if ( type.indexOf("!") >= 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2123 event.type = type = type.slice(0, -1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2124 event.exclusive = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2125 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2126
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2127 // Handle a global trigger
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2128 if ( !elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2129 // Don't bubble custom events when global (to avoid too much overhead)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2130 event.stopPropagation();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2131
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2132 // Only trigger if we've ever bound an event for it
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2133 if ( jQuery.event.global[ type ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2134 jQuery.each( jQuery.cache, function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2135 if ( this.events && this.events[type] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2136 jQuery.event.trigger( event, data, this.handle.elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2137 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2138 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2139 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2140 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2141
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2142 // Handle triggering a single element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2143
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2144 // don't do events on text and comment nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2145 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2146 return undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2147 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2148
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2149 // Clean up in case it is reused
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2150 event.result = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2151 event.target = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2152
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2153 // Clone the incoming data, if any
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2154 data = jQuery.makeArray( data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2155 data.unshift( event );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2156 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2157
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2158 event.currentTarget = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2159
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2160 // Trigger the event, it is assumed that "handle" is a function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2161 var handle = elem.nodeType ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2162 jQuery.data( elem, "handle" ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2163 (jQuery.data( elem, "__events__" ) || {}).handle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2164
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2165 if ( handle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2166 handle.apply( elem, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2167 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2168
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2169 var parent = elem.parentNode || elem.ownerDocument;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2170
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2171 // Trigger an inline bound script
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2172 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2173 if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2174 if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2175 event.result = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2176 event.preventDefault();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2177 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2178 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2179
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2180 // prevent IE from throwing an error for some elements with some event types, see #3533
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2181 } catch (inlineError) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2182
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2183 if ( !event.isPropagationStopped() && parent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2184 jQuery.event.trigger( event, data, parent, true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2185
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2186 } else if ( !event.isDefaultPrevented() ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2187 var old,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2188 target = event.target,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2189 targetType = type.replace( rnamespaces, "" ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2190 isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2191 special = jQuery.event.special[ targetType ] || {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2192
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2193 if ( (!special._default || special._default.call( elem, event ) === false) &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2194 !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2195
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2196 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2197 if ( target[ targetType ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2198 // Make sure that we don't accidentally re-trigger the onFOO events
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2199 old = target[ "on" + targetType ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2200
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2201 if ( old ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2202 target[ "on" + targetType ] = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2203 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2204
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2205 jQuery.event.triggered = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2206 target[ targetType ]();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2207 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2208
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2209 // prevent IE from throwing an error for some elements with some event types, see #3533
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2210 } catch (triggerError) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2211
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2212 if ( old ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2213 target[ "on" + targetType ] = old;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2214 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2215
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2216 jQuery.event.triggered = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2217 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2218 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2219 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2220
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2221 handle: function( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2222 var all, handlers, namespaces, namespace_re, events,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2223 namespace_sort = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2224 args = jQuery.makeArray( arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2225
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2226 event = args[0] = jQuery.event.fix( event || window.event );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2227 event.currentTarget = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2228
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2229 // Namespaced event handlers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2230 all = event.type.indexOf(".") < 0 && !event.exclusive;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2231
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2232 if ( !all ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2233 namespaces = event.type.split(".");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2234 event.type = namespaces.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2235 namespace_sort = namespaces.slice(0).sort();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2236 namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2237 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2238
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2239 event.namespace = event.namespace || namespace_sort.join(".");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2240
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2241 events = jQuery.data(this, this.nodeType ? "events" : "__events__");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2242
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2243 if ( typeof events === "function" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2244 events = events.events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2245 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2246
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2247 handlers = (events || {})[ event.type ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2248
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2249 if ( events && handlers ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2250 // Clone the handlers to prevent manipulation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2251 handlers = handlers.slice(0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2252
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2253 for ( var j = 0, l = handlers.length; j < l; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2254 var handleObj = handlers[ j ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2255
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2256 // Filter the functions by class
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2257 if ( all || namespace_re.test( handleObj.namespace ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2258 // Pass in a reference to the handler function itself
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2259 // So that we can later remove it
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2260 event.handler = handleObj.handler;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2261 event.data = handleObj.data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2262 event.handleObj = handleObj;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2263
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2264 var ret = handleObj.handler.apply( this, args );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2265
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2266 if ( ret !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2267 event.result = ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2268 if ( ret === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2269 event.preventDefault();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2270 event.stopPropagation();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2271 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2272 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2273
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2274 if ( event.isImmediatePropagationStopped() ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2275 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2276 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2277 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2278 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2279 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2280
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2281 return event.result;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2282 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2283
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2284 props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2285
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2286 fix: function( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2287 if ( event[ jQuery.expando ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2288 return event;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2289 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2290
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2291 // store a copy of the original event object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2292 // and "clone" to set read-only properties
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2293 var originalEvent = event;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2294 event = jQuery.Event( originalEvent );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2295
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2296 for ( var i = this.props.length, prop; i; ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2297 prop = this.props[ --i ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2298 event[ prop ] = originalEvent[ prop ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2299 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2300
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2301 // Fix target property, if necessary
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2302 if ( !event.target ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2303 // Fixes #1925 where srcElement might not be defined either
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2304 event.target = event.srcElement || document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2305 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2306
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2307 // check if target is a textnode (safari)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2308 if ( event.target.nodeType === 3 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2309 event.target = event.target.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2310 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2311
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2312 // Add relatedTarget, if necessary
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2313 if ( !event.relatedTarget && event.fromElement ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2314 event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2315 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2316
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2317 // Calculate pageX/Y if missing and clientX/Y available
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2318 if ( event.pageX == null && event.clientX != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2319 var doc = document.documentElement,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2320 body = document.body;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2321
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2322 event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2323 event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2324 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2325
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2326 // Add which for key events
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2327 if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2328 event.which = event.charCode != null ? event.charCode : event.keyCode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2329 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2330
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2331 // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2332 if ( !event.metaKey && event.ctrlKey ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2333 event.metaKey = event.ctrlKey;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2334 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2335
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2336 // Add which for click: 1 === left; 2 === middle; 3 === right
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2337 // Note: button is not normalized, so don't use it
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2338 if ( !event.which && event.button !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2339 event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2340 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2341
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2342 return event;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2343 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2344
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2345 // Deprecated, use jQuery.guid instead
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2346 guid: 1E8,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2347
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2348 // Deprecated, use jQuery.proxy instead
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2349 proxy: jQuery.proxy,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2350
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2351 special: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2352 ready: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2353 // Make sure the ready event is setup
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2354 setup: jQuery.bindReady,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2355 teardown: jQuery.noop
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2356 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2357
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2358 live: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2359 add: function( handleObj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2360 jQuery.event.add( this,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2361 liveConvert( handleObj.origType, handleObj.selector ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2362 jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2363 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2364
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2365 remove: function( handleObj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2366 jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2367 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2368 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2369
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2370 beforeunload: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2371 setup: function( data, namespaces, eventHandle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2372 // We only want to do this special case on windows
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2373 if ( jQuery.isWindow( this ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2374 this.onbeforeunload = eventHandle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2375 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2376 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2377
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2378 teardown: function( namespaces, eventHandle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2379 if ( this.onbeforeunload === eventHandle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2380 this.onbeforeunload = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2381 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2382 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2383 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2384 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2385 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2386
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2387 jQuery.removeEvent = document.removeEventListener ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2388 function( elem, type, handle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2389 if ( elem.removeEventListener ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2390 elem.removeEventListener( type, handle, false );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2391 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2392 } :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2393 function( elem, type, handle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2394 if ( elem.detachEvent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2395 elem.detachEvent( "on" + type, handle );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2396 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2397 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2398
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2399 jQuery.Event = function( src ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2400 // Allow instantiation without the 'new' keyword
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2401 if ( !this.preventDefault ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2402 return new jQuery.Event( src );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2403 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2404
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2405 // Event object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2406 if ( src && src.type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2407 this.originalEvent = src;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2408 this.type = src.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2409 // Event type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2410 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2411 this.type = src;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2412 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2413
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2414 // timeStamp is buggy for some events on Firefox(#3843)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2415 // So we won't rely on the native value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2416 this.timeStamp = jQuery.now();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2417
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2418 // Mark it as fixed
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2419 this[ jQuery.expando ] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2420 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2421
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2422 function returnFalse() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2423 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2424 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2425 function returnTrue() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2426 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2427 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2428
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2429 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2430 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2431 jQuery.Event.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2432 preventDefault: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2433 this.isDefaultPrevented = returnTrue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2434
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2435 var e = this.originalEvent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2436 if ( !e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2437 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2438 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2439
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2440 // if preventDefault exists run it on the original event
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2441 if ( e.preventDefault ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2442 e.preventDefault();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2443
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2444 // otherwise set the returnValue property of the original event to false (IE)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2445 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2446 e.returnValue = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2447 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2448 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2449 stopPropagation: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2450 this.isPropagationStopped = returnTrue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2451
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2452 var e = this.originalEvent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2453 if ( !e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2454 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2455 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2456 // if stopPropagation exists run it on the original event
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2457 if ( e.stopPropagation ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2458 e.stopPropagation();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2459 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2460 // otherwise set the cancelBubble property of the original event to true (IE)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2461 e.cancelBubble = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2462 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2463 stopImmediatePropagation: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2464 this.isImmediatePropagationStopped = returnTrue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2465 this.stopPropagation();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2466 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2467 isDefaultPrevented: returnFalse,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2468 isPropagationStopped: returnFalse,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2469 isImmediatePropagationStopped: returnFalse
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2470 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2471
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2472 // Checks if an event happened on an element within another element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2473 // Used in jQuery.event.special.mouseenter and mouseleave handlers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2474 var withinElement = function( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2475 // Check if mouse(over|out) are still within the same parent element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2476 var parent = event.relatedTarget;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2477
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2478 // Firefox sometimes assigns relatedTarget a XUL element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2479 // which we cannot access the parentNode property of
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2480 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2481 // Traverse up the tree
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2482 while ( parent && parent !== this ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2483 parent = parent.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2484 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2485
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2486 if ( parent !== this ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2487 // set the correct event type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2488 event.type = event.data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2489
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2490 // handle event if we actually just moused on to a non sub-element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2491 jQuery.event.handle.apply( this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2492 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2493
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2494 // assuming we've left the element since we most likely mousedover a xul element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2495 } catch(e) { }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2496 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2497
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2498 // In case of event delegation, we only need to rename the event.type,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2499 // liveHandler will take care of the rest.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2500 delegate = function( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2501 event.type = event.data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2502 jQuery.event.handle.apply( this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2503 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2504
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2505 // Create mouseenter and mouseleave events
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2506 jQuery.each({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2507 mouseenter: "mouseover",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2508 mouseleave: "mouseout"
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2509 }, function( orig, fix ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2510 jQuery.event.special[ orig ] = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2511 setup: function( data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2512 jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2513 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2514 teardown: function( data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2515 jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2516 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2517 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2518 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2519
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2520 // submit delegation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2521 if ( !jQuery.support.submitBubbles ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2522
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2523 jQuery.event.special.submit = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2524 setup: function( data, namespaces ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2525 if ( this.nodeName.toLowerCase() !== "form" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2526 jQuery.event.add(this, "click.specialSubmit", function( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2527 var elem = e.target,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2528 type = elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2529
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2530 if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2531 e.liveFired = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2532 return trigger( "submit", this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2533 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2534 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2535
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2536 jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2537 var elem = e.target,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2538 type = elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2539
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2540 if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2541 e.liveFired = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2542 return trigger( "submit", this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2543 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2544 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2545
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2546 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2547 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2548 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2549 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2550
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2551 teardown: function( namespaces ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2552 jQuery.event.remove( this, ".specialSubmit" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2553 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2554 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2555
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2556 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2557
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2558 // change delegation, happens here so we have bind.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2559 if ( !jQuery.support.changeBubbles ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2560
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2561 var changeFilters,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2562
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2563 getVal = function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2564 var type = elem.type, val = elem.value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2565
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2566 if ( type === "radio" || type === "checkbox" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2567 val = elem.checked;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2568
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2569 } else if ( type === "select-multiple" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2570 val = elem.selectedIndex > -1 ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2571 jQuery.map( elem.options, function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2572 return elem.selected;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2573 }).join("-") :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2574 "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2575
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2576 } else if ( elem.nodeName.toLowerCase() === "select" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2577 val = elem.selectedIndex;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2578 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2579
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2580 return val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2581 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2582
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2583 testChange = function testChange( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2584 var elem = e.target, data, val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2585
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2586 if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2587 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2588 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2589
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2590 data = jQuery.data( elem, "_change_data" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2591 val = getVal(elem);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2592
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2593 // the current data will be also retrieved by beforeactivate
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2594 if ( e.type !== "focusout" || elem.type !== "radio" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2595 jQuery.data( elem, "_change_data", val );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2596 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2597
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2598 if ( data === undefined || val === data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2599 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2600 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2601
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2602 if ( data != null || val ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2603 e.type = "change";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2604 e.liveFired = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2605 return jQuery.event.trigger( e, arguments[1], elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2606 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2607 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2608
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2609 jQuery.event.special.change = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2610 filters: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2611 focusout: testChange,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2612
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2613 beforedeactivate: testChange,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2614
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2615 click: function( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2616 var elem = e.target, type = elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2617
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2618 if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2619 return testChange.call( this, e );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2620 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2621 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2622
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2623 // Change has to be called before submit
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2624 // Keydown will be called before keypress, which is used in submit-event delegation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2625 keydown: function( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2626 var elem = e.target, type = elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2627
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2628 if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2629 (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2630 type === "select-multiple" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2631 return testChange.call( this, e );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2632 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2633 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2634
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2635 // Beforeactivate happens also before the previous element is blurred
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2636 // with this event you can't trigger a change event, but you can store
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2637 // information
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2638 beforeactivate: function( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2639 var elem = e.target;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2640 jQuery.data( elem, "_change_data", getVal(elem) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2641 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2642 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2643
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2644 setup: function( data, namespaces ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2645 if ( this.type === "file" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2646 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2647 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2648
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2649 for ( var type in changeFilters ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2650 jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2651 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2652
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2653 return rformElems.test( this.nodeName );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2654 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2655
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2656 teardown: function( namespaces ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2657 jQuery.event.remove( this, ".specialChange" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2658
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2659 return rformElems.test( this.nodeName );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2660 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2661 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2662
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2663 changeFilters = jQuery.event.special.change.filters;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2664
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2665 // Handle when the input is .focus()'d
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2666 changeFilters.focus = changeFilters.beforeactivate;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2667 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2668
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2669 function trigger( type, elem, args ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2670 args[0].type = type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2671 return jQuery.event.handle.apply( elem, args );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2672 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2673
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2674 // Create "bubbling" focus and blur events
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2675 if ( document.addEventListener ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2676 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2677 jQuery.event.special[ fix ] = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2678 setup: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2679 if ( focusCounts[fix]++ === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2680 document.addEventListener( orig, handler, true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2681 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2682 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2683 teardown: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2684 if ( --focusCounts[fix] === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2685 document.removeEventListener( orig, handler, true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2686 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2687 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2688 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2689
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2690 function handler( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2691 e = jQuery.event.fix( e );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2692 e.type = fix;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2693 return jQuery.event.trigger( e, null, e.target );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2694 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2695 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2696 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2697
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2698 jQuery.each(["bind", "one"], function( i, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2699 jQuery.fn[ name ] = function( type, data, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2700 // Handle object literals
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2701 if ( typeof type === "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2702 for ( var key in type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2703 this[ name ](key, data, type[key], fn);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2704 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2705 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2706 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2707
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2708 if ( jQuery.isFunction( data ) || data === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2709 fn = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2710 data = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2711 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2712
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2713 var handler = name === "one" ? jQuery.proxy( fn, function( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2714 jQuery( this ).unbind( event, handler );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2715 return fn.apply( this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2716 }) : fn;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2717
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2718 if ( type === "unload" && name !== "one" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2719 this.one( type, data, fn );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2720
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2721 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2722 for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2723 jQuery.event.add( this[i], type, handler, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2724 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2725 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2726
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2727 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2728 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2729 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2730
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2731 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2732 unbind: function( type, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2733 // Handle object literals
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2734 if ( typeof type === "object" && !type.preventDefault ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2735 for ( var key in type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2736 this.unbind(key, type[key]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2737 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2738
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2739 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2740 for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2741 jQuery.event.remove( this[i], type, fn );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2742 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2743 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2744
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2745 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2746 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2747
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2748 delegate: function( selector, types, data, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2749 return this.live( types, data, fn, selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2750 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2751
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2752 undelegate: function( selector, types, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2753 if ( arguments.length === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2754 return this.unbind( "live" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2755
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2756 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2757 return this.die( types, null, fn, selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2758 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2759 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2760
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2761 trigger: function( type, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2762 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2763 jQuery.event.trigger( type, data, this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2764 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2765 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2766
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2767 triggerHandler: function( type, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2768 if ( this[0] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2769 var event = jQuery.Event( type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2770 event.preventDefault();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2771 event.stopPropagation();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2772 jQuery.event.trigger( event, data, this[0] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2773 return event.result;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2774 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2775 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2776
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2777 toggle: function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2778 // Save reference to arguments for access in closure
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2779 var args = arguments,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2780 i = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2781
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2782 // link all the functions, so any of them can unbind this click handler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2783 while ( i < args.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2784 jQuery.proxy( fn, args[ i++ ] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2785 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2786
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2787 return this.click( jQuery.proxy( fn, function( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2788 // Figure out which function to execute
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2789 var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2790 jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2791
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2792 // Make sure that clicks stop
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2793 event.preventDefault();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2794
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2795 // and execute the function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2796 return args[ lastToggle ].apply( this, arguments ) || false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2797 }));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2798 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2799
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2800 hover: function( fnOver, fnOut ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2801 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2802 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2803 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2804
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2805 var liveMap = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2806 focus: "focusin",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2807 blur: "focusout",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2808 mouseenter: "mouseover",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2809 mouseleave: "mouseout"
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2810 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2811
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2812 jQuery.each(["live", "die"], function( i, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2813 jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2814 var type, i = 0, match, namespaces, preType,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2815 selector = origSelector || this.selector,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2816 context = origSelector ? this : jQuery( this.context );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2817
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2818 if ( typeof types === "object" && !types.preventDefault ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2819 for ( var key in types ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2820 context[ name ]( key, data, types[key], selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2821 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2822
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2823 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2824 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2825
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2826 if ( jQuery.isFunction( data ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2827 fn = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2828 data = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2829 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2830
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2831 types = (types || "").split(" ");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2832
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2833 while ( (type = types[ i++ ]) != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2834 match = rnamespaces.exec( type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2835 namespaces = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2836
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2837 if ( match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2838 namespaces = match[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2839 type = type.replace( rnamespaces, "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2840 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2841
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2842 if ( type === "hover" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2843 types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2844 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2845 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2846
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2847 preType = type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2848
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2849 if ( type === "focus" || type === "blur" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2850 types.push( liveMap[ type ] + namespaces );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2851 type = type + namespaces;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2852
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2853 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2854 type = (liveMap[ type ] || type) + namespaces;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2855 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2856
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2857 if ( name === "live" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2858 // bind live handler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2859 for ( var j = 0, l = context.length; j < l; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2860 jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2861 { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2862 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2863
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2864 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2865 // unbind live handler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2866 context.unbind( "live." + liveConvert( type, selector ), fn );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2867 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2868 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2869
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2870 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2871 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2872 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2873
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2874 function liveHandler( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2875 var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2876 elems = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2877 selectors = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2878 events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2879
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2880 if ( typeof events === "function" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2881 events = events.events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2882 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2883
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2884 // Make sure we avoid non-left-click bubbling in Firefox (#3861)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2885 if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2886 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2887 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2888
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2889 if ( event.namespace ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2890 namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2891 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2892
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2893 event.liveFired = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2894
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2895 var live = events.live.slice(0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2896
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2897 for ( j = 0; j < live.length; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2898 handleObj = live[j];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2899
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2900 if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2901 selectors.push( handleObj.selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2902
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2903 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2904 live.splice( j--, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2905 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2906 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2907
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2908 match = jQuery( event.target ).closest( selectors, event.currentTarget );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2909
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2910 for ( i = 0, l = match.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2911 close = match[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2912
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2913 for ( j = 0; j < live.length; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2914 handleObj = live[j];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2915
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2916 if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2917 elem = close.elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2918 related = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2919
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2920 // Those two events require additional checking
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2921 if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2922 event.type = handleObj.preType;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2923 related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2924 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2925
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2926 if ( !related || related !== elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2927 elems.push({ elem: elem, handleObj: handleObj, level: close.level });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2928 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2929 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2930 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2931 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2932
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2933 for ( i = 0, l = elems.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2934 match = elems[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2935
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2936 if ( maxLevel && match.level > maxLevel ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2937 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2938 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2939
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2940 event.currentTarget = match.elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2941 event.data = match.handleObj.data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2942 event.handleObj = match.handleObj;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2943
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2944 ret = match.handleObj.origHandler.apply( match.elem, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2945
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2946 if ( ret === false || event.isPropagationStopped() ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2947 maxLevel = match.level;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2948
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2949 if ( ret === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2950 stop = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2951 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2952 if ( event.isImmediatePropagationStopped() ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2953 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2954 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2955 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2956 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2957
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2958 return stop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2959 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2960
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2961 function liveConvert( type, selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2962 return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2963 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2964
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2965 jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2966 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2967 "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2968
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2969 // Handle event binding
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2970 jQuery.fn[ name ] = function( data, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2971 if ( fn == null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2972 fn = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2973 data = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2974 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2975
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2976 return arguments.length > 0 ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2977 this.bind( name, data, fn ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2978 this.trigger( name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2979 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2980
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2981 if ( jQuery.attrFn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2982 jQuery.attrFn[ name ] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2983 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2984 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2985
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2986 // Prevent memory leaks in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2987 // Window isn't included so as not to unbind existing unload events
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2988 // More info:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2989 // - http://isaacschlueter.com/2006/10/msie-memory-leaks/
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2990 if ( window.attachEvent && !window.addEventListener ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2991 jQuery(window).bind("unload", function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2992 for ( var id in jQuery.cache ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2993 if ( jQuery.cache[ id ].handle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2994 // Try/Catch is to handle iframes being unloaded, see #4280
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2995 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2996 jQuery.event.remove( jQuery.cache[ id ].handle.elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2997 } catch(e) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2998 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2999 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3000 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3001 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3002
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3003
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3004 (function(){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3005
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3006 var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3007 done = 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3008 toString = Object.prototype.toString,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3009 hasDuplicate = false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3010 baseHasDuplicate = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3011
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3012 // Here we check if the JavaScript engine is using some sort of
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3013 // optimization where it does not always call our comparision
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3014 // function. If that is the case, discard the hasDuplicate value.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3015 // Thus far that includes Google Chrome.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3016 [0, 0].sort(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3017 baseHasDuplicate = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3018 return 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3019 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3020
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3021 var Sizzle = function( selector, context, results, seed ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3022 results = results || [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3023 context = context || document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3024
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3025 var origContext = context;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3026
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3027 if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3028 return [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3029 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3030
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3031 if ( !selector || typeof selector !== "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3032 return results;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3033 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3034
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3035 var m, set, checkSet, extra, ret, cur, pop, i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3036 prune = true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3037 contextXML = Sizzle.isXML( context ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3038 parts = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3039 soFar = selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3040
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3041 // Reset the position of the chunker regexp (start from head)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3042 do {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3043 chunker.exec( "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3044 m = chunker.exec( soFar );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3045
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3046 if ( m ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3047 soFar = m[3];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3048
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3049 parts.push( m[1] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3050
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3051 if ( m[2] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3052 extra = m[3];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3053 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3054 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3055 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3056 } while ( m );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3057
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3058 if ( parts.length > 1 && origPOS.exec( selector ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3059
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3060 if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3061 set = posProcess( parts[0] + parts[1], context );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3062
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3063 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3064 set = Expr.relative[ parts[0] ] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3065 [ context ] :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3066 Sizzle( parts.shift(), context );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3067
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3068 while ( parts.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3069 selector = parts.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3070
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3071 if ( Expr.relative[ selector ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3072 selector += parts.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3073 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3074
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3075 set = posProcess( selector, set );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3076 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3077 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3078
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3079 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3080 // Take a shortcut and set the context if the root selector is an ID
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3081 // (but not if it'll be faster if the inner selector is an ID)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3082 if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3083 Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3084
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3085 ret = Sizzle.find( parts.shift(), context, contextXML );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3086 context = ret.expr ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3087 Sizzle.filter( ret.expr, ret.set )[0] :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3088 ret.set[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3089 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3090
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3091 if ( context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3092 ret = seed ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3093 { expr: parts.pop(), set: makeArray(seed) } :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3094 Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3095
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3096 set = ret.expr ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3097 Sizzle.filter( ret.expr, ret.set ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3098 ret.set;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3099
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3100 if ( parts.length > 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3101 checkSet = makeArray( set );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3102
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3103 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3104 prune = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3105 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3106
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3107 while ( parts.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3108 cur = parts.pop();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3109 pop = cur;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3110
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3111 if ( !Expr.relative[ cur ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3112 cur = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3113 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3114 pop = parts.pop();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3115 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3116
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3117 if ( pop == null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3118 pop = context;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3119 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3120
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3121 Expr.relative[ cur ]( checkSet, pop, contextXML );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3122 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3123
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3124 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3125 checkSet = parts = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3126 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3127 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3128
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3129 if ( !checkSet ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3130 checkSet = set;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3131 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3132
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3133 if ( !checkSet ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3134 Sizzle.error( cur || selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3135 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3136
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3137 if ( toString.call(checkSet) === "[object Array]" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3138 if ( !prune ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3139 results.push.apply( results, checkSet );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3140
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3141 } else if ( context && context.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3142 for ( i = 0; checkSet[i] != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3143 if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3144 results.push( set[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3145 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3146 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3147
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3148 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3149 for ( i = 0; checkSet[i] != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3150 if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3151 results.push( set[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3152 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3153 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3154 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3155
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3156 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3157 makeArray( checkSet, results );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3158 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3159
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3160 if ( extra ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3161 Sizzle( extra, origContext, results, seed );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3162 Sizzle.uniqueSort( results );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3163 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3164
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3165 return results;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3166 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3167
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3168 Sizzle.uniqueSort = function( results ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3169 if ( sortOrder ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3170 hasDuplicate = baseHasDuplicate;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3171 results.sort( sortOrder );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3172
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3173 if ( hasDuplicate ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3174 for ( var i = 1; i < results.length; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3175 if ( results[i] === results[ i - 1 ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3176 results.splice( i--, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3177 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3178 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3179 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3180 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3181
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3182 return results;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3183 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3184
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3185 Sizzle.matches = function( expr, set ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3186 return Sizzle( expr, null, null, set );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3187 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3188
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3189 Sizzle.matchesSelector = function( node, expr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3190 return Sizzle( expr, null, null, [node] ).length > 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3191 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3192
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3193 Sizzle.find = function( expr, context, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3194 var set;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3195
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3196 if ( !expr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3197 return [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3198 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3199
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3200 for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3201 var match,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3202 type = Expr.order[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3203
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3204 if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3205 var left = match[1];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3206 match.splice( 1, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3207
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3208 if ( left.substr( left.length - 1 ) !== "\\" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3209 match[1] = (match[1] || "").replace(/\\/g, "");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3210 set = Expr.find[ type ]( match, context, isXML );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3211
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3212 if ( set != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3213 expr = expr.replace( Expr.match[ type ], "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3214 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3215 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3216 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3217 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3218 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3219
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3220 if ( !set ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3221 set = context.getElementsByTagName( "*" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3222 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3223
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3224 return { set: set, expr: expr };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3225 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3226
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3227 Sizzle.filter = function( expr, set, inplace, not ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3228 var match, anyFound,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3229 old = expr,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3230 result = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3231 curLoop = set,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3232 isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3233
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3234 while ( expr && set.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3235 for ( var type in Expr.filter ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3236 if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3237 var found, item,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3238 filter = Expr.filter[ type ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3239 left = match[1];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3240
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3241 anyFound = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3242
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3243 match.splice(1,1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3244
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3245 if ( left.substr( left.length - 1 ) === "\\" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3246 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3247 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3248
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3249 if ( curLoop === result ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3250 result = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3251 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3252
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3253 if ( Expr.preFilter[ type ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3254 match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3255
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3256 if ( !match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3257 anyFound = found = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3258
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3259 } else if ( match === true ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3260 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3261 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3262 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3263
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3264 if ( match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3265 for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3266 if ( item ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3267 found = filter( item, match, i, curLoop );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3268 var pass = not ^ !!found;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3269
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3270 if ( inplace && found != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3271 if ( pass ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3272 anyFound = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3273
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3274 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3275 curLoop[i] = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3276 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3277
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3278 } else if ( pass ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3279 result.push( item );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3280 anyFound = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3281 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3282 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3283 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3284 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3285
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3286 if ( found !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3287 if ( !inplace ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3288 curLoop = result;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3289 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3290
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3291 expr = expr.replace( Expr.match[ type ], "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3292
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3293 if ( !anyFound ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3294 return [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3295 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3296
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3297 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3298 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3299 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3300 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3301
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3302 // Improper expression
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3303 if ( expr === old ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3304 if ( anyFound == null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3305 Sizzle.error( expr );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3306
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3307 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3308 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3309 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3310 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3311
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3312 old = expr;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3313 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3314
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3315 return curLoop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3316 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3317
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3318 Sizzle.error = function( msg ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3319 throw "Syntax error, unrecognized expression: " + msg;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3320 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3321
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3322 var Expr = Sizzle.selectors = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3323 order: [ "ID", "NAME", "TAG" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3324
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3325 match: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3326 ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3327 CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3328 NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3329 ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3330 TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3331 CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3332 POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3333 PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3334 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3335
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3336 leftMatch: {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3337
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3338 attrMap: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3339 "class": "className",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3340 "for": "htmlFor"
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3341 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3342
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3343 attrHandle: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3344 href: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3345 return elem.getAttribute( "href" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3346 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3347 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3348
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3349 relative: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3350 "+": function(checkSet, part){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3351 var isPartStr = typeof part === "string",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3352 isTag = isPartStr && !/\W/.test( part ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3353 isPartStrNotTag = isPartStr && !isTag;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3354
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3355 if ( isTag ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3356 part = part.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3357 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3358
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3359 for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3360 if ( (elem = checkSet[i]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3361 while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3362
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3363 checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3364 elem || false :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3365 elem === part;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3366 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3367 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3368
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3369 if ( isPartStrNotTag ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3370 Sizzle.filter( part, checkSet, true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3371 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3372 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3373
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3374 ">": function( checkSet, part ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3375 var elem,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3376 isPartStr = typeof part === "string",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3377 i = 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3378 l = checkSet.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3379
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3380 if ( isPartStr && !/\W/.test( part ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3381 part = part.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3382
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3383 for ( ; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3384 elem = checkSet[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3385
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3386 if ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3387 var parent = elem.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3388 checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3389 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3390 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3391
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3392 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3393 for ( ; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3394 elem = checkSet[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3395
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3396 if ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3397 checkSet[i] = isPartStr ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3398 elem.parentNode :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3399 elem.parentNode === part;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3400 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3401 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3402
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3403 if ( isPartStr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3404 Sizzle.filter( part, checkSet, true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3405 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3406 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3407 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3408
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3409 "": function(checkSet, part, isXML){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3410 var nodeCheck,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3411 doneName = done++,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3412 checkFn = dirCheck;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3413
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3414 if ( typeof part === "string" && !/\W/.test(part) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3415 part = part.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3416 nodeCheck = part;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3417 checkFn = dirNodeCheck;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3418 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3419
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3420 checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3421 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3422
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3423 "~": function( checkSet, part, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3424 var nodeCheck,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3425 doneName = done++,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3426 checkFn = dirCheck;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3427
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3428 if ( typeof part === "string" && !/\W/.test( part ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3429 part = part.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3430 nodeCheck = part;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3431 checkFn = dirNodeCheck;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3432 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3433
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3434 checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3435 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3436 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3437
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3438 find: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3439 ID: function( match, context, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3440 if ( typeof context.getElementById !== "undefined" && !isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3441 var m = context.getElementById(match[1]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3442 // Check parentNode to catch when Blackberry 4.6 returns
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3443 // nodes that are no longer in the document #6963
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3444 return m && m.parentNode ? [m] : [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3445 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3446 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3447
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3448 NAME: function( match, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3449 if ( typeof context.getElementsByName !== "undefined" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3450 var ret = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3451 results = context.getElementsByName( match[1] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3452
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3453 for ( var i = 0, l = results.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3454 if ( results[i].getAttribute("name") === match[1] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3455 ret.push( results[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3456 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3457 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3458
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3459 return ret.length === 0 ? null : ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3460 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3461 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3462
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3463 TAG: function( match, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3464 return context.getElementsByTagName( match[1] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3465 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3466 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3467 preFilter: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3468 CLASS: function( match, curLoop, inplace, result, not, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3469 match = " " + match[1].replace(/\\/g, "") + " ";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3470
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3471 if ( isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3472 return match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3473 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3474
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3475 for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3476 if ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3477 if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3478 if ( !inplace ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3479 result.push( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3480 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3481
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3482 } else if ( inplace ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3483 curLoop[i] = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3484 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3485 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3486 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3487
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3488 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3489 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3490
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3491 ID: function( match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3492 return match[1].replace(/\\/g, "");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3493 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3494
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3495 TAG: function( match, curLoop ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3496 return match[1].toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3497 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3498
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3499 CHILD: function( match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3500 if ( match[1] === "nth" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3501 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3502 var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3503 match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3504 !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3505
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3506 // calculate the numbers (first)n+(last) including if they are negative
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3507 match[2] = (test[1] + (test[2] || 1)) - 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3508 match[3] = test[3] - 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3509 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3510
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3511 // TODO: Move to normal caching system
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3512 match[0] = done++;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3513
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3514 return match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3515 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3516
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3517 ATTR: function( match, curLoop, inplace, result, not, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3518 var name = match[1].replace(/\\/g, "");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3519
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3520 if ( !isXML && Expr.attrMap[name] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3521 match[1] = Expr.attrMap[name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3522 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3523
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3524 if ( match[2] === "~=" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3525 match[4] = " " + match[4] + " ";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3526 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3527
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3528 return match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3529 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3530
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3531 PSEUDO: function( match, curLoop, inplace, result, not ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3532 if ( match[1] === "not" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3533 // If we're dealing with a complex expression, or a simple one
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3534 if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3535 match[3] = Sizzle(match[3], null, null, curLoop);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3536
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3537 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3538 var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3539
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3540 if ( !inplace ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3541 result.push.apply( result, ret );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3542 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3543
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3544 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3545 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3546
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3547 } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3548 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3549 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3550
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3551 return match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3552 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3553
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3554 POS: function( match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3555 match.unshift( true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3556
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3557 return match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3558 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3559 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3560
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3561 filters: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3562 enabled: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3563 return elem.disabled === false && elem.type !== "hidden";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3564 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3565
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3566 disabled: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3567 return elem.disabled === true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3568 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3569
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3570 checked: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3571 return elem.checked === true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3572 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3573
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3574 selected: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3575 // Accessing this property makes selected-by-default
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3576 // options in Safari work properly
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3577 elem.parentNode.selectedIndex;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3578
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3579 return elem.selected === true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3580 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3581
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3582 parent: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3583 return !!elem.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3584 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3585
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3586 empty: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3587 return !elem.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3588 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3589
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3590 has: function( elem, i, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3591 return !!Sizzle( match[3], elem ).length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3592 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3593
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3594 header: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3595 return (/h\d/i).test( elem.nodeName );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3596 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3597
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3598 text: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3599 return "text" === elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3600 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3601 radio: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3602 return "radio" === elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3603 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3604
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3605 checkbox: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3606 return "checkbox" === elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3607 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3608
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3609 file: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3610 return "file" === elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3611 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3612 password: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3613 return "password" === elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3614 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3615
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3616 submit: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3617 return "submit" === elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3618 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3619
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3620 image: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3621 return "image" === elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3622 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3623
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3624 reset: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3625 return "reset" === elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3626 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3627
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3628 button: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3629 return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3630 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3631
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3632 input: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3633 return (/input|select|textarea|button/i).test( elem.nodeName );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3634 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3635 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3636 setFilters: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3637 first: function( elem, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3638 return i === 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3639 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3640
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3641 last: function( elem, i, match, array ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3642 return i === array.length - 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3643 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3644
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3645 even: function( elem, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3646 return i % 2 === 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3647 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3648
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3649 odd: function( elem, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3650 return i % 2 === 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3651 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3652
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3653 lt: function( elem, i, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3654 return i < match[3] - 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3655 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3656
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3657 gt: function( elem, i, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3658 return i > match[3] - 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3659 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3660
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3661 nth: function( elem, i, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3662 return match[3] - 0 === i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3663 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3664
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3665 eq: function( elem, i, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3666 return match[3] - 0 === i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3667 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3668 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3669 filter: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3670 PSEUDO: function( elem, match, i, array ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3671 var name = match[1],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3672 filter = Expr.filters[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3673
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3674 if ( filter ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3675 return filter( elem, i, match, array );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3676
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3677 } else if ( name === "contains" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3678 return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3679
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3680 } else if ( name === "not" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3681 var not = match[3];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3682
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3683 for ( var j = 0, l = not.length; j < l; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3684 if ( not[j] === elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3685 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3686 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3687 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3688
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3689 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3690
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3691 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3692 Sizzle.error( "Syntax error, unrecognized expression: " + name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3693 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3694 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3695
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3696 CHILD: function( elem, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3697 var type = match[1],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3698 node = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3699
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3700 switch ( type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3701 case "only":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3702 case "first":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3703 while ( (node = node.previousSibling) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3704 if ( node.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3705 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3706 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3707 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3708
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3709 if ( type === "first" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3710 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3711 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3712
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3713 node = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3714
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3715 case "last":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3716 while ( (node = node.nextSibling) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3717 if ( node.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3718 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3719 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3720 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3721
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3722 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3723
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3724 case "nth":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3725 var first = match[2],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3726 last = match[3];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3727
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3728 if ( first === 1 && last === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3729 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3730 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3731
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3732 var doneName = match[0],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3733 parent = elem.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3734
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3735 if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3736 var count = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3737
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3738 for ( node = parent.firstChild; node; node = node.nextSibling ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3739 if ( node.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3740 node.nodeIndex = ++count;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3741 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3742 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3743
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3744 parent.sizcache = doneName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3745 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3746
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3747 var diff = elem.nodeIndex - last;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3748
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3749 if ( first === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3750 return diff === 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3751
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3752 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3753 return ( diff % first === 0 && diff / first >= 0 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3754 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3755 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3756 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3757
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3758 ID: function( elem, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3759 return elem.nodeType === 1 && elem.getAttribute("id") === match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3760 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3761
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3762 TAG: function( elem, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3763 return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3764 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3765
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3766 CLASS: function( elem, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3767 return (" " + (elem.className || elem.getAttribute("class")) + " ")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3768 .indexOf( match ) > -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3769 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3770
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3771 ATTR: function( elem, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3772 var name = match[1],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3773 result = Expr.attrHandle[ name ] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3774 Expr.attrHandle[ name ]( elem ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3775 elem[ name ] != null ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3776 elem[ name ] :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3777 elem.getAttribute( name ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3778 value = result + "",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3779 type = match[2],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3780 check = match[4];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3781
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3782 return result == null ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3783 type === "!=" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3784 type === "=" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3785 value === check :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3786 type === "*=" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3787 value.indexOf(check) >= 0 :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3788 type === "~=" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3789 (" " + value + " ").indexOf(check) >= 0 :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3790 !check ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3791 value && result !== false :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3792 type === "!=" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3793 value !== check :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3794 type === "^=" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3795 value.indexOf(check) === 0 :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3796 type === "$=" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3797 value.substr(value.length - check.length) === check :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3798 type === "|=" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3799 value === check || value.substr(0, check.length + 1) === check + "-" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3800 false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3801 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3802
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3803 POS: function( elem, match, i, array ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3804 var name = match[2],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3805 filter = Expr.setFilters[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3806
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3807 if ( filter ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3808 return filter( elem, i, match, array );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3809 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3810 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3811 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3812 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3813
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3814 var origPOS = Expr.match.POS,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3815 fescape = function(all, num){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3816 return "\\" + (num - 0 + 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3817 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3818
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3819 for ( var type in Expr.match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3820 Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3821 Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3822 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3823
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3824 var makeArray = function( array, results ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3825 array = Array.prototype.slice.call( array, 0 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3826
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3827 if ( results ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3828 results.push.apply( results, array );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3829 return results;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3830 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3831
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3832 return array;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3833 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3834
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3835 // Perform a simple check to determine if the browser is capable of
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3836 // converting a NodeList to an array using builtin methods.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3837 // Also verifies that the returned array holds DOM nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3838 // (which is not the case in the Blackberry browser)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3839 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3840 Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3841
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3842 // Provide a fallback method if it does not work
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3843 } catch( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3844 makeArray = function( array, results ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3845 var i = 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3846 ret = results || [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3847
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3848 if ( toString.call(array) === "[object Array]" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3849 Array.prototype.push.apply( ret, array );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3850
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3851 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3852 if ( typeof array.length === "number" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3853 for ( var l = array.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3854 ret.push( array[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3855 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3856
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3857 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3858 for ( ; array[i]; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3859 ret.push( array[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3860 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3861 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3862 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3863
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3864 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3865 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3866 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3867
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3868 var sortOrder, siblingCheck;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3869
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3870 if ( document.documentElement.compareDocumentPosition ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3871 sortOrder = function( a, b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3872 if ( a === b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3873 hasDuplicate = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3874 return 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3875 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3876
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3877 if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3878 return a.compareDocumentPosition ? -1 : 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3879 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3880
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3881 return a.compareDocumentPosition(b) & 4 ? -1 : 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3882 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3883
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3884 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3885 sortOrder = function( a, b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3886 var al, bl,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3887 ap = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3888 bp = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3889 aup = a.parentNode,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3890 bup = b.parentNode,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3891 cur = aup;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3892
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3893 // The nodes are identical, we can exit early
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3894 if ( a === b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3895 hasDuplicate = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3896 return 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3897
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3898 // If the nodes are siblings (or identical) we can do a quick check
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3899 } else if ( aup === bup ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3900 return siblingCheck( a, b );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3901
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3902 // If no parents were found then the nodes are disconnected
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3903 } else if ( !aup ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3904 return -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3905
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3906 } else if ( !bup ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3907 return 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3908 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3909
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3910 // Otherwise they're somewhere else in the tree so we need
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3911 // to build up a full list of the parentNodes for comparison
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3912 while ( cur ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3913 ap.unshift( cur );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3914 cur = cur.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3915 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3916
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3917 cur = bup;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3918
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3919 while ( cur ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3920 bp.unshift( cur );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3921 cur = cur.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3922 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3923
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3924 al = ap.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3925 bl = bp.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3926
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3927 // Start walking down the tree looking for a discrepancy
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3928 for ( var i = 0; i < al && i < bl; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3929 if ( ap[i] !== bp[i] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3930 return siblingCheck( ap[i], bp[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3931 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3932 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3933
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3934 // We ended someplace up the tree so do a sibling check
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3935 return i === al ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3936 siblingCheck( a, bp[i], -1 ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3937 siblingCheck( ap[i], b, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3938 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3939
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3940 siblingCheck = function( a, b, ret ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3941 if ( a === b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3942 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3943 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3944
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3945 var cur = a.nextSibling;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3946
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3947 while ( cur ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3948 if ( cur === b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3949 return -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3950 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3951
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3952 cur = cur.nextSibling;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3953 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3954
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3955 return 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3956 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3957 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3958
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3959 // Utility function for retreiving the text value of an array of DOM nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3960 Sizzle.getText = function( elems ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3961 var ret = "", elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3962
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3963 for ( var i = 0; elems[i]; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3964 elem = elems[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3965
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3966 // Get the text from text nodes and CDATA nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3967 if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3968 ret += elem.nodeValue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3969
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3970 // Traverse everything else, except comment nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3971 } else if ( elem.nodeType !== 8 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3972 ret += Sizzle.getText( elem.childNodes );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3973 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3974 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3975
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3976 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3977 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3978
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3979 // Check to see if the browser returns elements by name when
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3980 // querying by getElementById (and provide a workaround)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3981 (function(){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3982 // We're going to inject a fake input element with a specified name
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3983 var form = document.createElement("div"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3984 id = "script" + (new Date()).getTime(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3985 root = document.documentElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3986
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3987 form.innerHTML = "<a name='" + id + "'/>";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3988
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3989 // Inject it into the root element, check its status, and remove it quickly
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3990 root.insertBefore( form, root.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3991
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3992 // The workaround has to do additional checks after a getElementById
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3993 // Which slows things down for other browsers (hence the branching)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3994 if ( document.getElementById( id ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3995 Expr.find.ID = function( match, context, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3996 if ( typeof context.getElementById !== "undefined" && !isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3997 var m = context.getElementById(match[1]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3998
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3999 return m ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4000 m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4001 [m] :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4002 undefined :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4003 [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4004 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4005 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4006
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4007 Expr.filter.ID = function( elem, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4008 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4009
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4010 return elem.nodeType === 1 && node && node.nodeValue === match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4011 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4012 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4013
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4014 root.removeChild( form );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4015
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4016 // release memory in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4017 root = form = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4018 })();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4019
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4020 (function(){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4021 // Check to see if the browser returns only elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4022 // when doing getElementsByTagName("*")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4023
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4024 // Create a fake element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4025 var div = document.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4026 div.appendChild( document.createComment("") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4027
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4028 // Make sure no comments are found
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4029 if ( div.getElementsByTagName("*").length > 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4030 Expr.find.TAG = function( match, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4031 var results = context.getElementsByTagName( match[1] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4032
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4033 // Filter out possible comments
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4034 if ( match[1] === "*" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4035 var tmp = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4036
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4037 for ( var i = 0; results[i]; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4038 if ( results[i].nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4039 tmp.push( results[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4040 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4041 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4042
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4043 results = tmp;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4044 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4045
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4046 return results;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4047 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4048 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4049
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4050 // Check to see if an attribute returns normalized href attributes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4051 div.innerHTML = "<a href='#'></a>";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4052
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4053 if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4054 div.firstChild.getAttribute("href") !== "#" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4055
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4056 Expr.attrHandle.href = function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4057 return elem.getAttribute( "href", 2 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4058 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4059 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4060
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4061 // release memory in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4062 div = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4063 })();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4064
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4065 if ( document.querySelectorAll ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4066 (function(){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4067 var oldSizzle = Sizzle,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4068 div = document.createElement("div"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4069 id = "__sizzle__";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4070
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4071 div.innerHTML = "<p class='TEST'></p>";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4072
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4073 // Safari can't handle uppercase or unicode characters when
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4074 // in quirks mode.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4075 if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4076 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4077 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4078
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4079 Sizzle = function( query, context, extra, seed ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4080 context = context || document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4081
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4082 // Make sure that attribute selectors are quoted
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4083 query = query.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4084
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4085 // Only use querySelectorAll on non-XML documents
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4086 // (ID selectors don't work in non-HTML documents)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4087 if ( !seed && !Sizzle.isXML(context) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4088 if ( context.nodeType === 9 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4089 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4090 return makeArray( context.querySelectorAll(query), extra );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4091 } catch(qsaError) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4092
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4093 // qSA works strangely on Element-rooted queries
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4094 // We can work around this by specifying an extra ID on the root
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4095 // and working up from there (Thanks to Andrew Dupont for the technique)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4096 // IE 8 doesn't work on object elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4097 } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4098 var old = context.getAttribute( "id" ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4099 nid = old || id;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4100
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4101 if ( !old ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4102 context.setAttribute( "id", nid );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4103 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4104
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4105 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4106 return makeArray( context.querySelectorAll( "#" + nid + " " + query ), extra );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4107
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4108 } catch(pseudoError) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4109 } finally {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4110 if ( !old ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4111 context.removeAttribute( "id" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4112 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4113 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4114 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4115 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4116
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4117 return oldSizzle(query, context, extra, seed);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4118 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4119
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4120 for ( var prop in oldSizzle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4121 Sizzle[ prop ] = oldSizzle[ prop ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4122 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4123
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4124 // release memory in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4125 div = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4126 })();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4127 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4128
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4129 (function(){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4130 var html = document.documentElement,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4131 matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4132 pseudoWorks = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4133
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4134 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4135 // This should fail with an exception
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4136 // Gecko does not error, returns false instead
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4137 matches.call( document.documentElement, "[test!='']:sizzle" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4138
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4139 } catch( pseudoError ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4140 pseudoWorks = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4141 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4142
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4143 if ( matches ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4144 Sizzle.matchesSelector = function( node, expr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4145 // Make sure that attribute selectors are quoted
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4146 expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4147
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4148 if ( !Sizzle.isXML( node ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4149 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4150 if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4151 return matches.call( node, expr );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4152 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4153 } catch(e) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4154 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4155
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4156 return Sizzle(expr, null, null, [node]).length > 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4157 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4158 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4159 })();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4160
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4161 (function(){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4162 var div = document.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4163
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4164 div.innerHTML = "<div class='test e'></div><div class='test'></div>";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4165
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4166 // Opera can't find a second classname (in 9.6)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4167 // Also, make sure that getElementsByClassName actually exists
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4168 if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4169 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4170 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4171
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4172 // Safari caches class attributes, doesn't catch changes (in 3.2)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4173 div.lastChild.className = "e";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4174
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4175 if ( div.getElementsByClassName("e").length === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4176 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4177 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4178
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4179 Expr.order.splice(1, 0, "CLASS");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4180 Expr.find.CLASS = function( match, context, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4181 if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4182 return context.getElementsByClassName(match[1]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4183 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4184 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4185
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4186 // release memory in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4187 div = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4188 })();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4189
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4190 function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4191 for ( var i = 0, l = checkSet.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4192 var elem = checkSet[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4193
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4194 if ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4195 var match = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4196
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4197 elem = elem[dir];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4198
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4199 while ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4200 if ( elem.sizcache === doneName ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4201 match = checkSet[elem.sizset];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4202 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4203 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4204
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4205 if ( elem.nodeType === 1 && !isXML ){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4206 elem.sizcache = doneName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4207 elem.sizset = i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4208 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4209
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4210 if ( elem.nodeName.toLowerCase() === cur ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4211 match = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4212 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4213 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4214
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4215 elem = elem[dir];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4216 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4217
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4218 checkSet[i] = match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4219 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4220 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4221 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4222
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4223 function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4224 for ( var i = 0, l = checkSet.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4225 var elem = checkSet[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4226
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4227 if ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4228 var match = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4229
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4230 elem = elem[dir];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4231
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4232 while ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4233 if ( elem.sizcache === doneName ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4234 match = checkSet[elem.sizset];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4235 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4236 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4237
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4238 if ( elem.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4239 if ( !isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4240 elem.sizcache = doneName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4241 elem.sizset = i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4242 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4243
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4244 if ( typeof cur !== "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4245 if ( elem === cur ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4246 match = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4247 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4248 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4249
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4250 } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4251 match = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4252 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4253 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4254 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4255
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4256 elem = elem[dir];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4257 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4258
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4259 checkSet[i] = match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4260 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4261 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4262 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4263
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4264 if ( document.documentElement.contains ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4265 Sizzle.contains = function( a, b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4266 return a !== b && (a.contains ? a.contains(b) : true);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4267 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4268
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4269 } else if ( document.documentElement.compareDocumentPosition ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4270 Sizzle.contains = function( a, b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4271 return !!(a.compareDocumentPosition(b) & 16);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4272 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4273
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4274 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4275 Sizzle.contains = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4276 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4277 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4278 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4279
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4280 Sizzle.isXML = function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4281 // documentElement is verified for cases where it doesn't yet exist
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4282 // (such as loading iframes in IE - #4833)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4283 var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4284
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4285 return documentElement ? documentElement.nodeName !== "HTML" : false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4286 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4287
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4288 var posProcess = function( selector, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4289 var match,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4290 tmpSet = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4291 later = "",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4292 root = context.nodeType ? [context] : context;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4293
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4294 // Position selectors must be done after the filter
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4295 // And so must :not(positional) so we move all PSEUDOs to the end
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4296 while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4297 later += match[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4298 selector = selector.replace( Expr.match.PSEUDO, "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4299 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4300
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4301 selector = Expr.relative[selector] ? selector + "*" : selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4302
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4303 for ( var i = 0, l = root.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4304 Sizzle( selector, root[i], tmpSet );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4305 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4306
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4307 return Sizzle.filter( later, tmpSet );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4308 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4309
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4310 // EXPOSE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4311 jQuery.find = Sizzle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4312 jQuery.expr = Sizzle.selectors;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4313 jQuery.expr[":"] = jQuery.expr.filters;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4314 jQuery.unique = Sizzle.uniqueSort;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4315 jQuery.text = Sizzle.getText;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4316 jQuery.isXMLDoc = Sizzle.isXML;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4317 jQuery.contains = Sizzle.contains;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4318
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4319
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4320 })();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4321
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4322
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4323 var runtil = /Until$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4324 rparentsprev = /^(?:parents|prevUntil|prevAll)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4325 // Note: This RegExp should be improved, or likely pulled from Sizzle
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4326 rmultiselector = /,/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4327 isSimple = /^.[^:#\[\.,]*$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4328 slice = Array.prototype.slice,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4329 POS = jQuery.expr.match.POS;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4330
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4331 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4332 find: function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4333 var ret = this.pushStack( "", "find", selector ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4334 length = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4335
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4336 for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4337 length = ret.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4338 jQuery.find( selector, this[i], ret );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4339
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4340 if ( i > 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4341 // Make sure that the results are unique
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4342 for ( var n = length; n < ret.length; n++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4343 for ( var r = 0; r < length; r++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4344 if ( ret[r] === ret[n] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4345 ret.splice(n--, 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4346 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4347 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4348 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4349 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4350 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4351 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4352
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4353 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4354 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4355
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4356 has: function( target ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4357 var targets = jQuery( target );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4358 return this.filter(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4359 for ( var i = 0, l = targets.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4360 if ( jQuery.contains( this, targets[i] ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4361 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4362 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4363 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4364 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4365 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4366
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4367 not: function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4368 return this.pushStack( winnow(this, selector, false), "not", selector);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4369 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4370
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4371 filter: function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4372 return this.pushStack( winnow(this, selector, true), "filter", selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4373 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4374
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4375 is: function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4376 return !!selector && jQuery.filter( selector, this ).length > 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4377 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4378
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4379 closest: function( selectors, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4380 var ret = [], i, l, cur = this[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4381
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4382 if ( jQuery.isArray( selectors ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4383 var match, selector,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4384 matches = {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4385 level = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4386
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4387 if ( cur && selectors.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4388 for ( i = 0, l = selectors.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4389 selector = selectors[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4390
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4391 if ( !matches[selector] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4392 matches[selector] = jQuery.expr.match.POS.test( selector ) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4393 jQuery( selector, context || this.context ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4394 selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4395 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4396 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4397
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4398 while ( cur && cur.ownerDocument && cur !== context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4399 for ( selector in matches ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4400 match = matches[selector];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4401
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4402 if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4403 ret.push({ selector: selector, elem: cur, level: level });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4404 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4405 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4406
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4407 cur = cur.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4408 level++;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4409 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4410 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4411
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4412 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4413 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4414
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4415 var pos = POS.test( selectors ) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4416 jQuery( selectors, context || this.context ) : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4417
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4418 for ( i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4419 cur = this[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4420
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4421 while ( cur ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4422 if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4423 ret.push( cur );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4424 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4425
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4426 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4427 cur = cur.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4428 if ( !cur || !cur.ownerDocument || cur === context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4429 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4430 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4431 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4432 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4433 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4434
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4435 ret = ret.length > 1 ? jQuery.unique(ret) : ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4436
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4437 return this.pushStack( ret, "closest", selectors );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4438 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4439
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4440 // Determine the position of an element within
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4441 // the matched set of elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4442 index: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4443 if ( !elem || typeof elem === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4444 return jQuery.inArray( this[0],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4445 // If it receives a string, the selector is used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4446 // If it receives nothing, the siblings are used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4447 elem ? jQuery( elem ) : this.parent().children() );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4448 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4449 // Locate the position of the desired element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4450 return jQuery.inArray(
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4451 // If it receives a jQuery object, the first element is used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4452 elem.jquery ? elem[0] : elem, this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4453 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4454
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4455 add: function( selector, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4456 var set = typeof selector === "string" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4457 jQuery( selector, context || this.context ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4458 jQuery.makeArray( selector ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4459 all = jQuery.merge( this.get(), set );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4460
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4461 return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4462 all :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4463 jQuery.unique( all ) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4464 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4465
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4466 andSelf: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4467 return this.add( this.prevObject );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4468 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4469 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4470
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4471 // A painfully simple check to see if an element is disconnected
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4472 // from a document (should be improved, where feasible).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4473 function isDisconnected( node ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4474 return !node || !node.parentNode || node.parentNode.nodeType === 11;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4475 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4476
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4477 jQuery.each({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4478 parent: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4479 var parent = elem.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4480 return parent && parent.nodeType !== 11 ? parent : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4481 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4482 parents: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4483 return jQuery.dir( elem, "parentNode" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4484 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4485 parentsUntil: function( elem, i, until ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4486 return jQuery.dir( elem, "parentNode", until );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4487 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4488 next: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4489 return jQuery.nth( elem, 2, "nextSibling" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4490 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4491 prev: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4492 return jQuery.nth( elem, 2, "previousSibling" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4493 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4494 nextAll: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4495 return jQuery.dir( elem, "nextSibling" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4496 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4497 prevAll: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4498 return jQuery.dir( elem, "previousSibling" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4499 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4500 nextUntil: function( elem, i, until ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4501 return jQuery.dir( elem, "nextSibling", until );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4502 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4503 prevUntil: function( elem, i, until ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4504 return jQuery.dir( elem, "previousSibling", until );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4505 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4506 siblings: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4507 return jQuery.sibling( elem.parentNode.firstChild, elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4508 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4509 children: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4510 return jQuery.sibling( elem.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4511 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4512 contents: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4513 return jQuery.nodeName( elem, "iframe" ) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4514 elem.contentDocument || elem.contentWindow.document :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4515 jQuery.makeArray( elem.childNodes );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4516 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4517 }, function( name, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4518 jQuery.fn[ name ] = function( until, selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4519 var ret = jQuery.map( this, fn, until );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4520
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4521 if ( !runtil.test( name ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4522 selector = until;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4523 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4524
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4525 if ( selector && typeof selector === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4526 ret = jQuery.filter( selector, ret );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4527 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4528
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4529 ret = this.length > 1 ? jQuery.unique( ret ) : ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4530
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4531 if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4532 ret = ret.reverse();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4533 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4534
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4535 return this.pushStack( ret, name, slice.call(arguments).join(",") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4536 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4537 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4538
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4539 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4540 filter: function( expr, elems, not ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4541 if ( not ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4542 expr = ":not(" + expr + ")";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4543 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4544
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4545 return elems.length === 1 ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4546 jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4547 jQuery.find.matches(expr, elems);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4548 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4549
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4550 dir: function( elem, dir, until ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4551 var matched = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4552 cur = elem[ dir ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4553
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4554 while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4555 if ( cur.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4556 matched.push( cur );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4557 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4558 cur = cur[dir];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4559 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4560 return matched;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4561 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4562
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4563 nth: function( cur, result, dir, elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4564 result = result || 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4565 var num = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4566
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4567 for ( ; cur; cur = cur[dir] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4568 if ( cur.nodeType === 1 && ++num === result ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4569 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4570 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4571 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4572
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4573 return cur;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4574 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4575
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4576 sibling: function( n, elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4577 var r = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4578
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4579 for ( ; n; n = n.nextSibling ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4580 if ( n.nodeType === 1 && n !== elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4581 r.push( n );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4582 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4583 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4584
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4585 return r;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4586 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4587 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4588
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4589 // Implement the identical functionality for filter and not
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4590 function winnow( elements, qualifier, keep ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4591 if ( jQuery.isFunction( qualifier ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4592 return jQuery.grep(elements, function( elem, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4593 var retVal = !!qualifier.call( elem, i, elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4594 return retVal === keep;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4595 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4596
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4597 } else if ( qualifier.nodeType ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4598 return jQuery.grep(elements, function( elem, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4599 return (elem === qualifier) === keep;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4600 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4601
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4602 } else if ( typeof qualifier === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4603 var filtered = jQuery.grep(elements, function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4604 return elem.nodeType === 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4605 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4606
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4607 if ( isSimple.test( qualifier ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4608 return jQuery.filter(qualifier, filtered, !keep);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4609 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4610 qualifier = jQuery.filter( qualifier, filtered );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4611 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4612 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4613
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4614 return jQuery.grep(elements, function( elem, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4615 return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4616 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4617 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4618
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4619
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4620
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4621
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4622 var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4623 rleadingWhitespace = /^\s+/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4624 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4625 rtagName = /<([\w:]+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4626 rtbody = /<tbody/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4627 rhtml = /<|&#?\w+;/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4628 rnocache = /<(?:script|object|embed|option|style)/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4629 // checked="checked" or checked (html5)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4630 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4631 raction = /\=([^="'>\s]+\/)>/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4632 wrapMap = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4633 option: [ 1, "<select multiple='multiple'>", "</select>" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4634 legend: [ 1, "<fieldset>", "</fieldset>" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4635 thead: [ 1, "<table>", "</table>" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4636 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4637 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4638 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4639 area: [ 1, "<map>", "</map>" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4640 _default: [ 0, "", "" ]
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4641 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4642
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4643 wrapMap.optgroup = wrapMap.option;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4644 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4645 wrapMap.th = wrapMap.td;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4646
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4647 // IE can't serialize <link> and <script> tags normally
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4648 if ( !jQuery.support.htmlSerialize ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4649 wrapMap._default = [ 1, "div<div>", "</div>" ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4650 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4651
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4652 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4653 text: function( text ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4654 if ( jQuery.isFunction(text) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4655 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4656 var self = jQuery( this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4657
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4658 self.text( text.call(this, i, self.text()) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4659 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4660 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4661
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4662 if ( typeof text !== "object" && text !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4663 return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4664 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4665
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4666 return jQuery.text( this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4667 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4668
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4669 wrapAll: function( html ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4670 if ( jQuery.isFunction( html ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4671 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4672 jQuery(this).wrapAll( html.call(this, i) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4673 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4674 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4675
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4676 if ( this[0] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4677 // The elements to wrap the target around
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4678 var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4679
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4680 if ( this[0].parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4681 wrap.insertBefore( this[0] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4682 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4683
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4684 wrap.map(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4685 var elem = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4686
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4687 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4688 elem = elem.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4689 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4690
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4691 return elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4692 }).append(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4693 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4694
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4695 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4696 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4697
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4698 wrapInner: function( html ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4699 if ( jQuery.isFunction( html ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4700 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4701 jQuery(this).wrapInner( html.call(this, i) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4702 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4703 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4704
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4705 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4706 var self = jQuery( this ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4707 contents = self.contents();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4708
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4709 if ( contents.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4710 contents.wrapAll( html );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4711
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4712 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4713 self.append( html );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4714 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4715 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4716 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4717
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4718 wrap: function( html ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4719 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4720 jQuery( this ).wrapAll( html );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4721 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4722 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4723
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4724 unwrap: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4725 return this.parent().each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4726 if ( !jQuery.nodeName( this, "body" ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4727 jQuery( this ).replaceWith( this.childNodes );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4728 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4729 }).end();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4730 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4731
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4732 append: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4733 return this.domManip(arguments, true, function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4734 if ( this.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4735 this.appendChild( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4736 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4737 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4738 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4739
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4740 prepend: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4741 return this.domManip(arguments, true, function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4742 if ( this.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4743 this.insertBefore( elem, this.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4744 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4745 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4746 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4747
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4748 before: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4749 if ( this[0] && this[0].parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4750 return this.domManip(arguments, false, function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4751 this.parentNode.insertBefore( elem, this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4752 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4753 } else if ( arguments.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4754 var set = jQuery(arguments[0]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4755 set.push.apply( set, this.toArray() );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4756 return this.pushStack( set, "before", arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4757 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4758 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4759
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4760 after: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4761 if ( this[0] && this[0].parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4762 return this.domManip(arguments, false, function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4763 this.parentNode.insertBefore( elem, this.nextSibling );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4764 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4765 } else if ( arguments.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4766 var set = this.pushStack( this, "after", arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4767 set.push.apply( set, jQuery(arguments[0]).toArray() );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4768 return set;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4769 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4770 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4771
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4772 // keepData is for internal use only--do not document
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4773 remove: function( selector, keepData ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4774 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4775 if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4776 if ( !keepData && elem.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4777 jQuery.cleanData( elem.getElementsByTagName("*") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4778 jQuery.cleanData( [ elem ] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4779 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4780
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4781 if ( elem.parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4782 elem.parentNode.removeChild( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4783 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4784 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4785 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4786
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4787 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4788 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4789
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4790 empty: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4791 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4792 // Remove element nodes and prevent memory leaks
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4793 if ( elem.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4794 jQuery.cleanData( elem.getElementsByTagName("*") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4795 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4796
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4797 // Remove any remaining nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4798 while ( elem.firstChild ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4799 elem.removeChild( elem.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4800 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4801 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4802
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4803 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4804 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4805
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4806 clone: function( events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4807 // Do the clone
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4808 var ret = this.map(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4809 if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4810 // IE copies events bound via attachEvent when
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4811 // using cloneNode. Calling detachEvent on the
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4812 // clone will also remove the events from the orignal
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4813 // In order to get around this, we use innerHTML.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4814 // Unfortunately, this means some modifications to
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4815 // attributes in IE that are actually only stored
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4816 // as properties will not be copied (such as the
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4817 // the name attribute on an input).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4818 var html = this.outerHTML,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4819 ownerDocument = this.ownerDocument;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4820
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4821 if ( !html ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4822 var div = ownerDocument.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4823 div.appendChild( this.cloneNode(true) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4824 html = div.innerHTML;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4825 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4826
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4827 return jQuery.clean([html.replace(rinlinejQuery, "")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4828 // Handle the case in IE 8 where action=/test/> self-closes a tag
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4829 .replace(raction, '="$1">')
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4830 .replace(rleadingWhitespace, "")], ownerDocument)[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4831 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4832 return this.cloneNode(true);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4833 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4834 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4835
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4836 // Copy the events from the original to the clone
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4837 if ( events === true ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4838 cloneCopyEvent( this, ret );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4839 cloneCopyEvent( this.find("*"), ret.find("*") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4840 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4841
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4842 // Return the cloned set
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4843 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4844 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4845
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4846 html: function( value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4847 if ( value === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4848 return this[0] && this[0].nodeType === 1 ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4849 this[0].innerHTML.replace(rinlinejQuery, "") :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4850 null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4851
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4852 // See if we can take a shortcut and just use innerHTML
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4853 } else if ( typeof value === "string" && !rnocache.test( value ) &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4854 (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4855 !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4856
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4857 value = value.replace(rxhtmlTag, "<$1></$2>");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4858
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4859 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4860 for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4861 // Remove element nodes and prevent memory leaks
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4862 if ( this[i].nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4863 jQuery.cleanData( this[i].getElementsByTagName("*") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4864 this[i].innerHTML = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4865 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4866 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4867
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4868 // If using innerHTML throws an exception, use the fallback method
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4869 } catch(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4870 this.empty().append( value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4871 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4872
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4873 } else if ( jQuery.isFunction( value ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4874 this.each(function(i){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4875 var self = jQuery( this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4876
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4877 self.html( value.call(this, i, self.html()) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4878 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4879
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4880 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4881 this.empty().append( value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4882 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4883
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4884 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4885 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4886
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4887 replaceWith: function( value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4888 if ( this[0] && this[0].parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4889 // Make sure that the elements are removed from the DOM before they are inserted
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4890 // this can help fix replacing a parent with child elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4891 if ( jQuery.isFunction( value ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4892 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4893 var self = jQuery(this), old = self.html();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4894 self.replaceWith( value.call( this, i, old ) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4895 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4896 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4897
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4898 if ( typeof value !== "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4899 value = jQuery( value ).detach();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4900 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4901
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4902 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4903 var next = this.nextSibling,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4904 parent = this.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4905
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4906 jQuery( this ).remove();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4907
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4908 if ( next ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4909 jQuery(next).before( value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4910 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4911 jQuery(parent).append( value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4912 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4913 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4914 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4915 return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4916 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4917 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4918
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4919 detach: function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4920 return this.remove( selector, true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4921 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4922
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4923 domManip: function( args, table, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4924 var results, first, fragment, parent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4925 value = args[0],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4926 scripts = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4927
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4928 // We can't cloneNode fragments that contain checked, in WebKit
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4929 if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4930 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4931 jQuery(this).domManip( args, table, callback, true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4932 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4933 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4934
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4935 if ( jQuery.isFunction(value) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4936 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4937 var self = jQuery(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4938 args[0] = value.call(this, i, table ? self.html() : undefined);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4939 self.domManip( args, table, callback );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4940 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4941 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4942
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4943 if ( this[0] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4944 parent = value && value.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4945
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4946 // If we're in a fragment, just use that instead of building a new one
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4947 if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4948 results = { fragment: parent };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4949
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4950 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4951 results = jQuery.buildFragment( args, this, scripts );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4952 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4953
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4954 fragment = results.fragment;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4955
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4956 if ( fragment.childNodes.length === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4957 first = fragment = fragment.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4958 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4959 first = fragment.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4960 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4961
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4962 if ( first ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4963 table = table && jQuery.nodeName( first, "tr" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4964
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4965 for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4966 callback.call(
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4967 table ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4968 root(this[i], first) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4969 this[i],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4970 i > 0 || results.cacheable || this.length > 1 ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4971 fragment.cloneNode(true) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4972 fragment
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4973 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4974 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4975 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4976
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4977 if ( scripts.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4978 jQuery.each( scripts, evalScript );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4979 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4980 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4981
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4982 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4983 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4984 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4985
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4986 function root( elem, cur ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4987 return jQuery.nodeName(elem, "table") ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4988 (elem.getElementsByTagName("tbody")[0] ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4989 elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4990 elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4991 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4992
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4993 function cloneCopyEvent(orig, ret) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4994 var i = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4995
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4996 ret.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4997 if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4998 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4999 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5000
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5001 var oldData = jQuery.data( orig[i++] ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5002 curData = jQuery.data( this, oldData ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5003 events = oldData && oldData.events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5004
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5005 if ( events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5006 delete curData.handle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5007 curData.events = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5008
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5009 for ( var type in events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5010 for ( var handler in events[ type ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5011 jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5012 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5013 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5014 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5015 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5016 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5017
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5018 jQuery.buildFragment = function( args, nodes, scripts ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5019 var fragment, cacheable, cacheresults,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5020 doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5021
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5022 // Only cache "small" (1/2 KB) strings that are associated with the main document
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5023 // Cloning options loses the selected state, so don't cache them
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5024 // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5025 // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5026 if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5027 !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5028
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5029 cacheable = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5030 cacheresults = jQuery.fragments[ args[0] ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5031 if ( cacheresults ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5032 if ( cacheresults !== 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5033 fragment = cacheresults;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5034 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5035 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5036 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5037
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5038 if ( !fragment ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5039 fragment = doc.createDocumentFragment();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5040 jQuery.clean( args, doc, fragment, scripts );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5041 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5042
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5043 if ( cacheable ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5044 jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5045 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5046
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5047 return { fragment: fragment, cacheable: cacheable };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5048 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5049
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5050 jQuery.fragments = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5051
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5052 jQuery.each({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5053 appendTo: "append",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5054 prependTo: "prepend",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5055 insertBefore: "before",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5056 insertAfter: "after",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5057 replaceAll: "replaceWith"
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5058 }, function( name, original ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5059 jQuery.fn[ name ] = function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5060 var ret = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5061 insert = jQuery( selector ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5062 parent = this.length === 1 && this[0].parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5063
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5064 if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5065 insert[ original ]( this[0] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5066 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5067
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5068 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5069 for ( var i = 0, l = insert.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5070 var elems = (i > 0 ? this.clone(true) : this).get();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5071 jQuery( insert[i] )[ original ]( elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5072 ret = ret.concat( elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5073 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5074
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5075 return this.pushStack( ret, name, insert.selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5076 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5077 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5078 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5079
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5080 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5081 clean: function( elems, context, fragment, scripts ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5082 context = context || document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5083
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5084 // !context.createElement fails in IE with an error but returns typeof 'object'
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5085 if ( typeof context.createElement === "undefined" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5086 context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5087 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5088
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5089 var ret = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5090
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5091 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5092 if ( typeof elem === "number" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5093 elem += "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5094 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5095
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5096 if ( !elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5097 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5098 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5099
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5100 // Convert html string into DOM nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5101 if ( typeof elem === "string" && !rhtml.test( elem ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5102 elem = context.createTextNode( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5103
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5104 } else if ( typeof elem === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5105 // Fix "XHTML"-style tags in all browsers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5106 elem = elem.replace(rxhtmlTag, "<$1></$2>");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5107
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5108 // Trim whitespace, otherwise indexOf won't work as expected
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5109 var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5110 wrap = wrapMap[ tag ] || wrapMap._default,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5111 depth = wrap[0],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5112 div = context.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5113
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5114 // Go to html and back, then peel off extra wrappers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5115 div.innerHTML = wrap[1] + elem + wrap[2];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5116
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5117 // Move to the right depth
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5118 while ( depth-- ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5119 div = div.lastChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5120 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5121
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5122 // Remove IE's autoinserted <tbody> from table fragments
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5123 if ( !jQuery.support.tbody ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5124
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5125 // String was a <table>, *may* have spurious <tbody>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5126 var hasBody = rtbody.test(elem),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5127 tbody = tag === "table" && !hasBody ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5128 div.firstChild && div.firstChild.childNodes :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5129
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5130 // String was a bare <thead> or <tfoot>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5131 wrap[1] === "<table>" && !hasBody ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5132 div.childNodes :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5133 [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5134
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5135 for ( var j = tbody.length - 1; j >= 0 ; --j ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5136 if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5137 tbody[ j ].parentNode.removeChild( tbody[ j ] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5138 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5139 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5140
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5141 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5142
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5143 // IE completely kills leading whitespace when innerHTML is used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5144 if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5145 div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5146 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5147
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5148 elem = div.childNodes;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5149 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5150
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5151 if ( elem.nodeType ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5152 ret.push( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5153 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5154 ret = jQuery.merge( ret, elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5155 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5156 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5157
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5158 if ( fragment ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5159 for ( i = 0; ret[i]; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5160 if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5161 scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5162
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5163 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5164 if ( ret[i].nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5165 ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5166 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5167 fragment.appendChild( ret[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5168 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5169 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5170 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5171
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5172 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5173 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5174
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5175 cleanData: function( elems ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5176 var data, id, cache = jQuery.cache,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5177 special = jQuery.event.special,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5178 deleteExpando = jQuery.support.deleteExpando;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5179
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5180 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5181 if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5182 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5183 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5184
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5185 id = elem[ jQuery.expando ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5186
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5187 if ( id ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5188 data = cache[ id ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5189
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5190 if ( data && data.events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5191 for ( var type in data.events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5192 if ( special[ type ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5193 jQuery.event.remove( elem, type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5194
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5195 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5196 jQuery.removeEvent( elem, type, data.handle );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5197 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5198 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5199 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5200
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5201 if ( deleteExpando ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5202 delete elem[ jQuery.expando ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5203
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5204 } else if ( elem.removeAttribute ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5205 elem.removeAttribute( jQuery.expando );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5206 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5207
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5208 delete cache[ id ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5209 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5210 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5211 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5212 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5213
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5214 function evalScript( i, elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5215 if ( elem.src ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5216 jQuery.ajax({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5217 url: elem.src,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5218 async: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5219 dataType: "script"
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5220 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5221 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5222 jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5223 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5224
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5225 if ( elem.parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5226 elem.parentNode.removeChild( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5227 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5228 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5229
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5230
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5231
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5232
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5233 var ralpha = /alpha\([^)]*\)/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5234 ropacity = /opacity=([^)]*)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5235 rdashAlpha = /-([a-z])/ig,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5236 rupper = /([A-Z])/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5237 rnumpx = /^-?\d+(?:px)?$/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5238 rnum = /^-?\d/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5239
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5240 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5241 cssWidth = [ "Left", "Right" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5242 cssHeight = [ "Top", "Bottom" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5243 curCSS,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5244
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5245 getComputedStyle,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5246 currentStyle,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5247
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5248 fcamelCase = function( all, letter ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5249 return letter.toUpperCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5250 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5251
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5252 jQuery.fn.css = function( name, value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5253 // Setting 'undefined' is a no-op
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5254 if ( arguments.length === 2 && value === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5255 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5256 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5257
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5258 return jQuery.access( this, name, value, true, function( elem, name, value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5259 return value !== undefined ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5260 jQuery.style( elem, name, value ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5261 jQuery.css( elem, name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5262 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5263 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5264
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5265 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5266 // Add in style property hooks for overriding the default
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5267 // behavior of getting and setting a style property
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5268 cssHooks: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5269 opacity: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5270 get: function( elem, computed ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5271 if ( computed ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5272 // We should always get a number back from opacity
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5273 var ret = curCSS( elem, "opacity", "opacity" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5274 return ret === "" ? "1" : ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5275
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5276 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5277 return elem.style.opacity;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5278 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5279 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5280 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5281 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5282
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5283 // Exclude the following css properties to add px
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5284 cssNumber: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5285 "zIndex": true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5286 "fontWeight": true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5287 "opacity": true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5288 "zoom": true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5289 "lineHeight": true
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5290 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5291
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5292 // Add in properties whose names you wish to fix before
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5293 // setting or getting the value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5294 cssProps: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5295 // normalize float css property
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5296 "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5297 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5298
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5299 // Get and set the style property on a DOM Node
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5300 style: function( elem, name, value, extra ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5301 // Don't set styles on text and comment nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5302 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5303 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5304 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5305
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5306 // Make sure that we're working with the right name
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5307 var ret, origName = jQuery.camelCase( name ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5308 style = elem.style, hooks = jQuery.cssHooks[ origName ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5309
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5310 name = jQuery.cssProps[ origName ] || origName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5311
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5312 // Check if we're setting a value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5313 if ( value !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5314 // Make sure that NaN and null values aren't set. See: #7116
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5315 if ( typeof value === "number" && isNaN( value ) || value == null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5316 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5317 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5318
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5319 // If a number was passed in, add 'px' to the (except for certain CSS properties)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5320 if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5321 value += "px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5322 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5323
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5324 // If a hook was provided, use that value, otherwise just set the specified value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5325 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5326 // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5327 // Fixes bug #5509
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5328 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5329 style[ name ] = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5330 } catch(e) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5331 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5332
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5333 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5334 // If a hook was provided get the non-computed value from there
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5335 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5336 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5337 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5338
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5339 // Otherwise just get the value from the style object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5340 return style[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5341 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5342 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5343
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5344 css: function( elem, name, extra ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5345 // Make sure that we're working with the right name
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5346 var ret, origName = jQuery.camelCase( name ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5347 hooks = jQuery.cssHooks[ origName ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5348
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5349 name = jQuery.cssProps[ origName ] || origName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5350
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5351 // If a hook was provided get the computed value from there
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5352 if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5353 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5354
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5355 // Otherwise, if a way to get the computed value exists, use that
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5356 } else if ( curCSS ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5357 return curCSS( elem, name, origName );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5358 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5359 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5360
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5361 // A method for quickly swapping in/out CSS properties to get correct calculations
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5362 swap: function( elem, options, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5363 var old = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5364
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5365 // Remember the old values, and insert the new ones
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5366 for ( var name in options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5367 old[ name ] = elem.style[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5368 elem.style[ name ] = options[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5369 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5370
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5371 callback.call( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5372
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5373 // Revert the old values
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5374 for ( name in options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5375 elem.style[ name ] = old[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5376 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5377 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5378
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5379 camelCase: function( string ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5380 return string.replace( rdashAlpha, fcamelCase );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5381 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5382 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5383
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5384 // DEPRECATED, Use jQuery.css() instead
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5385 jQuery.curCSS = jQuery.css;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5386
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5387 jQuery.each(["height", "width"], function( i, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5388 jQuery.cssHooks[ name ] = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5389 get: function( elem, computed, extra ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5390 var val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5391
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5392 if ( computed ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5393 if ( elem.offsetWidth !== 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5394 val = getWH( elem, name, extra );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5395
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5396 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5397 jQuery.swap( elem, cssShow, function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5398 val = getWH( elem, name, extra );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5399 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5400 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5401
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5402 if ( val <= 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5403 val = curCSS( elem, name, name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5404
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5405 if ( val === "0px" && currentStyle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5406 val = currentStyle( elem, name, name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5407 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5408
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5409 if ( val != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5410 // Should return "auto" instead of 0, use 0 for
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5411 // temporary backwards-compat
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5412 return val === "" || val === "auto" ? "0px" : val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5413 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5414 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5415
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5416 if ( val < 0 || val == null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5417 val = elem.style[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5418
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5419 // Should return "auto" instead of 0, use 0 for
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5420 // temporary backwards-compat
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5421 return val === "" || val === "auto" ? "0px" : val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5422 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5423
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5424 return typeof val === "string" ? val : val + "px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5425 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5426 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5427
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5428 set: function( elem, value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5429 if ( rnumpx.test( value ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5430 // ignore negative width and height values #1599
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5431 value = parseFloat(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5432
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5433 if ( value >= 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5434 return value + "px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5435 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5436
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5437 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5438 return value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5439 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5440 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5441 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5442 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5443
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5444 if ( !jQuery.support.opacity ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5445 jQuery.cssHooks.opacity = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5446 get: function( elem, computed ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5447 // IE uses filters for opacity
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5448 return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5449 (parseFloat(RegExp.$1) / 100) + "" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5450 computed ? "1" : "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5451 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5452
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5453 set: function( elem, value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5454 var style = elem.style;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5455
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5456 // IE has trouble with opacity if it does not have layout
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5457 // Force it by setting the zoom level
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5458 style.zoom = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5459
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5460 // Set the alpha filter to set the opacity
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5461 var opacity = jQuery.isNaN(value) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5462 "" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5463 "alpha(opacity=" + value * 100 + ")",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5464 filter = style.filter || "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5465
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5466 style.filter = ralpha.test(filter) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5467 filter.replace(ralpha, opacity) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5468 style.filter + ' ' + opacity;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5469 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5470 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5471 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5472
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5473 if ( document.defaultView && document.defaultView.getComputedStyle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5474 getComputedStyle = function( elem, newName, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5475 var ret, defaultView, computedStyle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5476
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5477 name = name.replace( rupper, "-$1" ).toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5478
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5479 if ( !(defaultView = elem.ownerDocument.defaultView) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5480 return undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5481 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5482
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5483 if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5484 ret = computedStyle.getPropertyValue( name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5485 if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5486 ret = jQuery.style( elem, name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5487 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5488 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5489
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5490 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5491 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5492 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5493
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5494 if ( document.documentElement.currentStyle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5495 currentStyle = function( elem, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5496 var left, rsLeft,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5497 ret = elem.currentStyle && elem.currentStyle[ name ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5498 style = elem.style;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5499
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5500 // From the awesome hack by Dean Edwards
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5501 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5502
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5503 // If we're not dealing with a regular pixel number
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5504 // but a number that has a weird ending, we need to convert it to pixels
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5505 if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5506 // Remember the original values
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5507 left = style.left;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5508 rsLeft = elem.runtimeStyle.left;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5509
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5510 // Put in the new values to get a computed value out
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5511 elem.runtimeStyle.left = elem.currentStyle.left;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5512 style.left = name === "fontSize" ? "1em" : (ret || 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5513 ret = style.pixelLeft + "px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5514
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5515 // Revert the changed values
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5516 style.left = left;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5517 elem.runtimeStyle.left = rsLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5518 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5519
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5520 return ret === "" ? "auto" : ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5521 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5522 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5523
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5524 curCSS = getComputedStyle || currentStyle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5525
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5526 function getWH( elem, name, extra ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5527 var which = name === "width" ? cssWidth : cssHeight,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5528 val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5529
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5530 if ( extra === "border" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5531 return val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5532 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5533
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5534 jQuery.each( which, function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5535 if ( !extra ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5536 val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5537 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5538
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5539 if ( extra === "margin" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5540 val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5541
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5542 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5543 val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5544 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5545 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5546
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5547 return val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5548 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5549
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5550 if ( jQuery.expr && jQuery.expr.filters ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5551 jQuery.expr.filters.hidden = function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5552 var width = elem.offsetWidth,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5553 height = elem.offsetHeight;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5554
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5555 return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5556 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5557
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5558 jQuery.expr.filters.visible = function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5559 return !jQuery.expr.filters.hidden( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5560 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5561 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5562
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5563
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5564
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5565
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5566 var jsc = jQuery.now(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5567 rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5568 rselectTextarea = /^(?:select|textarea)/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5569 rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5570 rnoContent = /^(?:GET|HEAD)$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5571 rbracket = /\[\]$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5572 jsre = /\=\?(&|$)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5573 rquery = /\?/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5574 rts = /([?&])_=[^&]*/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5575 rurl = /^(\w+:)?\/\/([^\/?#]+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5576 r20 = /%20/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5577 rhash = /#.*$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5578
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5579 // Keep a copy of the old load method
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5580 _load = jQuery.fn.load;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5581
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5582 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5583 load: function( url, params, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5584 if ( typeof url !== "string" && _load ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5585 return _load.apply( this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5586
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5587 // Don't do a request if no elements are being requested
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5588 } else if ( !this.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5589 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5590 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5591
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5592 var off = url.indexOf(" ");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5593 if ( off >= 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5594 var selector = url.slice(off, url.length);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5595 url = url.slice(0, off);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5596 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5597
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5598 // Default to a GET request
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5599 var type = "GET";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5600
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5601 // If the second parameter was provided
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5602 if ( params ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5603 // If it's a function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5604 if ( jQuery.isFunction( params ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5605 // We assume that it's the callback
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5606 callback = params;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5607 params = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5608
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5609 // Otherwise, build a param string
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5610 } else if ( typeof params === "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5611 params = jQuery.param( params, jQuery.ajaxSettings.traditional );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5612 type = "POST";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5613 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5614 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5615
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5616 var self = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5617
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5618 // Request the remote document
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5619 jQuery.ajax({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5620 url: url,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5621 type: type,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5622 dataType: "html",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5623 data: params,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5624 complete: function( res, status ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5625 // If successful, inject the HTML into all the matched elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5626 if ( status === "success" || status === "notmodified" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5627 // See if a selector was specified
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5628 self.html( selector ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5629 // Create a dummy div to hold the results
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5630 jQuery("<div>")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5631 // inject the contents of the document in, removing the scripts
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5632 // to avoid any 'Permission Denied' errors in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5633 .append(res.responseText.replace(rscript, ""))
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5634
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5635 // Locate the specified elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5636 .find(selector) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5637
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5638 // If not, just inject the full result
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5639 res.responseText );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5640 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5641
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5642 if ( callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5643 self.each( callback, [res.responseText, status, res] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5644 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5645 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5646 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5647
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5648 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5649 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5650
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5651 serialize: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5652 return jQuery.param(this.serializeArray());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5653 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5654
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5655 serializeArray: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5656 return this.map(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5657 return this.elements ? jQuery.makeArray(this.elements) : this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5658 })
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5659 .filter(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5660 return this.name && !this.disabled &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5661 (this.checked || rselectTextarea.test(this.nodeName) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5662 rinput.test(this.type));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5663 })
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5664 .map(function( i, elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5665 var val = jQuery(this).val();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5666
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5667 return val == null ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5668 null :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5669 jQuery.isArray(val) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5670 jQuery.map( val, function( val, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5671 return { name: elem.name, value: val };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5672 }) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5673 { name: elem.name, value: val };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5674 }).get();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5675 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5676 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5677
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5678 // Attach a bunch of functions for handling common AJAX events
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5679 jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5680 jQuery.fn[o] = function( f ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5681 return this.bind(o, f);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5682 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5683 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5684
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5685 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5686 get: function( url, data, callback, type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5687 // shift arguments if data argument was omited
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5688 if ( jQuery.isFunction( data ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5689 type = type || callback;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5690 callback = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5691 data = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5692 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5693
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5694 return jQuery.ajax({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5695 type: "GET",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5696 url: url,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5697 data: data,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5698 success: callback,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5699 dataType: type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5700 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5701 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5702
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5703 getScript: function( url, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5704 return jQuery.get(url, null, callback, "script");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5705 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5706
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5707 getJSON: function( url, data, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5708 return jQuery.get(url, data, callback, "json");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5709 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5710
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5711 post: function( url, data, callback, type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5712 // shift arguments if data argument was omited
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5713 if ( jQuery.isFunction( data ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5714 type = type || callback;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5715 callback = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5716 data = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5717 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5718
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5719 return jQuery.ajax({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5720 type: "POST",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5721 url: url,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5722 data: data,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5723 success: callback,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5724 dataType: type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5725 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5726 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5727
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5728 ajaxSetup: function( settings ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5729 jQuery.extend( jQuery.ajaxSettings, settings );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5730 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5731
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5732 ajaxSettings: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5733 url: location.href,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5734 global: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5735 type: "GET",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5736 contentType: "application/x-www-form-urlencoded",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5737 processData: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5738 async: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5739 /*
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5740 timeout: 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5741 data: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5742 username: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5743 password: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5744 traditional: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5745 */
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5746 // This function can be overriden by calling jQuery.ajaxSetup
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5747 xhr: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5748 return new window.XMLHttpRequest();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5749 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5750 accepts: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5751 xml: "application/xml, text/xml",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5752 html: "text/html",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5753 script: "text/javascript, application/javascript",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5754 json: "application/json, text/javascript",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5755 text: "text/plain",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5756 _default: "*/*"
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5757 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5758 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5759
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5760 ajax: function( origSettings ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5761 var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5762 jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5763
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5764 s.url = s.url.replace( rhash, "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5765
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5766 // Use original (not extended) context object if it was provided
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5767 s.context = origSettings && origSettings.context != null ? origSettings.context : s;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5768
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5769 // convert data if not already a string
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5770 if ( s.data && s.processData && typeof s.data !== "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5771 s.data = jQuery.param( s.data, s.traditional );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5772 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5773
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5774 // Handle JSONP Parameter Callbacks
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5775 if ( s.dataType === "jsonp" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5776 if ( type === "GET" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5777 if ( !jsre.test( s.url ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5778 s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5779 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5780 } else if ( !s.data || !jsre.test(s.data) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5781 s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5782 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5783 s.dataType = "json";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5784 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5785
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5786 // Build temporary JSONP function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5787 if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5788 jsonp = s.jsonpCallback || ("jsonp" + jsc++);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5789
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5790 // Replace the =? sequence both in the query string and the data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5791 if ( s.data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5792 s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5793 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5794
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5795 s.url = s.url.replace(jsre, "=" + jsonp + "$1");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5796
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5797 // We need to make sure
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5798 // that a JSONP style response is executed properly
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5799 s.dataType = "script";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5800
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5801 // Handle JSONP-style loading
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5802 var customJsonp = window[ jsonp ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5803
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5804 window[ jsonp ] = function( tmp ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5805 if ( jQuery.isFunction( customJsonp ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5806 customJsonp( tmp );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5807
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5808 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5809 // Garbage collect
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5810 window[ jsonp ] = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5811
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5812 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5813 delete window[ jsonp ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5814 } catch( jsonpError ) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5815 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5816
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5817 data = tmp;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5818 jQuery.handleSuccess( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5819 jQuery.handleComplete( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5820
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5821 if ( head ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5822 head.removeChild( script );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5823 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5824 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5825 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5826
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5827 if ( s.dataType === "script" && s.cache === null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5828 s.cache = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5829 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5830
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5831 if ( s.cache === false && noContent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5832 var ts = jQuery.now();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5833
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5834 // try replacing _= if it is there
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5835 var ret = s.url.replace(rts, "$1_=" + ts);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5836
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5837 // if nothing was replaced, add timestamp to the end
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5838 s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5839 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5840
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5841 // If data is available, append data to url for GET/HEAD requests
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5842 if ( s.data && noContent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5843 s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5844 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5845
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5846 // Watch for a new set of requests
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5847 if ( s.global && jQuery.active++ === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5848 jQuery.event.trigger( "ajaxStart" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5849 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5850
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5851 // Matches an absolute URL, and saves the domain
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5852 var parts = rurl.exec( s.url ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5853 remote = parts && (parts[1] && parts[1].toLowerCase() !== location.protocol || parts[2].toLowerCase() !== location.host);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5854
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5855 // If we're requesting a remote document
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5856 // and trying to load JSON or Script with a GET
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5857 if ( s.dataType === "script" && type === "GET" && remote ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5858 var head = document.getElementsByTagName("head")[0] || document.documentElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5859 var script = document.createElement("script");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5860 if ( s.scriptCharset ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5861 script.charset = s.scriptCharset;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5862 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5863 script.src = s.url;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5864
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5865 // Handle Script loading
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5866 if ( !jsonp ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5867 var done = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5868
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5869 // Attach handlers for all browsers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5870 script.onload = script.onreadystatechange = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5871 if ( !done && (!this.readyState ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5872 this.readyState === "loaded" || this.readyState === "complete") ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5873 done = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5874 jQuery.handleSuccess( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5875 jQuery.handleComplete( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5876
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5877 // Handle memory leak in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5878 script.onload = script.onreadystatechange = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5879 if ( head && script.parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5880 head.removeChild( script );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5881 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5882 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5883 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5884 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5885
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5886 // Use insertBefore instead of appendChild to circumvent an IE6 bug.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5887 // This arises when a base node is used (#2709 and #4378).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5888 head.insertBefore( script, head.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5889
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5890 // We handle everything using the script element injection
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5891 return undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5892 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5893
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5894 var requestDone = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5895
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5896 // Create the request object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5897 var xhr = s.xhr();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5898
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5899 if ( !xhr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5900 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5901 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5902
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5903 // Open the socket
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5904 // Passing null username, generates a login popup on Opera (#2865)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5905 if ( s.username ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5906 xhr.open(type, s.url, s.async, s.username, s.password);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5907 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5908 xhr.open(type, s.url, s.async);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5909 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5910
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5911 // Need an extra try/catch for cross domain requests in Firefox 3
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5912 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5913 // Set content-type if data specified and content-body is valid for this type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5914 if ( (s.data != null && !noContent) || (origSettings && origSettings.contentType) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5915 xhr.setRequestHeader("Content-Type", s.contentType);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5916 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5917
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5918 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5919 if ( s.ifModified ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5920 if ( jQuery.lastModified[s.url] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5921 xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5922 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5923
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5924 if ( jQuery.etag[s.url] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5925 xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5926 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5927 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5928
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5929 // Set header so the called script knows that it's an XMLHttpRequest
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5930 // Only send the header if it's not a remote XHR
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5931 if ( !remote ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5932 xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5933 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5934
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5935 // Set the Accepts header for the server, depending on the dataType
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5936 xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5937 s.accepts[ s.dataType ] + ", */*; q=0.01" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5938 s.accepts._default );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5939 } catch( headerError ) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5940
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5941 // Allow custom headers/mimetypes and early abort
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5942 if ( s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5943 // Handle the global AJAX counter
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5944 if ( s.global && jQuery.active-- === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5945 jQuery.event.trigger( "ajaxStop" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5946 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5947
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5948 // close opended socket
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5949 xhr.abort();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5950 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5951 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5952
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5953 if ( s.global ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5954 jQuery.triggerGlobal( s, "ajaxSend", [xhr, s] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5955 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5956
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5957 // Wait for a response to come back
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5958 var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5959 // The request was aborted
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5960 if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5961 // Opera doesn't call onreadystatechange before this point
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5962 // so we simulate the call
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5963 if ( !requestDone ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5964 jQuery.handleComplete( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5965 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5966
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5967 requestDone = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5968 if ( xhr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5969 xhr.onreadystatechange = jQuery.noop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5970 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5971
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5972 // The transfer is complete and the data is available, or the request timed out
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5973 } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5974 requestDone = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5975 xhr.onreadystatechange = jQuery.noop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5976
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5977 status = isTimeout === "timeout" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5978 "timeout" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5979 !jQuery.httpSuccess( xhr ) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5980 "error" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5981 s.ifModified && jQuery.httpNotModified( xhr, s.url ) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5982 "notmodified" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5983 "success";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5984
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5985 var errMsg;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5986
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5987 if ( status === "success" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5988 // Watch for, and catch, XML document parse errors
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5989 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5990 // process the data (runs the xml through httpData regardless of callback)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5991 data = jQuery.httpData( xhr, s.dataType, s );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5992 } catch( parserError ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5993 status = "parsererror";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5994 errMsg = parserError;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5995 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5996 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5997
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5998 // Make sure that the request was successful or notmodified
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5999 if ( status === "success" || status === "notmodified" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6000 // JSONP handles its own success callback
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6001 if ( !jsonp ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6002 jQuery.handleSuccess( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6003 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6004 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6005 jQuery.handleError( s, xhr, status, errMsg );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6006 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6007
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6008 // Fire the complete handlers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6009 if ( !jsonp ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6010 jQuery.handleComplete( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6011 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6012
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6013 if ( isTimeout === "timeout" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6014 xhr.abort();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6015 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6016
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6017 // Stop memory leaks
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6018 if ( s.async ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6019 xhr = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6020 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6021 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6022 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6023
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6024 // Override the abort handler, if we can (IE 6 doesn't allow it, but that's OK)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6025 // Opera doesn't fire onreadystatechange at all on abort
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6026 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6027 var oldAbort = xhr.abort;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6028 xhr.abort = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6029 if ( xhr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6030 // oldAbort has no call property in IE7 so
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6031 // just do it this way, which works in all
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6032 // browsers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6033 Function.prototype.call.call( oldAbort, xhr );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6034 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6035
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6036 onreadystatechange( "abort" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6037 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6038 } catch( abortError ) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6039
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6040 // Timeout checker
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6041 if ( s.async && s.timeout > 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6042 setTimeout(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6043 // Check to see if the request is still happening
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6044 if ( xhr && !requestDone ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6045 onreadystatechange( "timeout" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6046 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6047 }, s.timeout);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6048 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6049
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6050 // Send the data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6051 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6052 xhr.send( noContent || s.data == null ? null : s.data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6053
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6054 } catch( sendError ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6055 jQuery.handleError( s, xhr, null, sendError );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6056
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6057 // Fire the complete handlers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6058 jQuery.handleComplete( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6059 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6060
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6061 // firefox 1.5 doesn't fire statechange for sync requests
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6062 if ( !s.async ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6063 onreadystatechange();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6064 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6065
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6066 // return XMLHttpRequest to allow aborting the request etc.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6067 return xhr;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6068 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6069
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6070 // Serialize an array of form elements or a set of
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6071 // key/values into a query string
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6072 param: function( a, traditional ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6073 var s = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6074 add = function( key, value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6075 // If value is a function, invoke it and return its value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6076 value = jQuery.isFunction(value) ? value() : value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6077 s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6078 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6079
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6080 // Set traditional to true for jQuery <= 1.3.2 behavior.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6081 if ( traditional === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6082 traditional = jQuery.ajaxSettings.traditional;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6083 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6084
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6085 // If an array was passed in, assume that it is an array of form elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6086 if ( jQuery.isArray(a) || a.jquery ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6087 // Serialize the form elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6088 jQuery.each( a, function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6089 add( this.name, this.value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6090 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6091
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6092 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6093 // If traditional, encode the "old" way (the way 1.3.2 or older
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6094 // did it), otherwise encode params recursively.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6095 for ( var prefix in a ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6096 buildParams( prefix, a[prefix], traditional, add );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6097 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6098 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6099
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6100 // Return the resulting serialization
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6101 return s.join("&").replace(r20, "+");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6102 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6103 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6104
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6105 function buildParams( prefix, obj, traditional, add ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6106 if ( jQuery.isArray(obj) && obj.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6107 // Serialize array item.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6108 jQuery.each( obj, function( i, v ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6109 if ( traditional || rbracket.test( prefix ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6110 // Treat each array item as a scalar.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6111 add( prefix, v );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6112
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6113 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6114 // If array item is non-scalar (array or object), encode its
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6115 // numeric index to resolve deserialization ambiguity issues.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6116 // Note that rack (as of 1.0.0) can't currently deserialize
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6117 // nested arrays properly, and attempting to do so may cause
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6118 // a server error. Possible fixes are to modify rack's
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6119 // deserialization algorithm or to provide an option or flag
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6120 // to force array serialization to be shallow.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6121 buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6122 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6123 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6124
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6125 } else if ( !traditional && obj != null && typeof obj === "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6126 if ( jQuery.isEmptyObject( obj ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6127 add( prefix, "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6128
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6129 // Serialize object item.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6130 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6131 jQuery.each( obj, function( k, v ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6132 buildParams( prefix + "[" + k + "]", v, traditional, add );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6133 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6134 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6135
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6136 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6137 // Serialize scalar item.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6138 add( prefix, obj );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6139 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6140 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6141
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6142 // This is still on the jQuery object... for now
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6143 // Want to move this to jQuery.ajax some day
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6144 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6145
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6146 // Counter for holding the number of active queries
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6147 active: 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6148
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6149 // Last-Modified header cache for next request
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6150 lastModified: {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6151 etag: {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6152
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6153 handleError: function( s, xhr, status, e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6154 // If a local callback was specified, fire it
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6155 if ( s.error ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6156 s.error.call( s.context, xhr, status, e );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6157 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6158
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6159 // Fire the global callback
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6160 if ( s.global ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6161 jQuery.triggerGlobal( s, "ajaxError", [xhr, s, e] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6162 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6163 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6164
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6165 handleSuccess: function( s, xhr, status, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6166 // If a local callback was specified, fire it and pass it the data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6167 if ( s.success ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6168 s.success.call( s.context, data, status, xhr );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6169 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6170
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6171 // Fire the global callback
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6172 if ( s.global ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6173 jQuery.triggerGlobal( s, "ajaxSuccess", [xhr, s] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6174 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6175 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6176
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6177 handleComplete: function( s, xhr, status ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6178 // Process result
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6179 if ( s.complete ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6180 s.complete.call( s.context, xhr, status );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6181 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6182
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6183 // The request was completed
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6184 if ( s.global ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6185 jQuery.triggerGlobal( s, "ajaxComplete", [xhr, s] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6186 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6187
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6188 // Handle the global AJAX counter
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6189 if ( s.global && jQuery.active-- === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6190 jQuery.event.trigger( "ajaxStop" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6191 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6192 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6193
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6194 triggerGlobal: function( s, type, args ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6195 (s.context && s.context.url == null ? jQuery(s.context) : jQuery.event).trigger(type, args);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6196 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6197
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6198 // Determines if an XMLHttpRequest was successful or not
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6199 httpSuccess: function( xhr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6200 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6201 // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6202 return !xhr.status && location.protocol === "file:" ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6203 xhr.status >= 200 && xhr.status < 300 ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6204 xhr.status === 304 || xhr.status === 1223;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6205 } catch(e) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6206
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6207 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6208 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6209
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6210 // Determines if an XMLHttpRequest returns NotModified
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6211 httpNotModified: function( xhr, url ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6212 var lastModified = xhr.getResponseHeader("Last-Modified"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6213 etag = xhr.getResponseHeader("Etag");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6214
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6215 if ( lastModified ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6216 jQuery.lastModified[url] = lastModified;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6217 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6218
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6219 if ( etag ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6220 jQuery.etag[url] = etag;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6221 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6222
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6223 return xhr.status === 304;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6224 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6225
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6226 httpData: function( xhr, type, s ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6227 var ct = xhr.getResponseHeader("content-type") || "",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6228 xml = type === "xml" || !type && ct.indexOf("xml") >= 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6229 data = xml ? xhr.responseXML : xhr.responseText;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6230
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6231 if ( xml && data.documentElement.nodeName === "parsererror" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6232 jQuery.error( "parsererror" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6233 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6234
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6235 // Allow a pre-filtering function to sanitize the response
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6236 // s is checked to keep backwards compatibility
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6237 if ( s && s.dataFilter ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6238 data = s.dataFilter( data, type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6239 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6240
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6241 // The filter can actually parse the response
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6242 if ( typeof data === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6243 // Get the JavaScript object, if JSON is used.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6244 if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6245 data = jQuery.parseJSON( data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6246
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6247 // If the type is "script", eval it in global context
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6248 } else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6249 jQuery.globalEval( data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6250 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6251 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6252
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6253 return data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6254 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6255
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6256 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6257
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6258 /*
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6259 * Create the request object; Microsoft failed to properly
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6260 * implement the XMLHttpRequest in IE7 (can't request local files),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6261 * so we use the ActiveXObject when it is available
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6262 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6263 * we need a fallback.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6264 */
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6265 if ( window.ActiveXObject ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6266 jQuery.ajaxSettings.xhr = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6267 if ( window.location.protocol !== "file:" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6268 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6269 return new window.XMLHttpRequest();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6270 } catch(xhrError) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6271 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6272
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6273 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6274 return new window.ActiveXObject("Microsoft.XMLHTTP");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6275 } catch(activeError) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6276 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6277 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6278
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6279 // Does this browser support XHR requests?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6280 jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6281
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6282
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6283
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6284
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6285 var elemdisplay = {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6286 rfxtypes = /^(?:toggle|show|hide)$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6287 rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6288 timerId,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6289 fxAttrs = [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6290 // height animations
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6291 [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6292 // width animations
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6293 [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6294 // opacity animations
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6295 [ "opacity" ]
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6296 ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6297
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6298 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6299 show: function( speed, easing, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6300 var elem, display;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6301
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6302 if ( speed || speed === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6303 return this.animate( genFx("show", 3), speed, easing, callback);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6304
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6305 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6306 for ( var i = 0, j = this.length; i < j; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6307 elem = this[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6308 display = elem.style.display;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6309
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6310 // Reset the inline display of this element to learn if it is
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6311 // being hidden by cascaded rules or not
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6312 if ( !jQuery.data(elem, "olddisplay") && display === "none" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6313 display = elem.style.display = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6314 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6315
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6316 // Set elements which have been overridden with display: none
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6317 // in a stylesheet to whatever the default browser style is
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6318 // for such an element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6319 if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6320 jQuery.data(elem, "olddisplay", defaultDisplay(elem.nodeName));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6321 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6322 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6323
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6324 // Set the display of most of the elements in a second loop
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6325 // to avoid the constant reflow
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6326 for ( i = 0; i < j; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6327 elem = this[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6328 display = elem.style.display;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6329
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6330 if ( display === "" || display === "none" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6331 elem.style.display = jQuery.data(elem, "olddisplay") || "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6332 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6333 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6334
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6335 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6336 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6337 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6338
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6339 hide: function( speed, easing, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6340 if ( speed || speed === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6341 return this.animate( genFx("hide", 3), speed, easing, callback);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6342
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6343 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6344 for ( var i = 0, j = this.length; i < j; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6345 var display = jQuery.css( this[i], "display" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6346
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6347 if ( display !== "none" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6348 jQuery.data( this[i], "olddisplay", display );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6349 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6350 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6351
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6352 // Set the display of the elements in a second loop
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6353 // to avoid the constant reflow
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6354 for ( i = 0; i < j; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6355 this[i].style.display = "none";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6356 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6357
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6358 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6359 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6360 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6361
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6362 // Save the old toggle function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6363 _toggle: jQuery.fn.toggle,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6364
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6365 toggle: function( fn, fn2, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6366 var bool = typeof fn === "boolean";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6367
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6368 if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6369 this._toggle.apply( this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6370
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6371 } else if ( fn == null || bool ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6372 this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6373 var state = bool ? fn : jQuery(this).is(":hidden");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6374 jQuery(this)[ state ? "show" : "hide" ]();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6375 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6376
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6377 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6378 this.animate(genFx("toggle", 3), fn, fn2, callback);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6379 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6380
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6381 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6382 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6383
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6384 fadeTo: function( speed, to, easing, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6385 return this.filter(":hidden").css("opacity", 0).show().end()
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6386 .animate({opacity: to}, speed, easing, callback);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6387 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6388
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6389 animate: function( prop, speed, easing, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6390 var optall = jQuery.speed(speed, easing, callback);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6391
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6392 if ( jQuery.isEmptyObject( prop ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6393 return this.each( optall.complete );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6394 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6395
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6396 return this[ optall.queue === false ? "each" : "queue" ](function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6397 // XXX 'this' does not always have a nodeName when running the
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6398 // test suite
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6399
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6400 var opt = jQuery.extend({}, optall), p,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6401 isElement = this.nodeType === 1,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6402 hidden = isElement && jQuery(this).is(":hidden"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6403 self = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6404
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6405 for ( p in prop ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6406 var name = jQuery.camelCase( p );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6407
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6408 if ( p !== name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6409 prop[ name ] = prop[ p ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6410 delete prop[ p ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6411 p = name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6412 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6413
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6414 if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6415 return opt.complete.call(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6416 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6417
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6418 if ( isElement && ( p === "height" || p === "width" ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6419 // Make sure that nothing sneaks out
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6420 // Record all 3 overflow attributes because IE does not
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6421 // change the overflow attribute when overflowX and
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6422 // overflowY are set to the same value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6423 opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6424
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6425 // Set display property to inline-block for height/width
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6426 // animations on inline elements that are having width/height
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6427 // animated
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6428 if ( jQuery.css( this, "display" ) === "inline" &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6429 jQuery.css( this, "float" ) === "none" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6430 if ( !jQuery.support.inlineBlockNeedsLayout ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6431 this.style.display = "inline-block";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6432
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6433 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6434 var display = defaultDisplay(this.nodeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6435
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6436 // inline-level elements accept inline-block;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6437 // block-level elements need to be inline with layout
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6438 if ( display === "inline" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6439 this.style.display = "inline-block";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6440
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6441 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6442 this.style.display = "inline";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6443 this.style.zoom = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6444 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6445 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6446 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6447 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6448
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6449 if ( jQuery.isArray( prop[p] ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6450 // Create (if needed) and add to specialEasing
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6451 (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6452 prop[p] = prop[p][0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6453 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6454 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6455
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6456 if ( opt.overflow != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6457 this.style.overflow = "hidden";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6458 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6459
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6460 opt.curAnim = jQuery.extend({}, prop);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6461
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6462 jQuery.each( prop, function( name, val ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6463 var e = new jQuery.fx( self, opt, name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6464
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6465 if ( rfxtypes.test(val) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6466 e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6467
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6468 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6469 var parts = rfxnum.exec(val),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6470 start = e.cur() || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6471
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6472 if ( parts ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6473 var end = parseFloat( parts[2] ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6474 unit = parts[3] || "px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6475
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6476 // We need to compute starting value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6477 if ( unit !== "px" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6478 jQuery.style( self, name, (end || 1) + unit);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6479 start = ((end || 1) / e.cur()) * start;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6480 jQuery.style( self, name, start + unit);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6481 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6482
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6483 // If a +=/-= token was provided, we're doing a relative animation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6484 if ( parts[1] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6485 end = ((parts[1] === "-=" ? -1 : 1) * end) + start;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6486 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6487
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6488 e.custom( start, end, unit );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6489
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6490 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6491 e.custom( start, val, "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6492 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6493 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6494 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6495
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6496 // For JS strict compliance
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6497 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6498 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6499 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6500
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6501 stop: function( clearQueue, gotoEnd ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6502 var timers = jQuery.timers;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6503
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6504 if ( clearQueue ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6505 this.queue([]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6506 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6507
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6508 this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6509 // go in reverse order so anything added to the queue during the loop is ignored
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6510 for ( var i = timers.length - 1; i >= 0; i-- ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6511 if ( timers[i].elem === this ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6512 if (gotoEnd) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6513 // force the next step to be the last
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6514 timers[i](true);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6515 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6516
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6517 timers.splice(i, 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6518 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6519 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6520 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6521
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6522 // start the next in the queue if the last step wasn't forced
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6523 if ( !gotoEnd ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6524 this.dequeue();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6525 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6526
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6527 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6528 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6529
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6530 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6531
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6532 function genFx( type, num ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6533 var obj = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6534
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6535 jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6536 obj[ this ] = type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6537 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6538
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6539 return obj;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6540 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6541
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6542 // Generate shortcuts for custom animations
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6543 jQuery.each({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6544 slideDown: genFx("show", 1),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6545 slideUp: genFx("hide", 1),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6546 slideToggle: genFx("toggle", 1),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6547 fadeIn: { opacity: "show" },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6548 fadeOut: { opacity: "hide" },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6549 fadeToggle: { opacity: "toggle" }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6550 }, function( name, props ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6551 jQuery.fn[ name ] = function( speed, easing, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6552 return this.animate( props, speed, easing, callback );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6553 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6554 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6555
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6556 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6557 speed: function( speed, easing, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6558 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6559 complete: fn || !fn && easing ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6560 jQuery.isFunction( speed ) && speed,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6561 duration: speed,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6562 easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6563 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6564
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6565 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6566 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6567
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6568 // Queueing
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6569 opt.old = opt.complete;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6570 opt.complete = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6571 if ( opt.queue !== false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6572 jQuery(this).dequeue();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6573 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6574 if ( jQuery.isFunction( opt.old ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6575 opt.old.call( this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6576 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6577 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6578
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6579 return opt;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6580 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6581
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6582 easing: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6583 linear: function( p, n, firstNum, diff ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6584 return firstNum + diff * p;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6585 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6586 swing: function( p, n, firstNum, diff ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6587 return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6588 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6589 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6590
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6591 timers: [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6592
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6593 fx: function( elem, options, prop ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6594 this.options = options;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6595 this.elem = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6596 this.prop = prop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6597
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6598 if ( !options.orig ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6599 options.orig = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6600 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6601 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6602
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6603 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6604
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6605 jQuery.fx.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6606 // Simple function for setting a style value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6607 update: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6608 if ( this.options.step ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6609 this.options.step.call( this.elem, this.now, this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6610 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6611
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6612 (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6613 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6614
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6615 // Get the current size
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6616 cur: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6617 if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6618 return this.elem[ this.prop ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6619 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6620
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6621 var r = parseFloat( jQuery.css( this.elem, this.prop ) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6622 return r && r > -10000 ? r : 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6623 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6624
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6625 // Start an animation from one number to another
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6626 custom: function( from, to, unit ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6627 var self = this,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6628 fx = jQuery.fx;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6629
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6630 this.startTime = jQuery.now();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6631 this.start = from;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6632 this.end = to;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6633 this.unit = unit || this.unit || "px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6634 this.now = this.start;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6635 this.pos = this.state = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6636
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6637 function t( gotoEnd ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6638 return self.step(gotoEnd);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6639 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6640
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6641 t.elem = this.elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6642
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6643 if ( t() && jQuery.timers.push(t) && !timerId ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6644 timerId = setInterval(fx.tick, fx.interval);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6645 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6646 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6647
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6648 // Simple 'show' function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6649 show: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6650 // Remember where we started, so that we can go back to it later
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6651 this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6652 this.options.show = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6653
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6654 // Begin the animation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6655 // Make sure that we start at a small width/height to avoid any
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6656 // flash of content
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6657 this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6658
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6659 // Start by showing the element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6660 jQuery( this.elem ).show();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6661 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6662
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6663 // Simple 'hide' function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6664 hide: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6665 // Remember where we started, so that we can go back to it later
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6666 this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6667 this.options.hide = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6668
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6669 // Begin the animation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6670 this.custom(this.cur(), 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6671 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6672
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6673 // Each step of an animation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6674 step: function( gotoEnd ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6675 var t = jQuery.now(), done = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6676
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6677 if ( gotoEnd || t >= this.options.duration + this.startTime ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6678 this.now = this.end;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6679 this.pos = this.state = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6680 this.update();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6681
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6682 this.options.curAnim[ this.prop ] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6683
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6684 for ( var i in this.options.curAnim ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6685 if ( this.options.curAnim[i] !== true ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6686 done = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6687 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6688 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6689
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6690 if ( done ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6691 // Reset the overflow
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6692 if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6693 var elem = this.elem,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6694 options = this.options;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6695
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6696 jQuery.each( [ "", "X", "Y" ], function (index, value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6697 elem.style[ "overflow" + value ] = options.overflow[index];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6698 } );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6699 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6700
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6701 // Hide the element if the "hide" operation was done
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6702 if ( this.options.hide ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6703 jQuery(this.elem).hide();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6704 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6705
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6706 // Reset the properties, if the item has been hidden or shown
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6707 if ( this.options.hide || this.options.show ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6708 for ( var p in this.options.curAnim ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6709 jQuery.style( this.elem, p, this.options.orig[p] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6710 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6711 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6712
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6713 // Execute the complete function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6714 this.options.complete.call( this.elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6715 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6716
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6717 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6718
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6719 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6720 var n = t - this.startTime;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6721 this.state = n / this.options.duration;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6722
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6723 // Perform the easing function, defaults to swing
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6724 var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6725 var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6726 this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6727 this.now = this.start + ((this.end - this.start) * this.pos);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6728
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6729 // Perform the next step of the animation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6730 this.update();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6731 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6732
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6733 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6734 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6735 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6736
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6737 jQuery.extend( jQuery.fx, {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6738 tick: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6739 var timers = jQuery.timers;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6740
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6741 for ( var i = 0; i < timers.length; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6742 if ( !timers[i]() ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6743 timers.splice(i--, 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6744 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6745 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6746
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6747 if ( !timers.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6748 jQuery.fx.stop();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6749 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6750 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6751
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6752 interval: 13,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6753
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6754 stop: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6755 clearInterval( timerId );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6756 timerId = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6757 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6758
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6759 speeds: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6760 slow: 600,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6761 fast: 200,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6762 // Default speed
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6763 _default: 400
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6764 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6765
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6766 step: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6767 opacity: function( fx ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6768 jQuery.style( fx.elem, "opacity", fx.now );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6769 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6770
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6771 _default: function( fx ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6772 if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6773 fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6774 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6775 fx.elem[ fx.prop ] = fx.now;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6776 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6777 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6778 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6779 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6780
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6781 if ( jQuery.expr && jQuery.expr.filters ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6782 jQuery.expr.filters.animated = function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6783 return jQuery.grep(jQuery.timers, function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6784 return elem === fn.elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6785 }).length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6786 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6787 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6788
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6789 function defaultDisplay( nodeName ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6790 if ( !elemdisplay[ nodeName ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6791 var elem = jQuery("<" + nodeName + ">").appendTo("body"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6792 display = elem.css("display");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6793
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6794 elem.remove();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6795
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6796 if ( display === "none" || display === "" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6797 display = "block";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6798 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6799
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6800 elemdisplay[ nodeName ] = display;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6801 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6802
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6803 return elemdisplay[ nodeName ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6804 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6805
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6806
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6807
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6808
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6809 var rtable = /^t(?:able|d|h)$/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6810 rroot = /^(?:body|html)$/i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6811
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6812 if ( "getBoundingClientRect" in document.documentElement ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6813 jQuery.fn.offset = function( options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6814 var elem = this[0], box;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6815
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6816 if ( options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6817 return this.each(function( i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6818 jQuery.offset.setOffset( this, options, i );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6819 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6820 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6821
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6822 if ( !elem || !elem.ownerDocument ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6823 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6824 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6825
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6826 if ( elem === elem.ownerDocument.body ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6827 return jQuery.offset.bodyOffset( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6828 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6829
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6830 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6831 box = elem.getBoundingClientRect();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6832 } catch(e) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6833
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6834 var doc = elem.ownerDocument,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6835 docElem = doc.documentElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6836
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6837 // Make sure we're not dealing with a disconnected DOM node
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6838 if ( !box || !jQuery.contains( docElem, elem ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6839 return box || { top: 0, left: 0 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6840 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6841
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6842 var body = doc.body,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6843 win = getWindow(doc),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6844 clientTop = docElem.clientTop || body.clientTop || 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6845 clientLeft = docElem.clientLeft || body.clientLeft || 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6846 scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6847 scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6848 top = box.top + scrollTop - clientTop,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6849 left = box.left + scrollLeft - clientLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6850
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6851 return { top: top, left: left };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6852 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6853
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6854 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6855 jQuery.fn.offset = function( options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6856 var elem = this[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6857
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6858 if ( options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6859 return this.each(function( i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6860 jQuery.offset.setOffset( this, options, i );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6861 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6862 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6863
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6864 if ( !elem || !elem.ownerDocument ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6865 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6866 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6867
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6868 if ( elem === elem.ownerDocument.body ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6869 return jQuery.offset.bodyOffset( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6870 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6871
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6872 jQuery.offset.initialize();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6873
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6874 var computedStyle,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6875 offsetParent = elem.offsetParent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6876 prevOffsetParent = elem,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6877 doc = elem.ownerDocument,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6878 docElem = doc.documentElement,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6879 body = doc.body,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6880 defaultView = doc.defaultView,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6881 prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6882 top = elem.offsetTop,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6883 left = elem.offsetLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6884
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6885 while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6886 if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6887 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6888 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6889
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6890 computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6891 top -= elem.scrollTop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6892 left -= elem.scrollLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6893
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6894 if ( elem === offsetParent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6895 top += elem.offsetTop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6896 left += elem.offsetLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6897
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6898 if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6899 top += parseFloat( computedStyle.borderTopWidth ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6900 left += parseFloat( computedStyle.borderLeftWidth ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6901 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6902
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6903 prevOffsetParent = offsetParent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6904 offsetParent = elem.offsetParent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6905 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6906
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6907 if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6908 top += parseFloat( computedStyle.borderTopWidth ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6909 left += parseFloat( computedStyle.borderLeftWidth ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6910 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6911
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6912 prevComputedStyle = computedStyle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6913 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6914
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6915 if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6916 top += body.offsetTop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6917 left += body.offsetLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6918 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6919
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6920 if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6921 top += Math.max( docElem.scrollTop, body.scrollTop );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6922 left += Math.max( docElem.scrollLeft, body.scrollLeft );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6923 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6924
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6925 return { top: top, left: left };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6926 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6927 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6928
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6929 jQuery.offset = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6930 initialize: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6931 var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6932 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>";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6933
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6934 jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6935
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6936 container.innerHTML = html;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6937 body.insertBefore( container, body.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6938 innerDiv = container.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6939 checkDiv = innerDiv.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6940 td = innerDiv.nextSibling.firstChild.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6941
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6942 this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6943 this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6944
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6945 checkDiv.style.position = "fixed";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6946 checkDiv.style.top = "20px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6947
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6948 // safari subtracts parent border width here which is 5px
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6949 this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6950 checkDiv.style.position = checkDiv.style.top = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6951
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6952 innerDiv.style.overflow = "hidden";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6953 innerDiv.style.position = "relative";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6954
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6955 this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6956
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6957 this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6958
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6959 body.removeChild( container );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6960 body = container = innerDiv = checkDiv = table = td = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6961 jQuery.offset.initialize = jQuery.noop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6962 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6963
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6964 bodyOffset: function( body ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6965 var top = body.offsetTop,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6966 left = body.offsetLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6967
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6968 jQuery.offset.initialize();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6969
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6970 if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6971 top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6972 left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6973 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6974
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6975 return { top: top, left: left };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6976 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6977
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6978 setOffset: function( elem, options, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6979 var position = jQuery.css( elem, "position" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6980
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6981 // set position first, in-case top/left are set even on static elem
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6982 if ( position === "static" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6983 elem.style.position = "relative";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6984 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6985
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6986 var curElem = jQuery( elem ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6987 curOffset = curElem.offset(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6988 curCSSTop = jQuery.css( elem, "top" ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6989 curCSSLeft = jQuery.css( elem, "left" ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6990 calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6991 props = {}, curPosition = {}, curTop, curLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6992
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6993 // need to be able to calculate position if either top or left is auto and position is absolute
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6994 if ( calculatePosition ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6995 curPosition = curElem.position();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6996 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6997
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6998 curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6999 curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7000
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7001 if ( jQuery.isFunction( options ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7002 options = options.call( elem, i, curOffset );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7003 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7004
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7005 if (options.top != null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7006 props.top = (options.top - curOffset.top) + curTop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7007 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7008 if (options.left != null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7009 props.left = (options.left - curOffset.left) + curLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7010 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7011
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7012 if ( "using" in options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7013 options.using.call( elem, props );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7014 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7015 curElem.css( props );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7016 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7017 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7018 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7019
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7020
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7021 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7022 position: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7023 if ( !this[0] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7024 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7025 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7026
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7027 var elem = this[0],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7028
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7029 // Get *real* offsetParent
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7030 offsetParent = this.offsetParent(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7031
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7032 // Get correct offsets
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7033 offset = this.offset(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7034 parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7035
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7036 // Subtract element margins
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7037 // note: when an element has margin: auto the offsetLeft and marginLeft
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7038 // are the same in Safari causing offset.left to incorrectly be 0
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7039 offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7040 offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7041
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7042 // Add offsetParent borders
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7043 parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7044 parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7045
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7046 // Subtract the two offsets
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7047 return {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7048 top: offset.top - parentOffset.top,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7049 left: offset.left - parentOffset.left
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7050 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7051 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7052
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7053 offsetParent: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7054 return this.map(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7055 var offsetParent = this.offsetParent || document.body;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7056 while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7057 offsetParent = offsetParent.offsetParent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7058 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7059 return offsetParent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7060 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7061 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7062 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7063
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7064
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7065 // Create scrollLeft and scrollTop methods
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7066 jQuery.each( ["Left", "Top"], function( i, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7067 var method = "scroll" + name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7068
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7069 jQuery.fn[ method ] = function(val) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7070 var elem = this[0], win;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7071
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7072 if ( !elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7073 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7074 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7075
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7076 if ( val !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7077 // Set the scroll offset
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7078 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7079 win = getWindow( this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7080
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7081 if ( win ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7082 win.scrollTo(
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7083 !i ? val : jQuery(win).scrollLeft(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7084 i ? val : jQuery(win).scrollTop()
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7085 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7086
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7087 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7088 this[ method ] = val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7089 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7090 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7091 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7092 win = getWindow( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7093
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7094 // Return the scroll offset
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7095 return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7096 jQuery.support.boxModel && win.document.documentElement[ method ] ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7097 win.document.body[ method ] :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7098 elem[ method ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7099 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7100 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7101 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7102
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7103 function getWindow( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7104 return jQuery.isWindow( elem ) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7105 elem :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7106 elem.nodeType === 9 ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7107 elem.defaultView || elem.parentWindow :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7108 false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7109 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7110
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7111
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7112
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7113
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7114 // Create innerHeight, innerWidth, outerHeight and outerWidth methods
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7115 jQuery.each([ "Height", "Width" ], function( i, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7116
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7117 var type = name.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7118
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7119 // innerHeight and innerWidth
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7120 jQuery.fn["inner" + name] = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7121 return this[0] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7122 parseFloat( jQuery.css( this[0], type, "padding" ) ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7123 null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7124 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7125
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7126 // outerHeight and outerWidth
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7127 jQuery.fn["outer" + name] = function( margin ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7128 return this[0] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7129 parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7130 null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7131 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7132
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7133 jQuery.fn[ type ] = function( size ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7134 // Get window width or height
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7135 var elem = this[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7136 if ( !elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7137 return size == null ? null : this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7138 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7139
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7140 if ( jQuery.isFunction( size ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7141 return this.each(function( i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7142 var self = jQuery( this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7143 self[ type ]( size.call( this, i, self[ type ]() ) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7144 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7145 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7146
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7147 if ( jQuery.isWindow( elem ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7148 // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7149 return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7150 elem.document.body[ "client" + name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7151
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7152 // Get document width or height
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7153 } else if ( elem.nodeType === 9 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7154 // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7155 return Math.max(
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7156 elem.documentElement["client" + name],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7157 elem.body["scroll" + name], elem.documentElement["scroll" + name],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7158 elem.body["offset" + name], elem.documentElement["offset" + name]
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7159 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7160
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7161 // Get or set width or height on the element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7162 } else if ( size === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7163 var orig = jQuery.css( elem, type ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7164 ret = parseFloat( orig );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7165
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7166 return jQuery.isNaN( ret ) ? orig : ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7167
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7168 // Set the width or height on the element (default to pixels if value is unitless)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7169 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7170 return this.css( type, typeof size === "string" ? size : size + "px" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7171 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7172 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7173
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7174 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7175
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7176
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7177 })(window);