annotate Agendas/trunk/src/Agendas.Web/Scripts/jquery-1.4.4-vsdoc.js @ 300:48ab8788bd19

#200: Patrocinadores: Agregar link al sitio web.
author juanjose.montesdeocaarbos
date Mon, 27 Feb 2012 14:45:12 -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 * This file has been commented to support Visual Studio Intellisense.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3 * You should not use this file at runtime inside the browser--it is only
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4 * intended to be used only for design-time IntelliSense. Please use the
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5 * standard jQuery library for all production use.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6 *
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7 * Comment version: 1.4.4a
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8 */
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
10 /*!
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
11 * Note: While Microsoft is not the author of this file, Microsoft is
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
12 * offering you a license subject to the terms of the Microsoft Software
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
13 * License Terms for Microsoft ASP.NET Model View Controller 3.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
14 * Microsoft reserves all other rights. The notices below are provided
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
15 * for informational purposes only and are not the license terms under
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
16 * which Microsoft distributed this file.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
17 *
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
18 * jQuery JavaScript Library v1.4.4
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
19 * http://jquery.com/
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
20 *
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
21 * Copyright 2010, John Resig
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
22 *
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
23 * Includes Sizzle.js
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
24 * http://sizzlejs.com/
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
25 * Copyright 2010, The Dojo Foundation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
26 *
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
27 * Date: Thu Nov 11 19:04:53 2010 -0500
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
28 */
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
29 (function( window, undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
30
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
31 // Use the correct document accordingly with window argument (sandbox)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
32 var document = window.document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
33 var jQuery = (function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
34
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
35 // Define a local copy of jQuery
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
36 var jQuery = function( selector, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
37 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
38 /// 1: $(expression, context) - This function accepts a string containing a CSS selector which is then used to match a set of elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
39 /// 2: $(html) - Create DOM elements on-the-fly from the provided String of raw HTML.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
40 /// 3: $(elements) - Wrap jQuery functionality around a single or multiple DOM Element(s).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
41 /// 4: $(callback) - A shorthand for $(document).ready().
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
42 /// 5: $() - As of jQuery 1.4, if you pass no arguments in to the jQuery() method, an empty jQuery set will be returned.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
43 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
44 /// <param name="selector" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
45 /// 1: expression - An expression to search with.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
46 /// 2: html - A string of HTML to create on the fly.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
47 /// 3: elements - DOM element(s) to be encapsulated by a jQuery object.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
48 /// 4: callback - The function to execute when the DOM is ready.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
49 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
50 /// <param name="context" type="jQuery">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
51 /// 1: context - A DOM Element, Document or jQuery to use as context.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
52 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
53 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
54
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
55 // The jQuery object is actually just the init constructor 'enhanced'
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
56 return new jQuery.fn.init( selector, context );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
57 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
58
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
59 // Map over jQuery in case of overwrite
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
60 _jQuery = window.jQuery,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
61
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
62 // Map over the $ in case of overwrite
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
63 _$ = window.$,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
64
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
65 // A central reference to the root jQuery(document)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
66 rootjQuery,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
67
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
68 // A simple way to check for HTML strings or ID strings
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
69 // (both of which we optimize for)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
70 quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
71
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
72 // Is it a simple selector
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
73 isSimple = /^.[^:#\[\.,]*$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
74
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
75 // Check if a string has a non-whitespace character in it
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
76 rnotwhite = /\S/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
77 rwhite = /\s/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
78
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
79 // Used for trimming whitespace
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
80 trimLeft = /^\s+/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
81 trimRight = /\s+$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
82
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
83 // Check for non-word characters
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
84 rnonword = /\W/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
85
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
86 // Check for digits
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
87 rdigit = /\d/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
88
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
89 // Match a standalone tag
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
90 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
91
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
92 // JSON RegExp
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
93 rvalidchars = /^[\],:{}\s]*$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
94 rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
95 rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
96 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
97
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
98 // Useragent RegExp
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
99 rwebkit = /(webkit)[ \/]([\w.]+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
100 ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
101 rmsie = /(msie) ([\w.]+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
102 rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
103
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
104 // Keep a UserAgent string for use with jQuery.browser
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
105 userAgent = navigator.userAgent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
106
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
107 // For matching the engine and version of the browser
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
108 browserMatch,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
109
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
110 // Has the ready events already been bound?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
111 readyBound = false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
112
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
113 // The functions to execute on DOM ready
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
114 readyList = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
115
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
116 // The ready event handler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
117 DOMContentLoaded,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
118
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
119 // Save a reference to some core methods
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
120 toString = Object.prototype.toString,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
121 hasOwn = Object.prototype.hasOwnProperty,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
122 push = Array.prototype.push,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
123 slice = Array.prototype.slice,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
124 trim = String.prototype.trim,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
125 indexOf = Array.prototype.indexOf,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
126
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
127 // [[Class]] -> type pairs
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
128 class2type = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
129
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
130 jQuery.fn = jQuery.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
131 init: function( selector, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
132 var match, elem, ret, doc;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
133
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
134 // Handle $(""), $(null), or $(undefined)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
135 if ( !selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
136 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
137 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
138
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
139 // Handle $(DOMElement)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
140 if ( selector.nodeType ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
141 this.context = this[0] = selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
142 this.length = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
143 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
144 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
145
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
146 // The body element only exists once, optimize finding it
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
147 if ( selector === "body" && !context && document.body ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
148 this.context = document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
149 this[0] = document.body;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
150 this.selector = "body";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
151 this.length = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
152 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
153 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
154
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
155 // Handle HTML strings
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
156 if ( typeof selector === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
157 // Are we dealing with HTML string or an ID?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
158 match = quickExpr.exec( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
159
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
160 // Verify a match, and that no context was specified for #id
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
161 if ( match && (match[1] || !context) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
162
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
163 // HANDLE: $(html) -> $(array)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
164 if ( match[1] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
165 doc = (context ? context.ownerDocument || context : document);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
166
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
167 // If a single string is passed in and it's a single tag
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
168 // just do a createElement and skip the rest
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
169 ret = rsingleTag.exec( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
170
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
171 if ( ret ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
172 if ( jQuery.isPlainObject( context ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
173 selector = [ document.createElement( ret[1] ) ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
174 jQuery.fn.attr.call( selector, context, true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
175
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
176 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
177 selector = [ doc.createElement( ret[1] ) ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
178 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
179
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
180 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
181 ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
182 selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
183 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
184
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
185 return jQuery.merge( this, selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
186
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
187 // HANDLE: $("#id")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
188 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
189 elem = document.getElementById( match[2] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
190
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
191 // Check parentNode to catch when Blackberry 4.6 returns
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
192 // nodes that are no longer in the document #6963
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
193 if ( elem && elem.parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
194 // Handle the case where IE and Opera return items
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
195 // by name instead of ID
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
196 if ( elem.id !== match[2] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
197 return rootjQuery.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 // Otherwise, we inject the element directly into the jQuery object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
201 this.length = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
202 this[0] = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
203 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
204
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
205 this.context = document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
206 this.selector = selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
207 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
208 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
209
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
210 // HANDLE: $("TAG")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
211 } else if ( !context && !rnonword.test( selector ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
212 this.selector = selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
213 this.context = document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
214 selector = document.getElementsByTagName( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
215 return jQuery.merge( this, selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
216
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
217 // HANDLE: $(expr, $(...))
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
218 } else if ( !context || context.jquery ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
219 return (context || rootjQuery).find( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
220
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
221 // HANDLE: $(expr, context)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
222 // (which is just equivalent to: $(context).find(expr)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
223 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
224 return jQuery( context ).find( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
225 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
226
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
227 // HANDLE: $(function)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
228 // Shortcut for document ready
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
229 } else if ( jQuery.isFunction( selector ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
230 return rootjQuery.ready( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
231 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
232
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
233 if (selector.selector !== undefined) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
234 this.selector = selector.selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
235 this.context = selector.context;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
236 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
237
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
238 return jQuery.makeArray( selector, this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
239 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
240
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
241 // Start with an empty selector
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
242 selector: "",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
243
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
244 // The current version of jQuery being used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
245 jquery: "1.4.4",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
246
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
247 // The default length of a jQuery object is 0
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
248 length: 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
249
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
250 // The number of elements contained in the matched element set
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
251 size: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
252 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
253 /// The number of elements currently matched.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
254 /// Part of Core
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
255 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
256 /// <returns type="Number" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
257
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
258 return this.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
259 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
260
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
261 toArray: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
262 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
263 /// Retrieve all the DOM elements contained in the jQuery set, as an array.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
264 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
265 /// <returns type="Array" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
266 return slice.call( this, 0 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
267 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
268
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
269 // Get the Nth element in the matched element set OR
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
270 // Get the whole matched element set as a clean array
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
271 get: function( num ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
272 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
273 /// Access a single matched element. num is used to access the
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
274 /// Nth element matched.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
275 /// Part of Core
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
276 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
277 /// <returns type="Element" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
278 /// <param name="num" type="Number">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
279 /// Access the element in the Nth position.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
280 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
281
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
282 return num == null ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
283
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
284 // Return a 'clean' array
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
285 this.toArray() :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
286
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
287 // Return just the object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
288 ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
289 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
290
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
291 // Take an array of elements and push it onto the stack
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
292 // (returning the new matched element set)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
293 pushStack: function( elems, name, selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
294 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
295 /// Set the jQuery object to an array of elements, while maintaining
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
296 /// the stack.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
297 /// Part of Core
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
298 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
299 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
300 /// <param name="elems" type="Elements">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
301 /// An array of elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
302 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
303
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
304 // Build a new jQuery matched element set
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
305 var ret = jQuery();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
306
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
307 if ( jQuery.isArray( elems ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
308 push.apply( ret, elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
309
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
310 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
311 jQuery.merge( ret, elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
312 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
313
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
314 // Add the old object onto the stack (as a reference)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
315 ret.prevObject = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
316
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
317 ret.context = this.context;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
318
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
319 if ( name === "find" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
320 ret.selector = this.selector + (this.selector ? " " : "") + selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
321 } else if ( name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
322 ret.selector = this.selector + "." + name + "(" + selector + ")";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
323 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
324
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
325 // Return the newly-formed element set
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
326 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
327 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
328
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
329 // Execute a callback for every element in the matched set.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
330 // (You can seed the arguments with an array of args, but this is
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
331 // only used internally.)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
332 each: function( callback, args ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
333 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
334 /// Execute a function within the context of every matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
335 /// This means that every time the passed-in function is executed
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
336 /// (which is once for every element matched) the 'this' keyword
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
337 /// points to the specific element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
338 /// Additionally, the function, when executed, is passed a single
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
339 /// argument representing the position of the element in the matched
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
340 /// set.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
341 /// Part of Core
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
342 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
343 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
344 /// <param name="callback" type="Function">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
345 /// A function to execute
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
346 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
347
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
348 return jQuery.each( this, callback, args );
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 ready: function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
352 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
353 /// Binds a function to be executed whenever the DOM is ready to be traversed and manipulated.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
354 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
355 /// <param name="fn" type="Function">The function to be executed when the DOM is ready.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
356
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
357 // Attach the listeners
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
358 jQuery.bindReady();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
359
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
360 // If the DOM is already ready
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
361 if ( jQuery.isReady ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
362 // Execute the function immediately
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
363 fn.call( document, jQuery );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
364
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
365 // Otherwise, remember the function for later
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
366 } else if ( readyList ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
367 // Add the function to the wait list
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
368 readyList.push( fn );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
369 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
370
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
371 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
372 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
373
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
374 eq: function( i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
375 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
376 /// Reduce the set of matched elements to a single element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
377 /// The position of the element in the set of matched elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
378 /// starts at 0 and goes to length - 1.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
379 /// Part of Core
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
380 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
381 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
382 /// <param name="num" type="Number">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
383 /// pos The index of the element that you wish to limit to.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
384 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
385
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
386 return i === -1 ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
387 this.slice( i ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
388 this.slice( i, +i + 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
389 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
390
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
391 first: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
392 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
393 /// Reduce the set of matched elements to the first in the set.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
394 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
395 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
396
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
397 return this.eq( 0 );
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 last: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
401 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
402 /// Reduce the set of matched elements to the final one in the set.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
403 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
404 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
405
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
406 return this.eq( -1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
407 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
408
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
409 slice: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
410 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
411 /// Selects a subset of the matched elements. Behaves exactly like the built-in Array slice method.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
412 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
413 /// <param name="start" type="Number" integer="true">Where to start the subset (0-based).</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
414 /// <param name="end" optional="true" type="Number" integer="true">Where to end the subset (not including the end element itself).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
415 /// If omitted, ends at the end of the selection</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
416 /// <returns type="jQuery">The sliced elements</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
417
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
418 return this.pushStack( slice.apply( this, arguments ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
419 "slice", slice.call(arguments).join(",") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
420 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
421
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
422 map: function( callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
423 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
424 /// This member is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
425 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
426 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
427 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
428
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
429 return this.pushStack( jQuery.map(this, function( elem, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
430 return callback.call( elem, i, elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
431 }));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
432 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
433
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
434 end: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
435 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
436 /// End the most recent 'destructive' operation, reverting the list of matched elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
437 /// back to its previous state. After an end operation, the list of matched elements will
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
438 /// revert to the last state of matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
439 /// If there was no destructive operation before, an empty set is returned.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
440 /// Part of DOM/Traversing
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
441 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
442 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
443
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
444 return this.prevObject || jQuery(null);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
445 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
446
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
447 // For internal use only.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
448 // Behaves like an Array's method, not like a jQuery method.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
449 push: push,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
450 sort: [].sort,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
451 splice: [].splice
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 // Give the init function the jQuery prototype for later instantiation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
455 jQuery.fn.init.prototype = jQuery.fn;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
456
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
457 jQuery.extend = jQuery.fn.extend = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
458 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
459 /// Extend one object with one or more others, returning the original,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
460 /// modified, object. This is a great utility for simple inheritance.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
461 /// jQuery.extend(settings, options);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
462 /// var settings = jQuery.extend({}, defaults, options);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
463 /// Part of JavaScript
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
464 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
465 /// <param name="target" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
466 /// The object to extend
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
467 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
468 /// <param name="prop1" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
469 /// The object that will be merged into the first.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
470 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
471 /// <param name="propN" type="Object" optional="true" parameterArray="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
472 /// (optional) More objects to merge into the first
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
473 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
474 /// <returns type="Object" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
475
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
476 var options, name, src, copy, copyIsArray, clone,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
477 target = arguments[0] || {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
478 i = 1,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
479 length = arguments.length,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
480 deep = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
481
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
482 // Handle a deep copy situation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
483 if ( typeof target === "boolean" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
484 deep = target;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
485 target = arguments[1] || {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
486 // skip the boolean and the target
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
487 i = 2;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
488 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
489
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
490 // Handle case when target is a string or something (possible in deep copy)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
491 if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
492 target = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
493 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
494
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
495 // extend jQuery itself if only one argument is passed
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
496 if ( length === i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
497 target = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
498 --i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
499 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
500
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
501 for ( ; i < length; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
502 // Only deal with non-null/undefined values
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
503 if ( (options = arguments[ i ]) != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
504 // Extend the base object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
505 for ( name in options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
506 src = target[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
507 copy = options[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
508
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
509 // Prevent never-ending loop
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
510 if ( target === copy ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
511 continue;
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 // Recurse if we're merging plain objects or arrays
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
515 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
516 if ( copyIsArray ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
517 copyIsArray = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
518 clone = src && jQuery.isArray(src) ? src : [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
519
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
520 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
521 clone = src && jQuery.isPlainObject(src) ? src : {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
522 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
523
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
524 // Never move original objects, clone them
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
525 target[ name ] = jQuery.extend( deep, clone, copy );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
526
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
527 // Don't bring in undefined values
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
528 } else if ( copy !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
529 target[ name ] = copy;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
530 }
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 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
534
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
535 // Return the modified object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
536 return target;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
537 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
538
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
539 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
540 noConflict: function( deep ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
541 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
542 /// Run this function to give control of the $ variable back
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
543 /// to whichever library first implemented it. This helps to make
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
544 /// sure that jQuery doesn't conflict with the $ object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
545 /// of other libraries.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
546 /// By using this function, you will only be able to access jQuery
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
547 /// using the 'jQuery' variable. For example, where you used to do
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
548 /// $(&quot;div p&quot;), you now must do jQuery(&quot;div p&quot;).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
549 /// Part of Core
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
550 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
551 /// <returns type="undefined" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
552
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
553 window.$ = _$;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
554
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
555 if ( deep ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
556 window.jQuery = _jQuery;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
557 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
558
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
559 return jQuery;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
560 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
561
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
562 // Is the DOM ready to be used? Set to true once it occurs.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
563 isReady: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
564
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
565 // A counter to track how many items to wait for before
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
566 // the ready event fires. See #6781
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
567 readyWait: 1,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
568
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
569 // Handle when the DOM is ready
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
570 ready: function( wait ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
571 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
572 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
573 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
574 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
575
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
576 // A third-party is pushing the ready event forwards
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
577 if ( wait === true ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
578 jQuery.readyWait--;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
579 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
580
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
581 // Make sure that the DOM is not already loaded
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
582 if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
583 // 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
584 if ( !document.body ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
585 return setTimeout( jQuery.ready, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
586 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
587
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
588 // Remember that the DOM is ready
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
589 jQuery.isReady = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
590
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
591 // If a normal DOM Ready event fired, decrement, and wait if need be
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
592 if ( wait !== true && --jQuery.readyWait > 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
593 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
594 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
595
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
596 // If there are functions bound, to execute
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
597 if ( readyList ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
598 // Execute all of them
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
599 var fn,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
600 i = 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
601 ready = readyList;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
602
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
603 // Reset the list of functions
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
604 readyList = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
605
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
606 while ( (fn = ready[ i++ ]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
607 fn.call( document, jQuery );
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 // Trigger any bound ready events
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
611 if ( jQuery.fn.trigger ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
612 jQuery( document ).trigger( "ready" ).unbind( "ready" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
613 }
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
618 bindReady: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
619 if ( readyBound ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
620 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
621 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
622
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
623 readyBound = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
624
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
625 // Catch cases where $(document).ready() is called after the
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
626 // browser event has already occurred.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
627 if ( document.readyState === "complete" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
628 // Handle it asynchronously to allow scripts the opportunity to delay ready
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
629 return setTimeout( jQuery.ready, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
630 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
631
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
632 // Mozilla, Opera and webkit nightlies currently support this event
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
633 if ( document.addEventListener ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
634 // Use the handy event callback
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
635 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
636
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
637 // A fallback to window.onload, that will always work
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
638 window.addEventListener( "load", jQuery.ready, false );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
639
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
640 // If IE event model is used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
641 } else if ( document.attachEvent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
642 // ensure firing before onload,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
643 // maybe late but safe also for iframes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
644 document.attachEvent("onreadystatechange", DOMContentLoaded);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
645
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
646 // A fallback to window.onload, that will always work
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
647 window.attachEvent( "onload", jQuery.ready );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
648
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
649 // If IE and not a frame
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
650 // continually check to see if the document is ready
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
651 var toplevel = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
652
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
653 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
654 toplevel = window.frameElement == null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
655 } catch(e) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
656
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
657 if ( document.documentElement.doScroll && toplevel ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
658 doScrollCheck();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
659 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
660 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
661 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
662
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
663 // See test/unit/core.js for details concerning isFunction.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
664 // Since version 1.3, DOM methods and functions like alert
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
665 // aren't supported. They return false on IE (#2968).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
666 isFunction: function( obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
667 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
668 /// Determines if the parameter passed is a function.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
669 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
670 /// <param name="obj" type="Object">The object to check</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
671 /// <returns type="Boolean">True if the parameter is a function; otherwise false.</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
672
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
673 return jQuery.type(obj) === "function";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
674 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
675
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
676 isArray: Array.isArray || function( obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
677 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
678 /// Determine if the parameter passed is an array.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
679 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
680 /// <param name="obj" type="Object">Object to test whether or not it is an array.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
681 /// <returns type="Boolean">True if the parameter is a function; otherwise false.</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
682
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
683 return jQuery.type(obj) === "array";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
684 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
685
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
686 // A crude way of determining if an object is a window
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
687 isWindow: function( obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
688 return obj && typeof obj === "object" && "setInterval" in obj;
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 isNaN: function( obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
692 return obj == null || !rdigit.test( obj ) || isNaN( obj );
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 type: function( obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
696 return obj == null ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
697 String( obj ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
698 class2type[ toString.call(obj) ] || "object";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
699 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
700
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
701 isPlainObject: function( obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
702 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
703 /// Check to see if an object is a plain object (created using "{}" or "new Object").
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
704 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
705 /// <param name="obj" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
706 /// The object that will be checked to see if it's a plain object.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
707 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
708 /// <returns type="Boolean" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
709
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
710 // Must be an Object.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
711 // Because of IE, we also have to check the presence of the constructor property.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
712 // Make sure that DOM nodes and window objects don't pass through, as well
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
713 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
714 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
715 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
716
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
717 // Not own constructor property must be Object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
718 if ( obj.constructor &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
719 !hasOwn.call(obj, "constructor") &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
720 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
721 return false;
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 // Own properties are enumerated firstly, so to speed up,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
725 // if last one is own, then all properties are own.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
726
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
727 var key;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
728 for ( key in obj ) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
729
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
730 return key === undefined || hasOwn.call( obj, key );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
731 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
732
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
733 isEmptyObject: function( obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
734 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
735 /// Check to see if an object is empty (contains no properties).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
736 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
737 /// <param name="obj" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
738 /// The object that will be checked to see if it's empty.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
739 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
740 /// <returns type="Boolean" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
741
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
742 for ( var name in obj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
743 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
744 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
745 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
746 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
747
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
748 error: function( msg ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
749 throw msg;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
750 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
751
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
752 parseJSON: function( data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
753 if ( typeof data !== "string" || !data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
754 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
755 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
756
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
757 // Make sure leading/trailing whitespace is removed (IE can't handle it)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
758 data = jQuery.trim( data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
759
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
760 // Make sure the incoming data is actual JSON
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
761 // Logic borrowed from http://json.org/json2.js
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
762 if ( rvalidchars.test(data.replace(rvalidescape, "@")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
763 .replace(rvalidtokens, "]")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
764 .replace(rvalidbraces, "")) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
765
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
766 // Try to use the native JSON parser first
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
767 return window.JSON && window.JSON.parse ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
768 window.JSON.parse( data ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
769 (new Function("return " + data))();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
770
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
771 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
772 jQuery.error( "Invalid JSON: " + data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
773 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
774 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
775
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
776 noop: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
777 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
778 /// An empty function.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
779 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
780 /// <returns type="Function" />
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 // Evalulates a script in a global context
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
784 globalEval: function( data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
785 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
786 /// Internally evaluates a script in a global context.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
787 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
788 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
789
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
790 if ( data && rnotwhite.test(data) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
791 // Inspired by code by Andrea Giammarchi
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
792 // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
793 var head = document.getElementsByTagName("head")[0] || document.documentElement,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
794 script = document.createElement("script");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
795
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
796 script.type = "text/javascript";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
797
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
798 if ( jQuery.support.scriptEval ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
799 script.appendChild( document.createTextNode( data ) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
800 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
801 script.text = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
802 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
803
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
804 // Use insertBefore instead of appendChild to circumvent an IE6 bug.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
805 // This arises when a base node is used (#2709).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
806 head.insertBefore( script, head.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
807 head.removeChild( script );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
808 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
809 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
810
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
811 nodeName: function( elem, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
812 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
813 /// Checks whether the specified element has the specified DOM node name.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
814 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
815 /// <param name="elem" type="Element">The element to examine</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
816 /// <param name="name" type="String">The node name to check</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
817 /// <returns type="Boolean">True if the specified node name matches the node's DOM node name; otherwise false</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
818
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
819 return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
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 // args is for internal usage only
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
823 each: function( object, callback, args ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
824 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
825 /// A generic iterator function, which can be used to seemlessly
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
826 /// iterate over both objects and arrays. This function is not the same
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
827 /// as $().each() - which is used to iterate, exclusively, over a jQuery
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
828 /// object. This function can be used to iterate over anything.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
829 /// The callback has two arguments:the key (objects) or index (arrays) as first
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
830 /// the first, and the value as the second.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
831 /// Part of JavaScript
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
832 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
833 /// <param name="obj" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
834 /// The object, or array, to iterate over.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
835 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
836 /// <param name="fn" type="Function">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
837 /// The function that will be executed on every object.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
838 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
839 /// <returns type="Object" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
840
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
841 var name, i = 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
842 length = object.length,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
843 isObj = length === undefined || jQuery.isFunction(object);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
844
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
845 if ( args ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
846 if ( isObj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
847 for ( name in object ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
848 if ( callback.apply( object[ name ], args ) === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
849 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
850 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
851 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
852 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
853 for ( ; i < length; ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
854 if ( callback.apply( object[ i++ ], args ) === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
855 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
856 }
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
860 // A special, fast, case for the most common use of each
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
861 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
862 if ( isObj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
863 for ( name in object ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
864 if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
865 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
866 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
867 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
868 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
869 for ( var value = object[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
870 i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
871 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
872 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
873
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
874 return object;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
875 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
876
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
877 // Use native String.trim function wherever possible
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
878 trim: trim ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
879 function( text ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
880 return text == null ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
881 "" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
882 trim.call( text );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
883 } :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
884
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
885 // Otherwise use our own trimming functionality
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
886 function( text ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
887 return text == null ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
888 "" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
889 text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
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 // results is for internal usage only
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
893 makeArray: function( array, results ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
894 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
895 /// Turns anything into a true array. This is an internal method.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
896 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
897 /// <param name="array" type="Object">Anything to turn into an actual Array</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
898 /// <returns type="Array" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
899 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
900
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
901 var ret = results || [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
902
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
903 if ( array != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
904 // The window, strings (and functions) also have 'length'
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
905 // The extra typeof function check is to prevent crashes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
906 // in Safari 2 (See: #3039)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
907 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
908 var type = jQuery.type(array);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
909
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
910 if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
911 push.call( ret, array );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
912 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
913 jQuery.merge( ret, array );
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 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
918 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
919
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
920 inArray: function( elem, array ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
921 if ( array.indexOf ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
922 return array.indexOf( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
923 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
924
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
925 for ( var i = 0, length = array.length; i < length; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
926 if ( array[ i ] === elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
927 return i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
928 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
929 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
930
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
931 return -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
932 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
933
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
934 merge: function( first, second ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
935 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
936 /// Merge two arrays together, removing all duplicates.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
937 /// The new array is: All the results from the first array, followed
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
938 /// by the unique results from the second array.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
939 /// Part of JavaScript
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
940 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
941 /// <returns type="Array" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
942 /// <param name="first" type="Array">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
943 /// The first array to merge.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
944 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
945 /// <param name="second" type="Array">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
946 /// The second array to merge.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
947 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
948
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
949 var i = first.length,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
950 j = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
951
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
952 if ( typeof second.length === "number" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
953 for ( var l = second.length; j < l; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
954 first[ i++ ] = second[ j ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
955 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
956
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
957 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
958 while ( second[j] !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
959 first[ i++ ] = second[ j++ ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
960 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
961 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
962
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
963 first.length = i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
964
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
965 return first;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
966 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
967
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
968 grep: function( elems, callback, inv ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
969 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
970 /// Filter items out of an array, by using a filter function.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
971 /// The specified function will be passed two arguments: The
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
972 /// current array item and the index of the item in the array. The
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
973 /// function must return 'true' to keep the item in the array,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
974 /// false to remove it.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
975 /// });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
976 /// Part of JavaScript
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
977 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
978 /// <returns type="Array" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
979 /// <param name="elems" type="Array">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
980 /// array The Array to find items in.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
981 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
982 /// <param name="fn" type="Function">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
983 /// The function to process each item against.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
984 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
985 /// <param name="inv" type="Boolean">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
986 /// Invert the selection - select the opposite of the function.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
987 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
988
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
989 var ret = [], retVal;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
990 inv = !!inv;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
991
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
992 // Go through the array, only saving the items
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
993 // that pass the validator function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
994 for ( var i = 0, length = elems.length; i < length; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
995 retVal = !!callback( elems[ i ], i );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
996 if ( inv !== retVal ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
997 ret.push( elems[ i ] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
998 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
999 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1000
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1001 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1002 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1003
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1004 // arg is for internal usage only
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1005 map: function( elems, callback, arg ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1006 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1007 /// Translate all items in an array to another array of items.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1008 /// The translation function that is provided to this method is
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1009 /// called for each item in the array and is passed one argument:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1010 /// The item to be translated.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1011 /// The function can then return the translated value, 'null'
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1012 /// (to remove the item), or an array of values - which will
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1013 /// be flattened into the full array.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1014 /// Part of JavaScript
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1015 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1016 /// <returns type="Array" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1017 /// <param name="elems" type="Array">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1018 /// array The Array to translate.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1019 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1020 /// <param name="fn" type="Function">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1021 /// The function to process each item against.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1022 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1023
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1024 var ret = [], value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1025
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1026 // Go through the array, translating each of the items to their
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1027 // new value (or values).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1028 for ( var i = 0, length = elems.length; i < length; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1029 value = callback( elems[ i ], i, arg );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1030
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1031 if ( value != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1032 ret[ ret.length ] = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1033 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1034 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1035
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1036 return ret.concat.apply( [], ret );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1037 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1038
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1039 // A global GUID counter for objects
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1040 guid: 1,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1041
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1042 proxy: function( fn, proxy, thisObject ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1043 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1044 /// Takes a function and returns a new one that will always have a particular scope.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1045 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1046 /// <param name="fn" type="Function">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1047 /// The function whose scope will be changed.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1048 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1049 /// <param name="proxy" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1050 /// The object to which the scope of the function should be set.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1051 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1052 /// <returns type="Function" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1053
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1054 if ( arguments.length === 2 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1055 if ( typeof proxy === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1056 thisObject = fn;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1057 fn = thisObject[ proxy ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1058 proxy = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1059
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1060 } else if ( proxy && !jQuery.isFunction( proxy ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1061 thisObject = proxy;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1062 proxy = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1063 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1064 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1065
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1066 if ( !proxy && fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1067 proxy = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1068 return fn.apply( thisObject || this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1069 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1070 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1071
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1072 // 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
1073 if ( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1074 proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1075 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1076
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1077 // So proxy can be declared as an argument
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1078 return proxy;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1079 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1080
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1081 // Mutifunctional method to get and set values to a collection
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1082 // The value/s can be optionally by executed if its a function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1083 access: function( elems, key, value, exec, fn, pass ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1084 var length = elems.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1085
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1086 // Setting many attributes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1087 if ( typeof key === "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1088 for ( var k in key ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1089 jQuery.access( elems, k, key[k], exec, fn, value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1090 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1091 return elems;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1092 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1093
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1094 // Setting one attribute
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1095 if ( value !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1096 // Optionally, function values get executed if exec is true
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1097 exec = !pass && exec && jQuery.isFunction(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1098
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1099 for ( var i = 0; i < length; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1100 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
1101 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1102
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1103 return elems;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1104 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1105
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1106 // Getting an attribute
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1107 return length ? fn( elems[0], key ) : undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1108 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1109
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1110 now: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1111 return (new Date()).getTime();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1112 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1113
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1114 // Use of jQuery.browser is frowned upon.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1115 // More details: http://docs.jquery.com/Utilities/jQuery.browser
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1116 uaMatch: function( ua ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1117 ua = ua.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1118
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1119 var match = rwebkit.exec( ua ) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1120 ropera.exec( ua ) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1121 rmsie.exec( ua ) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1122 ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1123 [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1124
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1125 return { browser: match[1] || "", version: match[2] || "0" };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1126 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1127
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1128 browser: {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1129 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1130
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1131 // Populate the class2type map
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1132 jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1133 class2type[ "[object " + name + "]" ] = name.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1134 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1135
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1136 browserMatch = jQuery.uaMatch( userAgent );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1137 if ( browserMatch.browser ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1138 jQuery.browser[ browserMatch.browser ] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1139 jQuery.browser.version = browserMatch.version;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1140 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1141
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1142 // Deprecated, use jQuery.browser.webkit instead
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1143 if ( jQuery.browser.webkit ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1144 jQuery.browser.safari = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1145 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1146
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1147 if ( indexOf ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1148 jQuery.inArray = function( elem, array ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1149 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1150 /// Determines the index of the first parameter in the array.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1151 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1152 /// <param name="elem">The value to see if it exists in the array.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1153 /// <param name="array" type="Array">The array to look through for the value</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1154 /// <returns type="Number" integer="true">The 0-based index of the item if it was found, otherwise -1.</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1155
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1156 return indexOf.call( array, elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1157 };
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 // Verify that \s matches non-breaking spaces
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1161 // (IE fails on this test)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1162 if ( !rwhite.test( "\xA0" ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1163 trimLeft = /^[\s\xA0]+/;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1164 trimRight = /[\s\xA0]+$/;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1165 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1166
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1167 // All jQuery objects should point back to these
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1168 rootjQuery = jQuery(document);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1169
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1170 // Cleanup functions for the document ready method
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1171 if ( document.addEventListener ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1172 DOMContentLoaded = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1173 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1174 jQuery.ready();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1175 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1176
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1177 } else if ( document.attachEvent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1178 DOMContentLoaded = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1179 // 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
1180 if ( document.readyState === "complete" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1181 document.detachEvent( "onreadystatechange", DOMContentLoaded );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1182 jQuery.ready();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1183 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1184 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1185 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1186
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1187 // The DOM ready check for Internet Explorer
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1188 function doScrollCheck() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1189 if ( jQuery.isReady ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1190 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1191 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1192
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1193 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1194 // If IE is used, use the trick by Diego Perini
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1195 // http://javascript.nwbox.com/IEContentLoaded/
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1196 document.documentElement.doScroll("left");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1197 } catch(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1198 setTimeout( doScrollCheck, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1199 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1200 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1201
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1202 // and execute any waiting functions
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1203 jQuery.ready();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1204 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1205
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1206 // Expose jQuery to the global object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1207 return (window.jQuery = window.$ = jQuery);
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1211
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1212
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1213 // [vsdoc] The following function has been modified for IntelliSense.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1214 // [vsdoc] Stubbing support properties to "false" for IntelliSense compat.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1215 (function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1216
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1217 jQuery.support = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1218
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1219 // var root = document.documentElement,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1220 // script = document.createElement("script"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1221 // div = document.createElement("div"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1222 // id = "script" + jQuery.now();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1223
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1224 // div.style.display = "none";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1225 // 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
1226
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1227 // var all = div.getElementsByTagName("*"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1228 // a = div.getElementsByTagName("a")[0],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1229 // select = document.createElement("select"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1230 // opt = select.appendChild( document.createElement("option") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1231
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1232 // // Can't get basic test support
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1233 // if ( !all || !all.length || !a ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1234 // return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1235 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1236
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1237 jQuery.support = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1238 // IE strips leading whitespace when .innerHTML is used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1239 leadingWhitespace: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1240
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1241 // Make sure that tbody elements aren't automatically inserted
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1242 // IE will insert them into empty tables
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1243 tbody: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1244
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1245 // Make sure that link elements get serialized correctly by innerHTML
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1246 // This requires a wrapper element in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1247 htmlSerialize: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1248
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1249 // Get the style information from getAttribute
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1250 // (IE uses .cssText insted)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1251 style: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1252
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1253 // Make sure that URLs aren't manipulated
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1254 // (IE normalizes it by default)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1255 hrefNormalized: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1256
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1257 // Make sure that element opacity exists
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1258 // (IE uses filter instead)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1259 // Use a regex to work around a WebKit issue. See #5145
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1260 opacity: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1261
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1262 // Verify style float existence
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1263 // (IE uses styleFloat instead of cssFloat)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1264 cssFloat: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1265
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1266 // Make sure that if no value is specified for a checkbox
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1267 // that it defaults to "on".
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1268 // (WebKit defaults to "" instead)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1269 checkOn: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1270
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1271 // Make sure that a selected-by-default option has a working selected property.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1272 // (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
1273 optSelected: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1274
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1275 // Will be defined later
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1276 deleteExpando: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1277 optDisabled: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1278 checkClone: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1279 scriptEval: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1280 noCloneEvent: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1281 boxModel: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1282 inlineBlockNeedsLayout: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1283 shrinkWrapBlocks: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1284 reliableHiddenOffsets: true
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1285 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1286
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1287 // // Make sure that the options inside disabled selects aren't marked as disabled
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1288 // // (WebKit marks them as diabled)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1289 // select.disabled = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1290 // jQuery.support.optDisabled = !opt.disabled;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1291
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1292 // script.type = "text/javascript";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1293 // try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1294 // script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1295 // } catch(e) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1296
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1297 // root.insertBefore( script, root.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1298
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1299 // // Make sure that the execution of code works by injecting a script
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1300 // // tag with appendChild/createTextNode
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1301 // // (IE doesn't support this, fails, and uses .text instead)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1302 // if ( window[ id ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1303 // jQuery.support.scriptEval = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1304 // delete window[ id ];
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 // // Test to see if it's possible to delete an expando from an element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1308 // // Fails in Internet Explorer
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1309 // try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1310 // delete script.test;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1311
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1312 // } catch(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1313 // jQuery.support.deleteExpando = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1314 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1315
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1316 // root.removeChild( script );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1317
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1318 // if ( div.attachEvent && div.fireEvent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1319 // div.attachEvent("onclick", function click() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1320 // // Cloning a node shouldn't copy over any
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1321 // // bound event handlers (IE does this)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1322 // jQuery.support.noCloneEvent = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1323 // div.detachEvent("onclick", click);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1324 // });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1325 // div.cloneNode(true).fireEvent("onclick");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1326 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1327
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1328 // div = document.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1329 // div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1330
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1331 // var fragment = document.createDocumentFragment();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1332 // fragment.appendChild( div.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1333
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1334 // // WebKit doesn't clone checked state correctly in fragments
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1335 // jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1336
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1337 // // Figure out if the W3C box model works as expected
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1338 // // document.body must exist before we can do this
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1339 // jQuery(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1340 // var div = document.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1341 // div.style.width = div.style.paddingLeft = "1px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1342
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1343 // document.body.appendChild( div );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1344 // jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1345
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1346 // if ( "zoom" in div.style ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1347 // // Check if natively block-level elements act like inline-block
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1348 // // elements when setting their display to 'inline' and giving
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1349 // // them layout
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1350 // // (IE < 8 does this)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1351 // div.style.display = "inline";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1352 // div.style.zoom = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1353 // jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1354
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1355 // // Check if elements with layout shrink-wrap their children
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1356 // // (IE 6 does this)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1357 // div.style.display = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1358 // div.innerHTML = "<div style='width:4px;'></div>";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1359 // jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1360 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1361
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1362 // 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
1363 // var tds = div.getElementsByTagName("td");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1364
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1365 // // Check if table cells still have offsetWidth/Height when they are set
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1366 // // to display:none and there are still other visible table cells in a
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1367 // // table row; if so, offsetWidth/Height are not reliable for use when
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1368 // // determining if an element has been hidden directly using
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1369 // // display:none (it is still safe to use offsets if a parent element is
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1370 // // hidden; don safety goggles and see bug #4512 for more information).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1371 // // (only IE 8 fails this test)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1372 // jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1373
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1374 // tds[0].style.display = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1375 // tds[1].style.display = "none";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1376
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1377 // // Check if empty table cells still have offsetWidth/Height
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1378 // // (IE < 8 fail this test)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1379 // jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1380 // div.innerHTML = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1381
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1382 // document.body.removeChild( div ).style.display = "none";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1383 // div = tds = null;
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 // // Technique from Juriy Zaytsev
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1387 // // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1388 // var eventSupported = function( eventName ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1389 // var el = document.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1390 // eventName = "on" + eventName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1391
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1392 // var isSupported = (eventName in el);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1393 // if ( !isSupported ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1394 // el.setAttribute(eventName, "return;");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1395 // isSupported = typeof el[eventName] === "function";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1396 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1397 // el = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1398
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1399 // return isSupported;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1400 // };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1401
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1402 jQuery.support.submitBubbles = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1403 jQuery.support.changeBubbles = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1404
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1405 // // release memory in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1406 // root = script = div = all = a = null;
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1411 var windowData = {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1412 rbrace = /^(?:\{.*\}|\[.*\])$/;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1413
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1414 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1415 cache: {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1416
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1417 // Please use with caution
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1418 uuid: 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1419
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1420 // Unique for each copy of jQuery on the page
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1421 expando: "jQuery" + jQuery.now(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1422
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1423 // The following elements throw uncatchable exceptions if you
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1424 // attempt to add expando properties to them.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1425 noData: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1426 "embed": true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1427 // Ban all objects except for Flash (which handle expandos)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1428 "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1429 "applet": true
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 data: function( elem, name, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1433 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1434 /// Store arbitrary data associated with the specified element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1435 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1436 /// <param name="elem" type="Element">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1437 /// The DOM element to associate with the data.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1438 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1439 /// <param name="name" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1440 /// A string naming the piece of data to set.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1441 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1442 /// <param name="value" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1443 /// The new data value.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1444 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1445 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1446
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1447 if ( !jQuery.acceptData( elem ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1448 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1449 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1450
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1451 elem = elem == window ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1452 windowData :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1453 elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1454
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1455 var isNode = elem.nodeType,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1456 id = isNode ? elem[ jQuery.expando ] : null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1457 cache = jQuery.cache, thisCache;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1458
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1459 if ( isNode && !id && typeof name === "string" && data === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1460 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1461 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1462
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1463 // Get the data from the object directly
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1464 if ( !isNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1465 cache = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1466
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1467 // Compute a unique ID for the element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1468 } else if ( !id ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1469 elem[ jQuery.expando ] = id = ++jQuery.uuid;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1470 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1471
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1472 // Avoid generating a new cache unless none exists and we
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1473 // want to manipulate it.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1474 if ( typeof name === "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1475 if ( isNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1476 cache[ id ] = jQuery.extend(cache[ id ], name);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1477
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1478 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1479 jQuery.extend( cache, name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1480 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1481
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1482 } else if ( isNode && !cache[ id ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1483 cache[ id ] = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1484 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1485
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1486 thisCache = isNode ? cache[ id ] : cache;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1487
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1488 // Prevent overriding the named cache with undefined values
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1489 if ( data !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1490 thisCache[ name ] = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1491 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1492
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1493 return typeof name === "string" ? thisCache[ name ] : thisCache;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1494 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1495
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1496 removeData: function( elem, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1497 if ( !jQuery.acceptData( elem ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1498 return;
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 elem = elem == window ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1502 windowData :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1503 elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1504
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1505 var isNode = elem.nodeType,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1506 id = isNode ? elem[ jQuery.expando ] : elem,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1507 cache = jQuery.cache,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1508 thisCache = isNode ? cache[ id ] : id;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1509
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1510 // If we want to remove a specific section of the element's data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1511 if ( name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1512 if ( thisCache ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1513 // Remove the section of cache data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1514 delete thisCache[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1515
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1516 // If we've removed all the data, remove the element's cache
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1517 if ( isNode && jQuery.isEmptyObject(thisCache) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1518 jQuery.removeData( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1519 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1520 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1521
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1522 // Otherwise, we want to remove all of the element's data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1523 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1524 if ( isNode && jQuery.support.deleteExpando ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1525 delete elem[ jQuery.expando ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1526
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1527 } else if ( elem.removeAttribute ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1528 elem.removeAttribute( jQuery.expando );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1529
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1530 // Completely remove the data cache
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1531 } else if ( isNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1532 delete cache[ id ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1533
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1534 // Remove all fields from the object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1535 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1536 for ( var n in elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1537 delete elem[ n ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1538 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1539 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1540 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1541 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1542
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1543 // A method for determining if a DOM node can handle the data expando
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1544 acceptData: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1545 if ( elem.nodeName ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1546 var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1547
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1548 if ( match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1549 return !(match === true || elem.getAttribute("classid") !== match);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1550 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1551 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1552
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1553 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1554 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1555 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1556
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1557 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1558 data: function( key, value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1559 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1560 /// Store arbitrary data associated with the matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1561 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1562 /// <param name="key" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1563 /// A string naming the piece of data to set.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1564 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1565 /// <param name="value" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1566 /// The new data value.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1567 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1568 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1569
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1570 var data = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1571
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1572 if ( typeof key === "undefined" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1573 if ( this.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1574 var attr = this[0].attributes, name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1575 data = jQuery.data( this[0] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1576
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1577 for ( var i = 0, l = attr.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1578 name = attr[i].name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1579
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1580 if ( name.indexOf( "data-" ) === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1581 name = name.substr( 5 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1582 dataAttr( this[0], name, data[ name ] );
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 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1586
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1587 return data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1588
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1589 } else if ( typeof key === "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1590 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1591 jQuery.data( this, key );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1592 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1593 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1594
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1595 var parts = key.split(".");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1596 parts[1] = parts[1] ? "." + parts[1] : "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1597
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1598 if ( value === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1599 data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1600
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1601 // Try to fetch any internally stored data first
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1602 if ( data === undefined && this.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1603 data = jQuery.data( this[0], key );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1604 data = dataAttr( this[0], key, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1605 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1606
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1607 return data === undefined && parts[1] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1608 this.data( parts[0] ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1609 data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1610
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1611 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1612 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1613 var $this = jQuery( this ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1614 args = [ parts[0], value ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1615
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1616 $this.triggerHandler( "setData" + parts[1] + "!", args );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1617 jQuery.data( this, key, value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1618 $this.triggerHandler( "changeData" + parts[1] + "!", args );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1619 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1620 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1621 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1622
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1623 removeData: function( key ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1624 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1625 jQuery.removeData( this, key );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1626 });
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 function dataAttr( elem, key, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1631 // If nothing was found internally, try to fetch any
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1632 // data from the HTML5 data-* attribute
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1633 if ( data === undefined && elem.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1634 data = elem.getAttribute( "data-" + key );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1635
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1636 if ( typeof data === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1637 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1638 data = data === "true" ? true :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1639 data === "false" ? false :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1640 data === "null" ? null :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1641 !jQuery.isNaN( data ) ? parseFloat( data ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1642 rbrace.test( data ) ? jQuery.parseJSON( data ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1643 data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1644 } catch( e ) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1645
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1646 // Make sure we set the data so it isn't changed later
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1647 jQuery.data( elem, key, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1648
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1649 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1650 data = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1651 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1652 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1653
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1654 return data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1655 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1656
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1657
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 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1661 queue: function( elem, type, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1662 if ( !elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1663 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1664 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1665
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1666 type = (type || "fx") + "queue";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1667 var q = jQuery.data( elem, type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1668
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1669 // Speed up dequeue by getting out quickly if this is just a lookup
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1670 if ( !data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1671 return q || [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1672 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1673
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1674 if ( !q || jQuery.isArray(data) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1675 q = jQuery.data( elem, type, jQuery.makeArray(data) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1676
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1677 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1678 q.push( data );
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 return q;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1682 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1683
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1684 dequeue: function( elem, type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1685 type = type || "fx";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1686
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1687 var queue = jQuery.queue( elem, type ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1688 fn = queue.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1689
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1690 // If the fx queue is dequeued, always remove the progress sentinel
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1691 if ( fn === "inprogress" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1692 fn = queue.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1693 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1694
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1695 if ( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1696 // Add a progress sentinel to prevent the fx queue from being
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1697 // automatically dequeued
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1698 if ( type === "fx" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1699 queue.unshift("inprogress");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1700 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1701
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1702 fn.call(elem, function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1703 jQuery.dequeue(elem, type);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1704 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1705 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1706 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1707 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1708
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1709 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1710 queue: function( type, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1711 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1712 /// 1: queue() - Returns a reference to the first element's queue (which is an array of functions).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1713 /// 2: queue(callback) - Adds a new function, to be executed, onto the end of the queue of all matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1714 /// 3: queue(queue) - Replaces the queue of all matched element with this new queue (the array of functions).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1715 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1716 /// <param name="type" type="Function">The function to add to the queue.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1717 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1718
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1719 if ( typeof type !== "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1720 data = type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1721 type = "fx";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1722 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1723
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1724 if ( data === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1725 return jQuery.queue( this[0], type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1726 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1727 return this.each(function( i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1728 var queue = jQuery.queue( this, type, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1729
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1730 if ( type === "fx" && queue[0] !== "inprogress" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1731 jQuery.dequeue( this, type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1732 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1733 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1734 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1735 dequeue: function( type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1736 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1737 /// Removes a queued function from the front of the queue and executes it.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1738 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1739 /// <param name="type" type="String" optional="true">The type of queue to access.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1740 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1741
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1742 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1743 jQuery.dequeue( this, type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1744 });
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 // Based off of the plugin by Clint Helfers, with permission.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1748 // http://blindsignals.com/index.php/2009/07/jquery-delay/
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1749 delay: function( time, type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1750 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1751 /// Set a timer to delay execution of subsequent items in the queue.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1752 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1753 /// <param name="time" type="Number">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1754 /// An integer indicating the number of milliseconds to delay execution of the next item in the queue.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1755 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1756 /// <param name="type" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1757 /// A string containing the name of the queue. Defaults to fx, the standard effects queue.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1758 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1759 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1760
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1761 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1762 type = type || "fx";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1763
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1764 return this.queue( type, function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1765 var elem = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1766 setTimeout(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1767 jQuery.dequeue( elem, type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1768 }, time );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1769 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1770 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1771
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1772 clearQueue: function( type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1773 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1774 /// Remove from the queue all items that have not yet been run.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1775 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1776 /// <param name="type" type="String" optional="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1777 /// A string containing the name of the queue. Defaults to fx, the standard effects queue.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1778 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1779 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1780
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1781 return this.queue( type || "fx", [] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1782 }
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1786
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1787
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1788 var rclass = /[\n\t]/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1789 rspaces = /\s+/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1790 rreturn = /\r/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1791 rspecialurl = /^(?:href|src|style)$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1792 rtype = /^(?:button|input)$/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1793 rfocusable = /^(?:button|input|object|select|textarea)$/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1794 rclickable = /^a(?:rea)?$/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1795 rradiocheck = /^(?:radio|checkbox)$/i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1796
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1797 jQuery.props = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1798 "for": "htmlFor",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1799 "class": "className",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1800 readonly: "readOnly",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1801 maxlength: "maxLength",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1802 cellspacing: "cellSpacing",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1803 rowspan: "rowSpan",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1804 colspan: "colSpan",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1805 tabindex: "tabIndex",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1806 usemap: "useMap",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1807 frameborder: "frameBorder"
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1808 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1809
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1810 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1811 attr: function( name, value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1812 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1813 /// Set a single property to a computed value, on all matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1814 /// Instead of a value, a function is provided, that computes the value.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1815 /// Part of DOM/Attributes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1816 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1817 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1818 /// <param name="name" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1819 /// The name of the property to set.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1820 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1821 /// <param name="value" type="Function">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1822 /// A function returning the value to set.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1823 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1824
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1825 return jQuery.access( this, name, value, true, jQuery.attr );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1826 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1827
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1828 removeAttr: function( name, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1829 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1830 /// Remove an attribute from each of the matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1831 /// Part of DOM/Attributes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1832 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1833 /// <param name="name" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1834 /// An attribute to remove.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1835 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1836 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1837
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1838 return this.each(function(){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1839 jQuery.attr( this, name, "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1840 if ( this.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1841 this.removeAttribute( name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1842 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1843 });
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 addClass: function( value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1847 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1848 /// Adds the specified class(es) to each of the set of matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1849 /// Part of DOM/Attributes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1850 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1851 /// <param name="value" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1852 /// One or more class names to be added to the class attribute of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1853 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1854 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1855
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1856 if ( jQuery.isFunction(value) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1857 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1858 var self = jQuery(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1859 self.addClass( value.call(this, i, self.attr("class")) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1860 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1861 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1862
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1863 if ( value && typeof value === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1864 var classNames = (value || "").split( rspaces );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1865
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1866 for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1867 var elem = this[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1868
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1869 if ( elem.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1870 if ( !elem.className ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1871 elem.className = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1872
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1873 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1874 var className = " " + elem.className + " ",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1875 setClass = elem.className;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1876
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1877 for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1878 if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1879 setClass += " " + classNames[c];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1880 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1881 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1882 elem.className = jQuery.trim( setClass );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1883 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1884 }
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1888 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1889 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1890
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1891 removeClass: function( value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1892 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1893 /// Removes all or the specified class(es) from the set of matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1894 /// Part of DOM/Attributes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1895 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1896 /// <param name="value" type="String" optional="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1897 /// (Optional) A class name to be removed from the class attribute of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1898 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1899 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1900
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1901 if ( jQuery.isFunction(value) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1902 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1903 var self = jQuery(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1904 self.removeClass( value.call(this, i, self.attr("class")) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1905 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1906 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1907
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1908 if ( (value && typeof value === "string") || value === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1909 var classNames = (value || "").split( rspaces );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1910
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1911 for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1912 var elem = this[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1913
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1914 if ( elem.nodeType === 1 && elem.className ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1915 if ( value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1916 var className = (" " + elem.className + " ").replace(rclass, " ");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1917 for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1918 className = className.replace(" " + classNames[c] + " ", " ");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1919 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1920 elem.className = jQuery.trim( className );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1921
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1922 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1923 elem.className = "";
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 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1927 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1928
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1929 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1930 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1931
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1932 toggleClass: function( value, stateVal ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1933 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1934 /// Add or remove a class from each element in the set of matched elements, depending
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1935 /// on either the class's presence or the value of the switch argument.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1936 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1937 /// <param name="value" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1938 /// A class name to be toggled for each element in the matched set.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1939 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1940 /// <param name="stateVal" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1941 /// A boolean value to determine whether the class should be added or removed.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1942 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1943 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1944
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1945 var type = typeof value,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1946 isBool = typeof stateVal === "boolean";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1947
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1948 if ( jQuery.isFunction( value ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1949 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1950 var self = jQuery(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1951 self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1952 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1953 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1954
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1955 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1956 if ( type === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1957 // toggle individual class names
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1958 var className,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1959 i = 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1960 self = jQuery( this ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1961 state = stateVal,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1962 classNames = value.split( rspaces );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1963
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1964 while ( (className = classNames[ i++ ]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1965 // check each className given, space seperated list
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1966 state = isBool ? state : !self.hasClass( className );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1967 self[ state ? "addClass" : "removeClass" ]( className );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1968 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1969
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1970 } else if ( type === "undefined" || type === "boolean" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1971 if ( this.className ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1972 // store className if set
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1973 jQuery.data( this, "__className__", this.className );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1974 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1975
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1976 // toggle whole className
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1977 this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1978 }
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1982 hasClass: function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1983 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1984 /// Checks the current selection against a class and returns whether at least one selection has a given class.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1985 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1986 /// <param name="selector" type="String">The class to check against</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1987 /// <returns type="Boolean">True if at least one element in the selection has the class, otherwise false.</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1988
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1989 var className = " " + selector + " ";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1990 for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1991 if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1992 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1993 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1994 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1995
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1996 return false;
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 val: function( value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2000 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2001 /// Set the value of every matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2002 /// Part of DOM/Attributes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2003 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2004 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2005 /// <param name="value" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2006 /// A string of text or an array of strings to set as the value property of each
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2007 /// matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2008 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2009
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2010 if ( !arguments.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2011 var elem = this[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2012
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2013 if ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2014 if ( jQuery.nodeName( elem, "option" ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2015 // attributes.value is undefined in Blackberry 4.7 but
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2016 // uses .value. See #6932
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2017 var val = elem.attributes.value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2018 return !val || val.specified ? elem.value : elem.text;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2019 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2020
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2021 // We need to handle select boxes special
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2022 if ( jQuery.nodeName( elem, "select" ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2023 var index = elem.selectedIndex,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2024 values = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2025 options = elem.options,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2026 one = elem.type === "select-one";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2027
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2028 // Nothing was selected
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2029 if ( index < 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2030 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2031 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2032
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2033 // Loop through all the selected options
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2034 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
2035 var option = options[ i ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2036
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2037 // Don't return options that are disabled or in a disabled optgroup
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2038 if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2039 (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2040
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2041 // Get the specific value for the option
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2042 value = jQuery(option).val();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2043
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2044 // We don't need an array for one selects
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2045 if ( one ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2046 return value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2047 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2048
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2049 // Multi-Selects return an array
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2050 values.push( value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2051 }
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 return values;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2055 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2056
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2057 // 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
2058 if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2059 return elem.getAttribute("value") === null ? "on" : elem.value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2060 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2061
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2062
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2063 // Everything else, we just grab the value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2064 return (elem.value || "").replace(rreturn, "");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2065
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2066 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2067
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2068 return undefined;
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 var isFunction = jQuery.isFunction(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2072
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2073 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2074 var self = jQuery(this), val = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2075
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2076 if ( this.nodeType !== 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2077 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2078 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2079
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2080 if ( isFunction ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2081 val = value.call(this, i, self.val());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2082 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2083
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2084 // Treat null/undefined as ""; convert numbers to string
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2085 if ( val == null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2086 val = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2087 } else if ( typeof val === "number" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2088 val += "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2089 } else if ( jQuery.isArray(val) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2090 val = jQuery.map(val, function (value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2091 return value == null ? "" : value + "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2092 });
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 if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2096 this.checked = jQuery.inArray( self.val(), val ) >= 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2097
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2098 } else if ( jQuery.nodeName( this, "select" ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2099 var values = jQuery.makeArray(val);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2100
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2101 jQuery( "option", this ).each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2102 this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
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 if ( !values.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2106 this.selectedIndex = -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2107 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2108
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2109 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2110 this.value = val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2111 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2112 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2113 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2114 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2115
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2116 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2117 attrFn: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2118 val: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2119 css: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2120 html: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2121 text: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2122 data: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2123 width: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2124 height: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2125 offset: true
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2126 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2127
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2128 attr: function( elem, name, value, pass ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2129 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2130 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2131 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2132 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2133
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2134 // don't set attributes on text and comment nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2135 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2136 return undefined;
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 if ( pass && name in jQuery.attrFn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2140 return jQuery(elem)[name](value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2141 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2142
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2143 var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2144 // Whether we are setting (or getting)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2145 set = value !== undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2146
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2147 // Try to normalize/fix the name
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2148 name = notxml && jQuery.props[ name ] || name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2149
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2150 // These attributes require special treatment
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2151 var special = rspecialurl.test( name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2152
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2153 // Safari mis-reports the default selected property of an option
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2154 // Accessing the parent's selectedIndex property fixes it
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2155 if ( name === "selected" && !jQuery.support.optSelected ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2156 var parent = elem.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2157 if ( parent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2158 parent.selectedIndex;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2159
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2160 // Make sure that it also works with optgroups, see #5701
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2161 if ( parent.parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2162 parent.parentNode.selectedIndex;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2163 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2164 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2165 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2166
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2167 // If applicable, access the attribute via the DOM 0 way
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2168 // 'in' checks fail in Blackberry 4.7 #6931
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2169 if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2170 if ( set ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2171 // 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
2172 if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2173 jQuery.error( "type property can't be changed" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2174 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2175
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2176 if ( value === null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2177 if ( elem.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2178 elem.removeAttribute( name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2179 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2180
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2181 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2182 elem[ name ] = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2183 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2184 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2185
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2186 // browsers index elements by id/name on forms, give priority to attributes.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2187 if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2188 return elem.getAttributeNode( name ).nodeValue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2189 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2190
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2191 // 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
2192 // 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
2193 if ( name === "tabIndex" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2194 var attributeNode = elem.getAttributeNode( "tabIndex" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2195
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2196 return attributeNode && attributeNode.specified ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2197 attributeNode.value :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2198 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2199 0 :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2200 undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2201 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2202
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2203 return elem[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2204 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2205
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2206 if ( !jQuery.support.style && notxml && name === "style" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2207 if ( set ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2208 elem.style.cssText = "" + value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2209 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2210
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2211 return elem.style.cssText;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2212 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2213
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2214 if ( set ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2215 // convert the value to a string (all browsers do this but IE) see #1070
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2216 elem.setAttribute( name, "" + value );
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 // Ensure that missing attributes return undefined
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2220 // Blackberry 4.7 returns "" from getAttribute #6938
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2221 if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2222 return undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2223 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2224
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2225 var attr = !jQuery.support.hrefNormalized && notxml && special ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2226 // Some attributes require a special call on IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2227 elem.getAttribute( name, 2 ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2228 elem.getAttribute( name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2229
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2230 // Non-existent attributes return null, we normalize to undefined
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2231 return attr === null ? undefined : attr;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2232 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2233 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2234
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2235
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2236
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2237
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2238 var rnamespaces = /\.(.*)$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2239 rformElems = /^(?:textarea|input|select)$/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2240 rperiod = /\./g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2241 rspace = / /g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2242 rescape = /[^\w\s.|`]/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2243 fcleanup = function( nm ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2244 return nm.replace(rescape, "\\$&");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2245 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2246 focusCounts = { focusin: 0, focusout: 0 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2247
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2248 /*
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2249 * A number of helper functions used for managing events.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2250 * Many of the ideas behind this code originated from
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2251 * Dean Edwards' addEvent library.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2252 */
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2253 jQuery.event = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2254
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2255 // Bind an event to an element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2256 // Original by Dean Edwards
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2257 add: function( elem, types, handler, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2258 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2259 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2260 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2261 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2262
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2263 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2264 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2265 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2266
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2267 // For whatever reason, IE has trouble passing the window object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2268 // around, causing it to be cloned in the process
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2269 if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2270 elem = window;
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 if ( handler === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2274 handler = returnFalse;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2275 } else if ( !handler ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2276 // Fixes bug #7229. Fix recommended by jdalton
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2277 return;
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 var handleObjIn, handleObj;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2281
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2282 if ( handler.handler ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2283 handleObjIn = handler;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2284 handler = handleObjIn.handler;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2285 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2286
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2287 // Make sure that the function being executed has a unique ID
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2288 if ( !handler.guid ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2289 handler.guid = jQuery.guid++;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2290 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2291
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2292 // Init the element's event structure
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2293 var elemData = jQuery.data( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2294
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2295 // 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
2296 // banned noData elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2297 if ( !elemData ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2298 return;
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 // Use a key less likely to result in collisions for plain JS objects.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2302 // Fixes bug #7150.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2303 var eventKey = elem.nodeType ? "events" : "__events__",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2304 events = elemData[ eventKey ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2305 eventHandle = elemData.handle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2306
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2307 if ( typeof events === "function" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2308 // On plain objects events is a fn that holds the the data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2309 // which prevents this data from being JSON serialized
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2310 // the function does not need to be called, it just contains the data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2311 eventHandle = events.handle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2312 events = events.events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2313
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2314 } else if ( !events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2315 if ( !elem.nodeType ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2316 // On plain objects, create a fn that acts as the holder
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2317 // of the values to avoid JSON serialization of event data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2318 elemData[ eventKey ] = elemData = function(){};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2319 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2320
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2321 elemData.events = events = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2322 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2323
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2324 if ( !eventHandle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2325 elemData.handle = eventHandle = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2326 // Handle the second event of a trigger and when
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2327 // an event is called after a page has unloaded
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2328 return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2329 jQuery.event.handle.apply( eventHandle.elem, arguments ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2330 undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2331 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2332 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2333
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2334 // Add elem as a property of the handle function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2335 // This is to prevent a memory leak with non-native events in IE.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2336 eventHandle.elem = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2337
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2338 // Handle multiple events separated by a space
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2339 // jQuery(...).bind("mouseover mouseout", fn);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2340 types = types.split(" ");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2341
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2342 var type, i = 0, namespaces;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2343
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2344 while ( (type = types[ i++ ]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2345 handleObj = handleObjIn ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2346 jQuery.extend({}, handleObjIn) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2347 { handler: handler, data: data };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2348
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2349 // Namespaced event handlers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2350 if ( type.indexOf(".") > -1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2351 namespaces = type.split(".");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2352 type = namespaces.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2353 handleObj.namespace = namespaces.slice(0).sort().join(".");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2354
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2355 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2356 namespaces = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2357 handleObj.namespace = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2358 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2359
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2360 handleObj.type = type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2361 if ( !handleObj.guid ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2362 handleObj.guid = 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 // Get the current list of functions bound to this event
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2366 var handlers = events[ type ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2367 special = jQuery.event.special[ type ] || {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2368
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2369 // Init the event handler queue
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2370 if ( !handlers ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2371 handlers = events[ type ] = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2372
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2373 // Check for a special event handler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2374 // Only use addEventListener/attachEvent if the special
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2375 // events handler returns false
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2376 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2377 // Bind the global event handler to the element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2378 if ( elem.addEventListener ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2379 elem.addEventListener( type, eventHandle, false );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2380
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2381 } else if ( elem.attachEvent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2382 elem.attachEvent( "on" + type, eventHandle );
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 if ( special.add ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2388 special.add.call( elem, handleObj );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2389
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2390 if ( !handleObj.handler.guid ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2391 handleObj.handler.guid = handler.guid;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2392 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2393 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2394
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2395 // Add the function to the element's handler list
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2396 handlers.push( handleObj );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2397
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2398 // Keep track of which events have been used, for global triggering
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2399 jQuery.event.global[ type ] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2400 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2401
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2402 // Nullify elem to prevent memory leaks in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2403 elem = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2404 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2405
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2406 global: {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2407
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2408 // Detach an event or set of events from an element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2409 remove: function( elem, types, handler ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2410 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2411 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2412 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2413 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2414
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2415 // don't do events on text and comment nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2416 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2417 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2418 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2419
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2420 if ( handler === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2421 handler = returnFalse;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2422 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2423
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2424 var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2425 eventKey = elem.nodeType ? "events" : "__events__",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2426 elemData = jQuery.data( elem ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2427 events = elemData && elemData[ eventKey ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2428
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2429 if ( !elemData || !events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2430 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2431 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2432
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2433 if ( typeof events === "function" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2434 elemData = events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2435 events = events.events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2436 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2437
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2438 // types is actually an event object here
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2439 if ( types && types.type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2440 handler = types.handler;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2441 types = types.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2442 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2443
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2444 // Unbind all events for the element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2445 if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2446 types = types || "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2447
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2448 for ( type in events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2449 jQuery.event.remove( elem, type + types );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2450 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2451
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2452 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2453 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2454
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2455 // Handle multiple events separated by a space
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2456 // jQuery(...).unbind("mouseover mouseout", fn);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2457 types = types.split(" ");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2458
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2459 while ( (type = types[ i++ ]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2460 origType = type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2461 handleObj = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2462 all = type.indexOf(".") < 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2463 namespaces = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2464
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2465 if ( !all ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2466 // Namespaced event handlers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2467 namespaces = type.split(".");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2468 type = namespaces.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2469
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2470 namespace = new RegExp("(^|\\.)" +
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2471 jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2472 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2473
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2474 eventType = events[ type ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2475
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2476 if ( !eventType ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2477 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2478 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2479
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2480 if ( !handler ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2481 for ( j = 0; j < eventType.length; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2482 handleObj = eventType[ j ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2483
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2484 if ( all || namespace.test( handleObj.namespace ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2485 jQuery.event.remove( elem, origType, handleObj.handler, j );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2486 eventType.splice( j--, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2487 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2488 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2489
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2490 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2491 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2492
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2493 special = jQuery.event.special[ type ] || {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2494
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2495 for ( j = pos || 0; j < eventType.length; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2496 handleObj = eventType[ j ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2497
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2498 if ( handler.guid === handleObj.guid ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2499 // remove the given handler for the given type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2500 if ( all || namespace.test( handleObj.namespace ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2501 if ( pos == null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2502 eventType.splice( j--, 1 );
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 if ( special.remove ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2506 special.remove.call( elem, handleObj );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2507 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2508 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2509
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2510 if ( pos != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2511 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2512 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2513 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2514 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2515
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2516 // remove generic event handler if no more handlers exist
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2517 if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2518 if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2519 jQuery.removeEvent( elem, type, elemData.handle );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2520 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2521
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2522 ret = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2523 delete events[ type ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2524 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2525 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2526
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2527 // Remove the expando if it's no longer used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2528 if ( jQuery.isEmptyObject( events ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2529 var handle = elemData.handle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2530 if ( handle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2531 handle.elem = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2532 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2533
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2534 delete elemData.events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2535 delete elemData.handle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2536
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2537 if ( typeof elemData === "function" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2538 jQuery.removeData( elem, eventKey );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2539
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2540 } else if ( jQuery.isEmptyObject( elemData ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2541 jQuery.removeData( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2542 }
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 // bubbling is internal
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2547 trigger: function( event, data, elem /*, bubbling */ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2548 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2549 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2550 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2551 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2552
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2553 // Event object or event type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2554 var type = event.type || event,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2555 bubbling = arguments[3];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2556
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2557 if ( !bubbling ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2558 event = typeof event === "object" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2559 // jQuery.Event object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2560 event[ jQuery.expando ] ? event :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2561 // Object literal
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2562 jQuery.extend( jQuery.Event(type), event ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2563 // Just the event type (string)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2564 jQuery.Event(type);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2565
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2566 if ( type.indexOf("!") >= 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2567 event.type = type = type.slice(0, -1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2568 event.exclusive = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2569 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2570
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2571 // Handle a global trigger
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2572 if ( !elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2573 // Don't bubble custom events when global (to avoid too much overhead)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2574 event.stopPropagation();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2575
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2576 // Only trigger if we've ever bound an event for it
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2577 if ( jQuery.event.global[ type ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2578 jQuery.each( jQuery.cache, function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2579 if ( this.events && this.events[type] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2580 jQuery.event.trigger( event, data, this.handle.elem );
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 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2584 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2585
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2586 // Handle triggering a single element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2587
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2588 // don't do events on text and comment nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2589 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2590 return undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2591 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2592
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2593 // Clean up in case it is reused
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2594 event.result = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2595 event.target = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2596
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2597 // Clone the incoming data, if any
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2598 data = jQuery.makeArray( data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2599 data.unshift( event );
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 event.currentTarget = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2603
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2604 // Trigger the event, it is assumed that "handle" is a function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2605 var handle = elem.nodeType ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2606 jQuery.data( elem, "handle" ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2607 (jQuery.data( elem, "__events__" ) || {}).handle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2608
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2609 if ( handle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2610 handle.apply( elem, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2611 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2612
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2613 var parent = elem.parentNode || elem.ownerDocument;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2614
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2615 // Trigger an inline bound script
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2616 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2617 if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2618 if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2619 event.result = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2620 event.preventDefault();
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2624 // 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
2625 } catch (inlineError) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2626
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2627 if ( !event.isPropagationStopped() && parent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2628 jQuery.event.trigger( event, data, parent, true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2629
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2630 } else if ( !event.isDefaultPrevented() ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2631 var old,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2632 target = event.target,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2633 targetType = type.replace( rnamespaces, "" ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2634 isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2635 special = jQuery.event.special[ targetType ] || {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2636
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2637 if ( (!special._default || special._default.call( elem, event ) === false) &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2638 !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2639
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2640 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2641 if ( target[ targetType ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2642 // Make sure that we don't accidentally re-trigger the onFOO events
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2643 old = target[ "on" + targetType ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2644
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2645 if ( old ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2646 target[ "on" + targetType ] = null;
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 jQuery.event.triggered = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2650 target[ targetType ]();
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 // 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
2654 } catch (triggerError) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2655
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2656 if ( old ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2657 target[ "on" + targetType ] = old;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2658 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2659
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2660 jQuery.event.triggered = false;
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 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2664
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2665 handle: function( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2666 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2667 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2668 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2669 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2670
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2671 var all, handlers, namespaces, namespace_re, events,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2672 namespace_sort = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2673 args = jQuery.makeArray( arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2674
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2675 event = args[0] = jQuery.event.fix( event || window.event );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2676 event.currentTarget = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2677
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2678 // Namespaced event handlers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2679 all = event.type.indexOf(".") < 0 && !event.exclusive;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2680
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2681 if ( !all ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2682 namespaces = event.type.split(".");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2683 event.type = namespaces.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2684 namespace_sort = namespaces.slice(0).sort();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2685 namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");
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 event.namespace = event.namespace || namespace_sort.join(".");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2689
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2690 events = jQuery.data(this, this.nodeType ? "events" : "__events__");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2691
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2692 if ( typeof events === "function" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2693 events = events.events;
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 handlers = (events || {})[ event.type ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2697
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2698 if ( events && handlers ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2699 // Clone the handlers to prevent manipulation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2700 handlers = handlers.slice(0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2701
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2702 for ( var j = 0, l = handlers.length; j < l; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2703 var handleObj = handlers[ j ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2704
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2705 // Filter the functions by class
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2706 if ( all || namespace_re.test( handleObj.namespace ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2707 // Pass in a reference to the handler function itself
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2708 // So that we can later remove it
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2709 event.handler = handleObj.handler;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2710 event.data = handleObj.data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2711 event.handleObj = handleObj;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2712
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2713 var ret = handleObj.handler.apply( this, args );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2714
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2715 if ( ret !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2716 event.result = ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2717 if ( ret === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2718 event.preventDefault();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2719 event.stopPropagation();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2720 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2721 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2722
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2723 if ( event.isImmediatePropagationStopped() ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2724 break;
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 }
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 return event.result;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2731 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2732
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2733 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
2734
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2735 fix: function( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2736 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2737 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2738 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2739 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2740
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2741 if ( event[ jQuery.expando ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2742 return event;
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 // store a copy of the original event object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2746 // and "clone" to set read-only properties
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2747 var originalEvent = event;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2748 event = jQuery.Event( originalEvent );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2749
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2750 for ( var i = this.props.length, prop; i; ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2751 prop = this.props[ --i ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2752 event[ prop ] = originalEvent[ prop ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2753 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2754
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2755 // Fix target property, if necessary
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2756 if ( !event.target ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2757 // Fixes #1925 where srcElement might not be defined either
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2758 event.target = event.srcElement || document;
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 // check if target is a textnode (safari)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2762 if ( event.target.nodeType === 3 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2763 event.target = event.target.parentNode;
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 // Add relatedTarget, if necessary
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2767 if ( !event.relatedTarget && event.fromElement ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2768 event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2769 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2770
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2771 // Calculate pageX/Y if missing and clientX/Y available
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2772 if ( event.pageX == null && event.clientX != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2773 var doc = document.documentElement,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2774 body = document.body;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2775
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2776 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
2777 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
2778 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2779
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2780 // Add which for key events
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2781 if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2782 event.which = event.charCode != null ? event.charCode : event.keyCode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2783 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2784
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2785 // 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
2786 if ( !event.metaKey && event.ctrlKey ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2787 event.metaKey = event.ctrlKey;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2788 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2789
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2790 // Add which for click: 1 === left; 2 === middle; 3 === right
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2791 // Note: button is not normalized, so don't use it
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2792 if ( !event.which && event.button !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2793 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
2794 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2795
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2796 return event;
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 // Deprecated, use jQuery.guid instead
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2800 guid: 1E8,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2801
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2802 // Deprecated, use jQuery.proxy instead
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2803 proxy: jQuery.proxy,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2804
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2805 special: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2806 ready: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2807 // Make sure the ready event is setup
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2808 setup: jQuery.bindReady,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2809 teardown: jQuery.noop
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 live: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2813 add: function( handleObj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2814 jQuery.event.add( this,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2815 liveConvert( handleObj.origType, handleObj.selector ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2816 jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2817 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2818
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2819 remove: function( handleObj ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2820 jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2824 beforeunload: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2825 setup: function( data, namespaces, eventHandle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2826 // We only want to do this special case on windows
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2827 if ( jQuery.isWindow( this ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2828 this.onbeforeunload = eventHandle;
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2832 teardown: function( namespaces, eventHandle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2833 if ( this.onbeforeunload === eventHandle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2834 this.onbeforeunload = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2835 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2836 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2837 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2838 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2839 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2840
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2841 jQuery.removeEvent = document.removeEventListener ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2842 function( elem, type, handle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2843 if ( elem.removeEventListener ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2844 elem.removeEventListener( type, handle, false );
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 function( elem, type, handle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2848 if ( elem.detachEvent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2849 elem.detachEvent( "on" + type, handle );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2850 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2851 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2852
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2853 jQuery.Event = function( src ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2854 // Allow instantiation without the 'new' keyword
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2855 if ( !this.preventDefault ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2856 return new jQuery.Event( src );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2857 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2858
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2859 // Event object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2860 if ( src && src.type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2861 this.originalEvent = src;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2862 this.type = src.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2863 // Event type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2864 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2865 this.type = src;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2866 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2867
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2868 // timeStamp is buggy for some events on Firefox(#3843)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2869 // So we won't rely on the native value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2870 this.timeStamp = jQuery.now();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2871
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2872 // Mark it as fixed
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2873 this[ jQuery.expando ] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2874 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2875
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2876 function returnFalse() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2877 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2878 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2879 function returnTrue() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2880 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2881 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2882
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2883 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2884 // 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
2885 jQuery.Event.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2886 preventDefault: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2887 this.isDefaultPrevented = returnTrue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2888
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2889 var e = this.originalEvent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2890 if ( !e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2891 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2892 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2893
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2894 // if preventDefault exists run it on the original event
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2895 if ( e.preventDefault ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2896 e.preventDefault();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2897
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2898 // otherwise set the returnValue property of the original event to false (IE)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2899 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2900 e.returnValue = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2901 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2902 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2903 stopPropagation: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2904 this.isPropagationStopped = returnTrue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2905
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2906 var e = this.originalEvent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2907 if ( !e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2908 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2909 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2910 // if stopPropagation exists run it on the original event
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2911 if ( e.stopPropagation ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2912 e.stopPropagation();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2913 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2914 // otherwise set the cancelBubble property of the original event to true (IE)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2915 e.cancelBubble = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2916 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2917 stopImmediatePropagation: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2918 this.isImmediatePropagationStopped = returnTrue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2919 this.stopPropagation();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2920 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2921 isDefaultPrevented: returnFalse,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2922 isPropagationStopped: returnFalse,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2923 isImmediatePropagationStopped: returnFalse
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 // Checks if an event happened on an element within another element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2927 // Used in jQuery.event.special.mouseenter and mouseleave handlers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2928 var withinElement = function( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2929 // Check if mouse(over|out) are still within the same parent element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2930 var parent = event.relatedTarget;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2931
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2932 // Firefox sometimes assigns relatedTarget a XUL element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2933 // which we cannot access the parentNode property of
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2934 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2935 // Traverse up the tree
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2936 while ( parent && parent !== this ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2937 parent = parent.parentNode;
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 if ( parent !== this ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2941 // set the correct event type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2942 event.type = event.data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2943
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2944 // handle event if we actually just moused on to a non sub-element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2945 jQuery.event.handle.apply( this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2946 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2947
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2948 // assuming we've left the element since we most likely mousedover a xul element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2949 } catch(e) { }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2950 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2951
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2952 // In case of event delegation, we only need to rename the event.type,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2953 // liveHandler will take care of the rest.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2954 delegate = function( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2955 event.type = event.data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2956 jQuery.event.handle.apply( this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2957 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2958
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2959 // Create mouseenter and mouseleave events
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2960 jQuery.each({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2961 mouseenter: "mouseover",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2962 mouseleave: "mouseout"
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2963 }, function( orig, fix ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2964 jQuery.event.special[ orig ] = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2965 setup: function( data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2966 jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2967 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2968 teardown: function( data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2969 jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2970 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2971 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2972 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2973
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2974 // submit delegation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2975 if ( !jQuery.support.submitBubbles ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2976
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2977 jQuery.event.special.submit = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2978 setup: function( data, namespaces ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2979 if ( this.nodeName.toLowerCase() !== "form" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2980 jQuery.event.add(this, "click.specialSubmit", function( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2981 var elem = e.target,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2982 type = elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2983
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2984 if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2985 e.liveFired = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2986 return trigger( "submit", this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2987 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2988 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2989
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2990 jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2991 var elem = e.target,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2992 type = elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2993
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2994 if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2995 e.liveFired = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2996 return trigger( "submit", this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2997 }
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 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3001 return false;
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3005 teardown: function( namespaces ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3006 jQuery.event.remove( this, ".specialSubmit" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3007 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3008 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3009
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3010 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3011
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3012 // change delegation, happens here so we have bind.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3013 if ( !jQuery.support.changeBubbles ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3014
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3015 var changeFilters,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3016
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3017 getVal = function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3018 var type = elem.type, val = elem.value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3019
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3020 if ( type === "radio" || type === "checkbox" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3021 val = elem.checked;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3022
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3023 } else if ( type === "select-multiple" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3024 val = elem.selectedIndex > -1 ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3025 jQuery.map( elem.options, function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3026 return elem.selected;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3027 }).join("-") :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3028 "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3029
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3030 } else if ( elem.nodeName.toLowerCase() === "select" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3031 val = elem.selectedIndex;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3032 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3033
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3034 return val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3035 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3036
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3037 testChange = function testChange( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3038 var elem = e.target, data, val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3039
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3040 if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3041 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3042 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3043
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3044 data = jQuery.data( elem, "_change_data" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3045 val = getVal(elem);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3046
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3047 // the current data will be also retrieved by beforeactivate
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3048 if ( e.type !== "focusout" || elem.type !== "radio" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3049 jQuery.data( elem, "_change_data", val );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3050 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3051
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3052 if ( data === undefined || val === data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3053 return;
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 if ( data != null || val ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3057 e.type = "change";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3058 e.liveFired = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3059 return jQuery.event.trigger( e, arguments[1], elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3060 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3061 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3062
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3063 jQuery.event.special.change = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3064 filters: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3065 focusout: testChange,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3066
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3067 beforedeactivate: testChange,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3068
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3069 click: function( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3070 var elem = e.target, type = elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3071
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3072 if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3073 return testChange.call( this, e );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3074 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3075 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3076
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3077 // Change has to be called before submit
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3078 // Keydown will be called before keypress, which is used in submit-event delegation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3079 keydown: function( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3080 var elem = e.target, type = elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3081
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3082 if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3083 (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3084 type === "select-multiple" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3085 return testChange.call( this, e );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3086 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3087 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3088
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3089 // Beforeactivate happens also before the previous element is blurred
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3090 // with this event you can't trigger a change event, but you can store
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3091 // information
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3092 beforeactivate: function( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3093 var elem = e.target;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3094 jQuery.data( elem, "_change_data", getVal(elem) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3095 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3096 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3097
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3098 setup: function( data, namespaces ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3099 if ( this.type === "file" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3100 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3101 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3102
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3103 for ( var type in changeFilters ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3104 jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
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 return rformElems.test( this.nodeName );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3108 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3109
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3110 teardown: function( namespaces ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3111 jQuery.event.remove( this, ".specialChange" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3112
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3113 return rformElems.test( this.nodeName );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3114 }
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 changeFilters = jQuery.event.special.change.filters;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3118
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3119 // Handle when the input is .focus()'d
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3120 changeFilters.focus = changeFilters.beforeactivate;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3121 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3122
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3123 function trigger( type, elem, args ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3124 args[0].type = type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3125 return jQuery.event.handle.apply( elem, args );
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 // Create "bubbling" focus and blur events
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3129 if ( document.addEventListener ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3130 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3131 jQuery.event.special[ fix ] = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3132 setup: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3133 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3134 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3135 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3136 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3137
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3138 if ( focusCounts[fix]++ === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3139 document.addEventListener( orig, handler, true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3140 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3141 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3142 teardown: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3143 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3144 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3145 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3146 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3147
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3148 if ( --focusCounts[fix] === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3149 document.removeEventListener( orig, handler, true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3150 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3151 }
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 function handler( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3155 e = jQuery.event.fix( e );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3156 e.type = fix;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3157 return jQuery.event.trigger( e, null, e.target );
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 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3161
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3162 // jQuery.each(["bind", "one"], function( i, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3163 // jQuery.fn[ name ] = function( type, data, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3164 // // Handle object literals
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3165 // if ( typeof type === "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3166 // for ( var key in type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3167 // this[ name ](key, data, type[key], fn);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3168 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3169 // return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3170 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3171
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3172 // if ( jQuery.isFunction( data ) || data === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3173 // fn = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3174 // data = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3175 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3176
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3177 // var handler = name === "one" ? jQuery.proxy( fn, function( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3178 // jQuery( this ).unbind( event, handler );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3179 // return fn.apply( this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3180 // }) : fn;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3181
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3182 // if ( type === "unload" && name !== "one" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3183 // this.one( type, data, fn );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3184
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3185 // } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3186 // for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3187 // jQuery.event.add( this[i], type, handler, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3188 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3189 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3190
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3191 // return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3192 // };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3193 // });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3194
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3195 jQuery.fn[ "bind" ] = function( type, data, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3196 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3197 /// Binds a handler to one or more events for each matched element. Can also bind custom events.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3198 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3199 /// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3200 /// <param name="data" optional="true" type="Object">Additional data passed to the event handler as event.data</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3201 /// <param name="fn" type="Function">A function to bind to the event on each of the set of matched elements. function callback(eventObject) such that this corresponds to the dom element.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3202
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3203 // Handle object literals
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3204 if ( typeof type === "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3205 for ( var key in type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3206 this[ "bind" ](key, data, type[key], fn);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3207 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3208 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3209 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3210
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3211 if ( jQuery.isFunction( data ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3212 fn = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3213 data = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3214 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3215
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3216 var handler = "bind" === "one" ? jQuery.proxy( fn, function( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3217 jQuery( this ).unbind( event, handler );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3218 return fn.apply( this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3219 }) : fn;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3220
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3221 return type === "unload" && "bind" !== "one" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3222 this.one( type, data, fn ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3223 this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3224 jQuery.event.add( this, type, handler, data );
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3228 jQuery.fn[ "one" ] = function( type, data, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3229 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3230 /// Binds a handler to one or more events to be executed exactly once for each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3231 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3232 /// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3233 /// <param name="data" optional="true" type="Object">Additional data passed to the event handler as event.data</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3234 /// <param name="fn" type="Function">A function to bind to the event on each of the set of matched elements. function callback(eventObject) such that this corresponds to the dom element.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3235
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3236 // Handle object literals
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3237 if ( typeof type === "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3238 for ( var key in type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3239 this[ "one" ](key, data, type[key], fn);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3240 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3241 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3242 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3243
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3244 if ( jQuery.isFunction( data ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3245 fn = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3246 data = undefined;
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 var handler = "one" === "one" ? jQuery.proxy( fn, function( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3250 jQuery( this ).unbind( event, handler );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3251 return fn.apply( this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3252 }) : fn;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3253
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3254 return type === "unload" && "one" !== "one" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3255 this.one( type, data, fn ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3256 this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3257 jQuery.event.add( this, type, handler, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3258 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3259 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3260
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3261 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3262 unbind: function( type, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3263 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3264 /// Unbinds a handler from one or more events for each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3265 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3266 /// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3267 /// <param name="fn" type="Function">A function to bind to the event on each of the set of matched elements. function callback(eventObject) such that this corresponds to the dom element.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3268
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3269 // Handle object literals
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3270 if ( typeof type === "object" && !type.preventDefault ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3271 for ( var key in type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3272 this.unbind(key, type[key]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3273 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3274
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3275 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3276 for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3277 jQuery.event.remove( this[i], type, fn );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3278 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3279 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3280
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3281 return this;
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 delegate: function( selector, types, data, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3285 return this.live( types, data, fn, selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3286 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3287
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3288 undelegate: function( selector, types, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3289 if ( arguments.length === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3290 return this.unbind( "live" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3291
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3292 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3293 return this.die( types, null, fn, selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3294 }
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 trigger: function( type, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3298 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3299 /// Triggers a type of event on every matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3300 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3301 /// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3302 /// <param name="data" optional="true" type="Array">Additional data passed to the event handler as additional arguments.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3303 /// <param name="fn" type="Function">This parameter is undocumented.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3304
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3305 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3306 jQuery.event.trigger( type, data, this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3307 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3308 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3309
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3310 triggerHandler: function( type, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3311 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3312 /// Triggers all bound event handlers on an element for a specific event type without executing the browser's default actions.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3313 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3314 /// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3315 /// <param name="data" optional="true" type="Array">Additional data passed to the event handler as additional arguments.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3316 /// <param name="fn" type="Function">This parameter is undocumented.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3317
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3318 if ( this[0] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3319 var event = jQuery.Event( type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3320 event.preventDefault();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3321 event.stopPropagation();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3322 jQuery.event.trigger( event, data, this[0] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3323 return event.result;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3324 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3325 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3326
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3327 toggle: function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3328 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3329 /// Toggles among two or more function calls every other click.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3330 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3331 /// <param name="fn" type="Function">The functions among which to toggle execution</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3332
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3333 // Save reference to arguments for access in closure
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3334 var args = arguments,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3335 i = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3336
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3337 // link all the functions, so any of them can unbind this click handler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3338 while ( i < args.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3339 jQuery.proxy( fn, args[ i++ ] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3340 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3341
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3342 return this.click( jQuery.proxy( fn, function( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3343 // Figure out which function to execute
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3344 var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3345 jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3346
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3347 // Make sure that clicks stop
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3348 event.preventDefault();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3349
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3350 // and execute the function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3351 return args[ lastToggle ].apply( this, arguments ) || false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3352 }));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3353 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3354
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3355 hover: function( fnOver, fnOut ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3356 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3357 /// Simulates hovering (moving the mouse on or off of an object).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3358 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3359 /// <param name="fnOver" type="Function">The function to fire when the mouse is moved over a matched element.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3360 /// <param name="fnOut" type="Function">The function to fire when the mouse is moved off of a matched element.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3361
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3362 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3363 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3364 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3365
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3366 var liveMap = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3367 focus: "focusin",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3368 blur: "focusout",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3369 mouseenter: "mouseover",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3370 mouseleave: "mouseout"
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 // jQuery.each(["live", "die"], function( i, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3374 // jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3375 // var type, i = 0, match, namespaces, preType,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3376 // selector = origSelector || this.selector,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3377 // context = origSelector ? this : jQuery( this.context );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3378
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3379 // if ( typeof types === "object" && !types.preventDefault ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3380 // for ( var key in types ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3381 // context[ name ]( key, data, types[key], selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3382 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3383
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3384 // return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3385 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3386
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3387 // if ( jQuery.isFunction( data ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3388 // fn = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3389 // data = undefined;
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 // types = (types || "").split(" ");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3393
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3394 // while ( (type = types[ i++ ]) != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3395 // match = rnamespaces.exec( type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3396 // namespaces = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3397
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3398 // if ( match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3399 // namespaces = match[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3400 // type = type.replace( rnamespaces, "" );
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 ( type === "hover" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3404 // types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3405 // continue;
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 // preType = type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3409
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3410 // if ( type === "focus" || type === "blur" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3411 // types.push( liveMap[ type ] + namespaces );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3412 // type = type + namespaces;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3413
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3414 // } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3415 // type = (liveMap[ type ] || type) + namespaces;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3416 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3417
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3418 // if ( name === "live" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3419 // // bind live handler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3420 // for ( var j = 0, l = context.length; j < l; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3421 // jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3422 // { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3423 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3424
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3425 // } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3426 // // unbind live handler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3427 // context.unbind( "live." + liveConvert( type, selector ), fn );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3428 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3429 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3430
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3431 // return this;
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3435 jQuery.fn[ "live" ] = function( types, data, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3436 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3437 /// Attach a handler to the event for all elements which match the current selector, now or
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3438 /// in the future.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3439 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3440 /// <param name="types" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3441 /// A string containing a JavaScript event type, such as "click" or "keydown".
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3442 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3443 /// <param name="data" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3444 /// A map of data that will be passed to the event handler.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3445 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3446 /// <param name="fn" type="Function">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3447 /// A function to execute at the time the event is triggered.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3448 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3449 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3450
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3451 var type, i = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3452
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3453 if ( jQuery.isFunction( data ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3454 fn = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3455 data = undefined;
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 types = (types || "").split( /\s+/ );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3459
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3460 while ( (type = types[ i++ ]) != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3461 type = type === "focus" ? "focusin" : // focus --> focusin
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3462 type === "blur" ? "focusout" : // blur --> focusout
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3463 type === "hover" ? types.push("mouseleave") && "mouseenter" : // hover support
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3464 type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3465
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3466 if ( "live" === "live" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3467 // bind live handler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3468 jQuery( this.context ).bind( liveConvert( type, this.selector ), {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3469 data: data, selector: this.selector, live: type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3470 }, fn );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3471
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3472 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3473 // unbind live handler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3474 jQuery( this.context ).unbind( liveConvert( type, this.selector ), fn ? { guid: fn.guid + this.selector + type } : null );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3475 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3476 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3477
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3478 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3479 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3480
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3481 jQuery.fn[ "die" ] = function( types, data, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3482 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3483 /// Remove all event handlers previously attached using .live() from the elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3484 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3485 /// <param name="types" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3486 /// A string containing a JavaScript event type, such as click or keydown.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3487 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3488 /// <param name="data" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3489 /// The function that is to be no longer executed.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3490 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3491 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3492
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3493 var type, i = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3494
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3495 if ( jQuery.isFunction( data ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3496 fn = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3497 data = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3498 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3499
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3500 types = (types || "").split( /\s+/ );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3501
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3502 while ( (type = types[ i++ ]) != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3503 type = type === "focus" ? "focusin" : // focus --> focusin
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3504 type === "blur" ? "focusout" : // blur --> focusout
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3505 type === "hover" ? types.push("mouseleave") && "mouseenter" : // hover support
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3506 type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3507
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3508 if ( "die" === "live" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3509 // bind live handler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3510 jQuery( this.context ).bind( liveConvert( type, this.selector ), {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3511 data: data, selector: this.selector, live: type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3512 }, fn );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3513
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3514 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3515 // unbind live handler
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3516 jQuery( this.context ).unbind( liveConvert( type, this.selector ), fn ? { guid: fn.guid + this.selector + type } : null );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3517 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3518 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3519
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3520 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3521 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3522
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3523 function liveHandler( event ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3524 var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3525 elems = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3526 selectors = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3527 events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3528
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3529 if ( typeof events === "function" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3530 events = events.events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3531 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3532
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3533 // Make sure we avoid non-left-click bubbling in Firefox (#3861)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3534 if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3535 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3536 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3537
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3538 if ( event.namespace ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3539 namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3540 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3541
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3542 event.liveFired = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3543
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3544 var live = events.live.slice(0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3545
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3546 for ( j = 0; j < live.length; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3547 handleObj = live[j];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3548
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3549 if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3550 selectors.push( handleObj.selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3551
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3552 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3553 live.splice( j--, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3554 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3555 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3556
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3557 match = jQuery( event.target ).closest( selectors, event.currentTarget );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3558
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3559 for ( i = 0, l = match.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3560 close = match[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3561
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3562 for ( j = 0; j < live.length; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3563 handleObj = live[j];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3564
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3565 if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3566 elem = close.elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3567 related = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3568
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3569 // Those two events require additional checking
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3570 if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3571 event.type = handleObj.preType;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3572 related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3573 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3574
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3575 if ( !related || related !== elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3576 elems.push({ elem: elem, handleObj: handleObj, level: close.level });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3577 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3578 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3579 }
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 for ( i = 0, l = elems.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3583 match = elems[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3584
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3585 if ( maxLevel && match.level > maxLevel ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3586 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3587 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3588
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3589 event.currentTarget = match.elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3590 event.data = match.handleObj.data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3591 event.handleObj = match.handleObj;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3592
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3593 ret = match.handleObj.origHandler.apply( match.elem, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3594
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3595 if ( ret === false || event.isPropagationStopped() ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3596 maxLevel = match.level;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3597
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3598 if ( ret === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3599 stop = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3600 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3601 if ( event.isImmediatePropagationStopped() ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3602 break;
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 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3606
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3607 return stop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3608 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3609
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3610 function liveConvert( type, selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3611 return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3612 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3613
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3614 // jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3615 // "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3616 // "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3617
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3618 // // Handle event binding
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3619 // jQuery.fn[ name ] = function( data, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3620 // if ( fn == null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3621 // fn = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3622 // data = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3623 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3624
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3625 // return arguments.length > 0 ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3626 // this.bind( name, data, fn ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3627 // this.trigger( name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3628 // };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3629
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3630 // if ( jQuery.attrFn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3631 // jQuery.attrFn[ name ] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3632 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3633 // });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3634
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3635 jQuery.fn[ "blur" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3636 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3637 /// 1: blur() - Triggers the blur event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3638 /// 2: blur(fn) - Binds a function to the blur event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3639 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3640 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3641 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3642
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3643 return fn ? this.bind( "blur", fn ) : this.trigger( "blur" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3644 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3645
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3646 jQuery.fn[ "focus" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3647 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3648 /// 1: focus() - Triggers the focus event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3649 /// 2: focus(fn) - Binds a function to the focus event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3650 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3651 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3652 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3653
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3654 return fn ? this.bind( "focus", fn ) : this.trigger( "focus" );
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 jQuery.fn[ "focusin" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3658 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3659 /// Bind an event handler to the "focusin" JavaScript event.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3660 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3661 /// <param name="fn" type="Function">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3662 /// A function to execute each time the event is triggered.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3663 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3664 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3665
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3666 return fn ? this.bind( "focusin", fn ) : this.trigger( "focusin" );
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 jQuery.fn[ "focusout" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3670 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3671 /// Bind an event handler to the "focusout" JavaScript event.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3672 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3673 /// <param name="fn" type="Function">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3674 /// A function to execute each time the event is triggered.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3675 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3676 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3677
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3678 return fn ? this.bind( "focusout", fn ) : this.trigger( "focusout" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3679 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3680
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3681 jQuery.fn[ "load" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3682 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3683 /// 1: load() - Triggers the load event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3684 /// 2: load(fn) - Binds a function to the load event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3685 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3686 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3687 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3688
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3689 return fn ? this.bind( "load", fn ) : this.trigger( "load" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3690 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3691
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3692 jQuery.fn[ "resize" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3693 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3694 /// 1: resize() - Triggers the resize event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3695 /// 2: resize(fn) - Binds a function to the resize event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3696 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3697 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3698 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3699
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3700 return fn ? this.bind( "resize", fn ) : this.trigger( "resize" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3701 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3702
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3703 jQuery.fn[ "scroll" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3704 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3705 /// 1: scroll() - Triggers the scroll event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3706 /// 2: scroll(fn) - Binds a function to the scroll event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3707 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3708 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3709 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3710
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3711 return fn ? this.bind( "scroll", fn ) : this.trigger( "scroll" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3712 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3713
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3714 jQuery.fn[ "unload" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3715 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3716 /// 1: unload() - Triggers the unload event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3717 /// 2: unload(fn) - Binds a function to the unload event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3718 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3719 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3720 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3721
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3722 return fn ? this.bind( "unload", fn ) : this.trigger( "unload" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3723 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3724
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3725 jQuery.fn[ "click" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3726 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3727 /// 1: click() - Triggers the click event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3728 /// 2: click(fn) - Binds a function to the click event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3729 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3730 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3731 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3732
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3733 return fn ? this.bind( "click", fn ) : this.trigger( "click" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3734 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3735
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3736 jQuery.fn[ "dblclick" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3737 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3738 /// 1: dblclick() - Triggers the dblclick event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3739 /// 2: dblclick(fn) - Binds a function to the dblclick event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3740 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3741 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3742 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3743
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3744 return fn ? this.bind( "dblclick", fn ) : this.trigger( "dblclick" );
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 jQuery.fn[ "mousedown" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3748 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3749 /// Binds a function to the mousedown event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3750 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3751 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3752 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3753
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3754 return fn ? this.bind( "mousedown", fn ) : this.trigger( "mousedown" );
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 jQuery.fn[ "mouseup" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3758 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3759 /// Bind a function to the mouseup event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3760 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3761 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3762 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3763
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3764 return fn ? this.bind( "mouseup", fn ) : this.trigger( "mouseup" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3765 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3766
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3767 jQuery.fn[ "mousemove" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3768 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3769 /// Bind a function to the mousemove event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3770 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3771 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3772 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3773
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3774 return fn ? this.bind( "mousemove", fn ) : this.trigger( "mousemove" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3775 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3776
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3777 jQuery.fn[ "mouseover" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3778 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3779 /// Bind a function to the mouseover event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3780 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3781 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3782 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3783
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3784 return fn ? this.bind( "mouseover", fn ) : this.trigger( "mouseover" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3785 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3786
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3787 jQuery.fn[ "mouseout" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3788 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3789 /// Bind a function to the mouseout event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3790 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3791 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3792 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3793
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3794 return fn ? this.bind( "mouseout", fn ) : this.trigger( "mouseout" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3795 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3796
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3797 jQuery.fn[ "mouseenter" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3798 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3799 /// Bind a function to the mouseenter event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3800 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3801 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3802 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3803
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3804 return fn ? this.bind( "mouseenter", fn ) : this.trigger( "mouseenter" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3805 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3806
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3807 jQuery.fn[ "mouseleave" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3808 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3809 /// Bind a function to the mouseleave event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3810 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3811 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3812 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3813
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3814 return fn ? this.bind( "mouseleave", fn ) : this.trigger( "mouseleave" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3815 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3816
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3817 jQuery.fn[ "change" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3818 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3819 /// 1: change() - Triggers the change event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3820 /// 2: change(fn) - Binds a function to the change event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3821 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3822 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3823 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3824
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3825 return fn ? this.bind( "change", fn ) : this.trigger( "change" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3826 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3827
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3828 jQuery.fn[ "select" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3829 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3830 /// 1: select() - Triggers the select event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3831 /// 2: select(fn) - Binds a function to the select event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3832 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3833 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3834 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3835
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3836 return fn ? this.bind( "select", fn ) : this.trigger( "select" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3837 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3838
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3839 jQuery.fn[ "submit" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3840 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3841 /// 1: submit() - Triggers the submit event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3842 /// 2: submit(fn) - Binds a function to the submit event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3843 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3844 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3845 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3846
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3847 return fn ? this.bind( "submit", fn ) : this.trigger( "submit" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3848 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3849
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3850 jQuery.fn[ "keydown" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3851 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3852 /// 1: keydown() - Triggers the keydown event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3853 /// 2: keydown(fn) - Binds a function to the keydown event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3854 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3855 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3856 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3857
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3858 return fn ? this.bind( "keydown", fn ) : this.trigger( "keydown" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3859 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3860
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3861 jQuery.fn[ "keypress" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3862 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3863 /// 1: keypress() - Triggers the keypress event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3864 /// 2: keypress(fn) - Binds a function to the keypress event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3865 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3866 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3867 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3868
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3869 return fn ? this.bind( "keypress", fn ) : this.trigger( "keypress" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3870 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3871
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3872 jQuery.fn[ "keyup" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3873 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3874 /// 1: keyup() - Triggers the keyup event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3875 /// 2: keyup(fn) - Binds a function to the keyup event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3876 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3877 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3878 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3879
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3880 return fn ? this.bind( "keyup", fn ) : this.trigger( "keyup" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3881 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3882
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3883 jQuery.fn[ "error" ] = function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3884 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3885 /// 1: error() - Triggers the error event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3886 /// 2: error(fn) - Binds a function to the error event of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3887 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3888 /// <param name="fn" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3889 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3890
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3891 return fn ? this.bind( "error", fn ) : this.trigger( "error" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3892 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3893
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3894 // Prevent memory leaks in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3895 // Window isn't included so as not to unbind existing unload events
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3896 // More info:
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3897 // - http://isaacschlueter.com/2006/10/msie-memory-leaks/
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3898 if ( window.attachEvent && !window.addEventListener ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3899 jQuery(window).bind("unload", function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3900 for ( var id in jQuery.cache ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3901 if ( jQuery.cache[ id ].handle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3902 // Try/Catch is to handle iframes being unloaded, see #4280
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3903 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3904 jQuery.event.remove( jQuery.cache[ id ].handle.elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3905 } catch(e) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3906 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3907 }
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3911
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3912 (function(){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3913
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3914 var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3915 done = 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3916 toString = Object.prototype.toString,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3917 hasDuplicate = false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3918 baseHasDuplicate = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3919
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3920 // Here we check if the JavaScript engine is using some sort of
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3921 // optimization where it does not always call our comparision
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3922 // function. If that is the case, discard the hasDuplicate value.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3923 // Thus far that includes Google Chrome.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3924 [0, 0].sort(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3925 baseHasDuplicate = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3926 return 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3927 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3928
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3929 var Sizzle = function( selector, context, results, seed ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3930 results = results || [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3931 context = context || document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3932
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3933 var origContext = context;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3934
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3935 if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3936 return [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3937 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3938
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3939 if ( !selector || typeof selector !== "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3940 return results;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3941 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3942
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3943 var m, set, checkSet, extra, ret, cur, pop, i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3944 prune = true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3945 contextXML = Sizzle.isXML( context ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3946 parts = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3947 soFar = selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3948
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3949 // Reset the position of the chunker regexp (start from head)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3950 do {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3951 chunker.exec( "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3952 m = chunker.exec( soFar );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3953
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3954 if ( m ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3955 soFar = m[3];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3956
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3957 parts.push( m[1] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3958
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3959 if ( m[2] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3960 extra = m[3];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3961 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3962 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3963 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3964 } while ( m );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3965
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3966 if ( parts.length > 1 && origPOS.exec( selector ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3967
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3968 if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3969 set = posProcess( parts[0] + parts[1], context );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3970
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3971 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3972 set = Expr.relative[ parts[0] ] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3973 [ context ] :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3974 Sizzle( parts.shift(), context );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3975
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3976 while ( parts.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3977 selector = parts.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3978
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3979 if ( Expr.relative[ selector ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3980 selector += parts.shift();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3981 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3982
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3983 set = posProcess( selector, set );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3984 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3985 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3986
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3987 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3988 // Take a shortcut and set the context if the root selector is an ID
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3989 // (but not if it'll be faster if the inner selector is an ID)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3990 if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3991 Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3992
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3993 ret = Sizzle.find( parts.shift(), context, contextXML );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3994 context = ret.expr ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3995 Sizzle.filter( ret.expr, ret.set )[0] :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3996 ret.set[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3997 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3998
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3999 if ( context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4000 ret = seed ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4001 { expr: parts.pop(), set: makeArray(seed) } :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4002 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
4003
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4004 set = ret.expr ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4005 Sizzle.filter( ret.expr, ret.set ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4006 ret.set;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4007
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4008 if ( parts.length > 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4009 checkSet = makeArray( set );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4010
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4011 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4012 prune = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4013 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4014
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4015 while ( parts.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4016 cur = parts.pop();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4017 pop = cur;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4018
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4019 if ( !Expr.relative[ cur ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4020 cur = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4021 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4022 pop = parts.pop();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4023 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4024
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4025 if ( pop == null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4026 pop = context;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4027 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4028
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4029 Expr.relative[ cur ]( checkSet, pop, contextXML );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4030 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4031
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4032 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4033 checkSet = parts = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4034 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4035 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4036
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4037 if ( !checkSet ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4038 checkSet = set;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4039 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4040
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4041 if ( !checkSet ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4042 Sizzle.error( cur || selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4043 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4044
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4045 if ( toString.call(checkSet) === "[object Array]" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4046 if ( !prune ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4047 results.push.apply( results, checkSet );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4048
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4049 } else if ( context && context.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4050 for ( i = 0; checkSet[i] != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4051 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
4052 results.push( set[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4053 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4054 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4055
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4056 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4057 for ( i = 0; checkSet[i] != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4058 if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4059 results.push( set[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4060 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4061 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4062 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4063
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4064 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4065 makeArray( checkSet, results );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4066 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4067
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4068 if ( extra ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4069 Sizzle( extra, origContext, results, seed );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4070 Sizzle.uniqueSort( results );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4071 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4072
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4073 return results;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4074 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4075
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4076 Sizzle.uniqueSort = function( results ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4077 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4078 /// Removes all duplicate elements from an array of elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4079 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4080 /// <param name="array" type="Array&lt;Element&gt;">The array to translate</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4081 /// <returns type="Array&lt;Element&gt;">The array after translation.</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4082
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4083 if ( sortOrder ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4084 hasDuplicate = baseHasDuplicate;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4085 results.sort( sortOrder );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4086
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4087 if ( hasDuplicate ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4088 for ( var i = 1; i < results.length; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4089 if ( results[i] === results[ i - 1 ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4090 results.splice( i--, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4091 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4092 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4093 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4094 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4095
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4096 return results;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4097 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4098
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4099 Sizzle.matches = function( expr, set ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4100 return Sizzle( expr, null, null, set );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4101 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4102
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4103 Sizzle.matchesSelector = function( node, expr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4104 return Sizzle( expr, null, null, [node] ).length > 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4105 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4106
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4107 Sizzle.find = function( expr, context, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4108 var set;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4109
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4110 if ( !expr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4111 return [];
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 for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4115 var match,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4116 type = Expr.order[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4117
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4118 if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4119 var left = match[1];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4120 match.splice( 1, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4121
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4122 if ( left.substr( left.length - 1 ) !== "\\" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4123 match[1] = (match[1] || "").replace(/\\/g, "");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4124 set = Expr.find[ type ]( match, context, isXML );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4125
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4126 if ( set != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4127 expr = expr.replace( Expr.match[ type ], "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4128 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4129 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4130 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4131 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4132 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4133
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4134 if ( !set ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4135 set = context.getElementsByTagName( "*" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4136 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4137
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4138 return { set: set, expr: expr };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4139 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4140
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4141 Sizzle.filter = function( expr, set, inplace, not ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4142 var match, anyFound,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4143 old = expr,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4144 result = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4145 curLoop = set,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4146 isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4147
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4148 while ( expr && set.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4149 for ( var type in Expr.filter ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4150 if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4151 var found, item,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4152 filter = Expr.filter[ type ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4153 left = match[1];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4154
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4155 anyFound = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4156
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4157 match.splice(1,1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4158
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4159 if ( left.substr( left.length - 1 ) === "\\" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4160 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4161 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4162
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4163 if ( curLoop === result ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4164 result = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4165 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4166
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4167 if ( Expr.preFilter[ type ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4168 match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4169
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4170 if ( !match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4171 anyFound = found = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4172
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4173 } else if ( match === true ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4174 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4175 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4176 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4177
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4178 if ( match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4179 for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4180 if ( item ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4181 found = filter( item, match, i, curLoop );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4182 var pass = not ^ !!found;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4183
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4184 if ( inplace && found != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4185 if ( pass ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4186 anyFound = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4187
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4188 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4189 curLoop[i] = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4190 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4191
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4192 } else if ( pass ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4193 result.push( item );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4194 anyFound = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4195 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4196 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4197 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4198 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4199
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4200 if ( found !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4201 if ( !inplace ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4202 curLoop = result;
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 expr = expr.replace( Expr.match[ type ], "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4206
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4207 if ( !anyFound ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4208 return [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4209 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4210
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4211 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4212 }
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4216 // Improper expression
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4217 if ( expr === old ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4218 if ( anyFound == null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4219 Sizzle.error( expr );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4220
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4221 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4222 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4223 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4224 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4225
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4226 old = expr;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4227 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4228
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4229 return curLoop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4230 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4231
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4232 Sizzle.error = function( msg ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4233 throw "Syntax error, unrecognized expression: " + msg;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4234 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4235
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4236 var Expr = Sizzle.selectors = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4237 order: [ "ID", "NAME", "TAG" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4238
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4239 match: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4240 ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4241 CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4242 NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4243 ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4244 TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4245 CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4246 POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4247 PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
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 leftMatch: {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4251
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4252 attrMap: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4253 "class": "className",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4254 "for": "htmlFor"
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4255 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4256
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4257 attrHandle: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4258 href: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4259 return elem.getAttribute( "href" );
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 relative: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4264 "+": function(checkSet, part){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4265 var isPartStr = typeof part === "string",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4266 isTag = isPartStr && !/\W/.test( part ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4267 isPartStrNotTag = isPartStr && !isTag;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4268
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4269 if ( isTag ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4270 part = part.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4271 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4272
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4273 for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4274 if ( (elem = checkSet[i]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4275 while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4276
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4277 checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4278 elem || false :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4279 elem === part;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4280 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4281 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4282
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4283 if ( isPartStrNotTag ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4284 Sizzle.filter( part, checkSet, true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4285 }
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 ">": function( checkSet, part ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4289 var elem,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4290 isPartStr = typeof part === "string",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4291 i = 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4292 l = checkSet.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4293
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4294 if ( isPartStr && !/\W/.test( part ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4295 part = part.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4296
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4297 for ( ; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4298 elem = checkSet[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4299
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4300 if ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4301 var parent = elem.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4302 checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4303 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4304 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4305
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4306 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4307 for ( ; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4308 elem = checkSet[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4309
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4310 if ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4311 checkSet[i] = isPartStr ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4312 elem.parentNode :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4313 elem.parentNode === part;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4314 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4315 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4316
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4317 if ( isPartStr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4318 Sizzle.filter( part, checkSet, true );
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 "": function(checkSet, part, isXML){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4324 var nodeCheck,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4325 doneName = done++,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4326 checkFn = dirCheck;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4327
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4328 if ( typeof part === "string" && !/\W/.test(part) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4329 part = part.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4330 nodeCheck = part;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4331 checkFn = dirNodeCheck;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4332 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4333
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4334 checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4335 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4336
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4337 "~": function( checkSet, part, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4338 var nodeCheck,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4339 doneName = done++,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4340 checkFn = dirCheck;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4341
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4342 if ( typeof part === "string" && !/\W/.test( part ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4343 part = part.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4344 nodeCheck = part;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4345 checkFn = dirNodeCheck;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4346 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4347
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4348 checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
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 find: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4353 ID: function( match, context, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4354 if ( typeof context.getElementById !== "undefined" && !isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4355 var m = context.getElementById(match[1]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4356 // Check parentNode to catch when Blackberry 4.6 returns
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4357 // nodes that are no longer in the document #6963
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4358 return m && m.parentNode ? [m] : [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4359 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4360 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4361
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4362 NAME: function( match, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4363 if ( typeof context.getElementsByName !== "undefined" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4364 var ret = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4365 results = context.getElementsByName( match[1] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4366
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4367 for ( var i = 0, l = results.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4368 if ( results[i].getAttribute("name") === match[1] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4369 ret.push( results[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4370 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4371 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4372
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4373 return ret.length === 0 ? null : ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4374 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4375 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4376
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4377 TAG: function( match, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4378 return context.getElementsByTagName( match[1] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4379 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4380 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4381 preFilter: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4382 CLASS: function( match, curLoop, inplace, result, not, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4383 match = " " + match[1].replace(/\\/g, "") + " ";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4384
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4385 if ( isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4386 return match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4387 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4388
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4389 for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4390 if ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4391 if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4392 if ( !inplace ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4393 result.push( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4394 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4395
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4396 } else if ( inplace ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4397 curLoop[i] = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4398 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4399 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4400 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4401
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4402 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4403 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4404
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4405 ID: function( match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4406 return match[1].replace(/\\/g, "");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4407 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4408
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4409 TAG: function( match, curLoop ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4410 return match[1].toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4411 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4412
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4413 CHILD: function( match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4414 if ( match[1] === "nth" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4415 // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4416 var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4417 match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4418 !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4419
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4420 // calculate the numbers (first)n+(last) including if they are negative
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4421 match[2] = (test[1] + (test[2] || 1)) - 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4422 match[3] = test[3] - 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4423 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4424
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4425 // TODO: Move to normal caching system
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4426 match[0] = done++;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4427
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4428 return match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4429 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4430
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4431 ATTR: function( match, curLoop, inplace, result, not, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4432 var name = match[1].replace(/\\/g, "");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4433
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4434 if ( !isXML && Expr.attrMap[name] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4435 match[1] = Expr.attrMap[name];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4436 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4437
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4438 if ( match[2] === "~=" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4439 match[4] = " " + match[4] + " ";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4440 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4441
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4442 return match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4443 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4444
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4445 PSEUDO: function( match, curLoop, inplace, result, not ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4446 if ( match[1] === "not" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4447 // If we're dealing with a complex expression, or a simple one
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4448 if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4449 match[3] = Sizzle(match[3], null, null, curLoop);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4450
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4451 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4452 var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4453
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4454 if ( !inplace ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4455 result.push.apply( result, ret );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4456 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4457
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4458 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4459 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4460
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4461 } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4462 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4463 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4464
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4465 return match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4466 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4467
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4468 POS: function( match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4469 match.unshift( true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4470
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4471 return match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4472 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4473 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4474
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4475 filters: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4476 enabled: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4477 return elem.disabled === false && elem.type !== "hidden";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4478 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4479
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4480 disabled: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4481 return elem.disabled === true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4482 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4483
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4484 checked: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4485 return elem.checked === true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4486 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4487
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4488 selected: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4489 // Accessing this property makes selected-by-default
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4490 // options in Safari work properly
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4491 elem.parentNode.selectedIndex;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4492
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4493 return elem.selected === true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4494 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4495
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4496 parent: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4497 return !!elem.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4498 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4499
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4500 empty: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4501 return !elem.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4502 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4503
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4504 has: function( elem, i, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4505 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4506 /// Internal use only; use hasClass('class')
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4507 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4508 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4509
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4510 return !!Sizzle( match[3], elem ).length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4511 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4512
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4513 header: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4514 return (/h\d/i).test( elem.nodeName );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4515 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4516
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4517 text: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4518 return "text" === elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4519 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4520 radio: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4521 return "radio" === elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4522 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4523
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4524 checkbox: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4525 return "checkbox" === elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4526 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4527
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4528 file: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4529 return "file" === elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4530 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4531 password: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4532 return "password" === elem.type;
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 submit: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4536 return "submit" === elem.type;
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 image: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4540 return "image" === elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4541 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4542
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4543 reset: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4544 return "reset" === elem.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4545 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4546
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4547 button: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4548 return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4549 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4550
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4551 input: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4552 return (/input|select|textarea|button/i).test( elem.nodeName );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4553 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4554 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4555 setFilters: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4556 first: function( elem, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4557 return i === 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4558 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4559
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4560 last: function( elem, i, match, array ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4561 return i === array.length - 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4562 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4563
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4564 even: function( elem, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4565 return i % 2 === 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4566 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4567
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4568 odd: function( elem, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4569 return i % 2 === 1;
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 lt: function( elem, i, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4573 return i < match[3] - 0;
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 gt: function( elem, i, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4577 return i > match[3] - 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4578 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4579
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4580 nth: function( elem, i, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4581 return match[3] - 0 === i;
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 eq: function( elem, i, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4585 return match[3] - 0 === i;
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 filter: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4589 PSEUDO: function( elem, match, i, array ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4590 var name = match[1],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4591 filter = Expr.filters[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4592
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4593 if ( filter ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4594 return filter( elem, i, match, array );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4595
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4596 } else if ( name === "contains" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4597 return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4598
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4599 } else if ( name === "not" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4600 var not = match[3];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4601
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4602 for ( var j = 0, l = not.length; j < l; j++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4603 if ( not[j] === elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4604 return false;
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4608 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4609
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4610 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4611 Sizzle.error( "Syntax error, unrecognized expression: " + name );
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4615 CHILD: function( elem, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4616 var type = match[1],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4617 node = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4618
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4619 switch ( type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4620 case "only":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4621 case "first":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4622 while ( (node = node.previousSibling) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4623 if ( node.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4624 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4625 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4626 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4627
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4628 if ( type === "first" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4629 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4630 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4631
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4632 node = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4633
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4634 case "last":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4635 while ( (node = node.nextSibling) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4636 if ( node.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4637 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4638 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4639 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4640
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4641 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4642
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4643 case "nth":
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4644 var first = match[2],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4645 last = match[3];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4646
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4647 if ( first === 1 && last === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4648 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4649 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4650
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4651 var doneName = match[0],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4652 parent = elem.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4653
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4654 if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4655 var count = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4656
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4657 for ( node = parent.firstChild; node; node = node.nextSibling ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4658 if ( node.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4659 node.nodeIndex = ++count;
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4663 parent.sizcache = doneName;
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 var diff = elem.nodeIndex - last;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4667
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4668 if ( first === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4669 return diff === 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4670
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4671 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4672 return ( diff % first === 0 && diff / first >= 0 );
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4677 ID: function( elem, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4678 return elem.nodeType === 1 && elem.getAttribute("id") === match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4679 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4680
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4681 TAG: function( elem, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4682 return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4683 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4684
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4685 CLASS: function( elem, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4686 return (" " + (elem.className || elem.getAttribute("class")) + " ")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4687 .indexOf( match ) > -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4688 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4689
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4690 ATTR: function( elem, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4691 var name = match[1],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4692 result = Expr.attrHandle[ name ] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4693 Expr.attrHandle[ name ]( elem ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4694 elem[ name ] != null ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4695 elem[ name ] :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4696 elem.getAttribute( name ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4697 value = result + "",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4698 type = match[2],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4699 check = match[4];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4700
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4701 return result == null ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4702 type === "!=" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4703 type === "=" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4704 value === check :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4705 type === "*=" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4706 value.indexOf(check) >= 0 :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4707 type === "~=" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4708 (" " + value + " ").indexOf(check) >= 0 :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4709 !check ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4710 value && result !== false :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4711 type === "!=" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4712 value !== check :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4713 type === "^=" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4714 value.indexOf(check) === 0 :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4715 type === "$=" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4716 value.substr(value.length - check.length) === check :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4717 type === "|=" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4718 value === check || value.substr(0, check.length + 1) === check + "-" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4719 false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4720 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4721
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4722 POS: function( elem, match, i, array ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4723 var name = match[2],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4724 filter = Expr.setFilters[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4725
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4726 if ( filter ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4727 return filter( elem, i, match, array );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4728 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4729 }
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4733 var origPOS = Expr.match.POS,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4734 fescape = function(all, num){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4735 return "\\" + (num - 0 + 1);
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 for ( var type in Expr.match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4739 Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4740 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
4741 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4742
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4743 var makeArray = function( array, results ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4744 array = Array.prototype.slice.call( array, 0 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4745
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4746 if ( results ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4747 results.push.apply( results, array );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4748 return results;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4749 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4750
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4751 return array;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4752 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4753
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4754 // Perform a simple check to determine if the browser is capable of
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4755 // converting a NodeList to an array using builtin methods.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4756 // Also verifies that the returned array holds DOM nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4757 // (which is not the case in the Blackberry browser)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4758 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4759 Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4760
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4761 // Provide a fallback method if it does not work
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4762 } catch( e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4763 makeArray = function( array, results ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4764 var i = 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4765 ret = results || [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4766
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4767 if ( toString.call(array) === "[object Array]" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4768 Array.prototype.push.apply( ret, array );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4769
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4770 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4771 if ( typeof array.length === "number" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4772 for ( var l = array.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4773 ret.push( array[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4774 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4775
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4776 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4777 for ( ; array[i]; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4778 ret.push( array[i] );
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 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4782
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4783 return ret;
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 var sortOrder, siblingCheck;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4788
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4789 if ( document.documentElement.compareDocumentPosition ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4790 sortOrder = function( a, b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4791 if ( a === b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4792 hasDuplicate = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4793 return 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4794 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4795
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4796 if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4797 return a.compareDocumentPosition ? -1 : 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4798 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4799
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4800 return a.compareDocumentPosition(b) & 4 ? -1 : 1;
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 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4804 sortOrder = function( a, b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4805 var al, bl,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4806 ap = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4807 bp = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4808 aup = a.parentNode,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4809 bup = b.parentNode,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4810 cur = aup;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4811
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4812 // The nodes are identical, we can exit early
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4813 if ( a === b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4814 hasDuplicate = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4815 return 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4816
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4817 // If the nodes are siblings (or identical) we can do a quick check
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4818 } else if ( aup === bup ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4819 return siblingCheck( a, b );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4820
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4821 // If no parents were found then the nodes are disconnected
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4822 } else if ( !aup ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4823 return -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4824
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4825 } else if ( !bup ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4826 return 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4827 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4828
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4829 // Otherwise they're somewhere else in the tree so we need
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4830 // to build up a full list of the parentNodes for comparison
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4831 while ( cur ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4832 ap.unshift( cur );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4833 cur = cur.parentNode;
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 cur = bup;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4837
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4838 while ( cur ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4839 bp.unshift( cur );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4840 cur = cur.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4841 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4842
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4843 al = ap.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4844 bl = bp.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4845
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4846 // Start walking down the tree looking for a discrepancy
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4847 for ( var i = 0; i < al && i < bl; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4848 if ( ap[i] !== bp[i] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4849 return siblingCheck( ap[i], bp[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4850 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4851 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4852
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4853 // We ended someplace up the tree so do a sibling check
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4854 return i === al ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4855 siblingCheck( a, bp[i], -1 ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4856 siblingCheck( ap[i], b, 1 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4857 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4858
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4859 siblingCheck = function( a, b, ret ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4860 if ( a === b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4861 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4862 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4863
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4864 var cur = a.nextSibling;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4865
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4866 while ( cur ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4867 if ( cur === b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4868 return -1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4869 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4870
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4871 cur = cur.nextSibling;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4872 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4873
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4874 return 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4875 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4876 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4877
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4878 // Utility function for retreiving the text value of an array of DOM nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4879 Sizzle.getText = function( elems ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4880 var ret = "", elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4881
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4882 for ( var i = 0; elems[i]; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4883 elem = elems[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4884
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4885 // Get the text from text nodes and CDATA nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4886 if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4887 ret += elem.nodeValue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4888
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4889 // Traverse everything else, except comment nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4890 } else if ( elem.nodeType !== 8 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4891 ret += Sizzle.getText( elem.childNodes );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4892 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4893 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4894
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4895 return ret;
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 // [vsdoc] The following function has been modified for IntelliSense.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4899 // Check to see if the browser returns elements by name when
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4900 // querying by getElementById (and provide a workaround)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4901 (function(){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4902 // We're going to inject a fake input element with a specified name
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4903 // var form = document.createElement("div"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4904 // id = "script" + (new Date()).getTime(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4905 // root = document.documentElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4906
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4907 // form.innerHTML = "<a name='" + id + "'/>";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4908
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4909 // // Inject it into the root element, check its status, and remove it quickly
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4910 // root.insertBefore( form, root.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4911
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4912 // // The workaround has to do additional checks after a getElementById
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4913 // // Which slows things down for other browsers (hence the branching)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4914 // if ( document.getElementById( id ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4915 Expr.find.ID = function( match, context, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4916 if ( typeof context.getElementById !== "undefined" && !isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4917 var m = context.getElementById(match[1]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4918
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4919 return m ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4920 m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4921 [m] :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4922 undefined :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4923 [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4924 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4925 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4926
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4927 Expr.filter.ID = function( elem, match ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4928 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4929
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4930 return elem.nodeType === 1 && node && node.nodeValue === match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4931 };
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 // root.removeChild( form );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4935
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4936 // release memory in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4937 root = form = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4938 })();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4939
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4940 // [vsdoc] The following function has been modified for IntelliSense.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4941 (function(){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4942 // Check to see if the browser returns only elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4943 // when doing getElementsByTagName("*")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4944
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4945 // Create a fake element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4946 // var div = document.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4947 // div.appendChild( document.createComment("") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4948
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4949 // Make sure no comments are found
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4950 // if ( div.getElementsByTagName("*").length > 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4951 Expr.find.TAG = function( match, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4952 var results = context.getElementsByTagName( match[1] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4953
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4954 // Filter out possible comments
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4955 if ( match[1] === "*" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4956 var tmp = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4957
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4958 for ( var i = 0; results[i]; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4959 if ( results[i].nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4960 tmp.push( results[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4961 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4962 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4963
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4964 results = tmp;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4965 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4966
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4967 return results;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4968 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4969 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4970
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4971 // Check to see if an attribute returns normalized href attributes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4972 // div.innerHTML = "<a href='#'></a>";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4973
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4974 // if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4975 // div.firstChild.getAttribute("href") !== "#" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4976
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4977 // Expr.attrHandle.href = function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4978 // return elem.getAttribute( "href", 2 );
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 // release memory in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4983 div = null;
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 if ( document.querySelectorAll ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4987 (function(){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4988 var oldSizzle = Sizzle,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4989 div = document.createElement("div"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4990 id = "__sizzle__";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4991
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4992 div.innerHTML = "<p class='TEST'></p>";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4993
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4994 // Safari can't handle uppercase or unicode characters when
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4995 // in quirks mode.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4996 if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4997 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4998 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4999
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5000 Sizzle = function( query, context, extra, seed ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5001 context = context || document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5002
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5003 // Make sure that attribute selectors are quoted
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5004 query = query.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5005
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5006 // Only use querySelectorAll on non-XML documents
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5007 // (ID selectors don't work in non-HTML documents)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5008 if ( !seed && !Sizzle.isXML(context) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5009 if ( context.nodeType === 9 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5010 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5011 return makeArray( context.querySelectorAll(query), extra );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5012 } catch(qsaError) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5013
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5014 // qSA works strangely on Element-rooted queries
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5015 // We can work around this by specifying an extra ID on the root
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5016 // and working up from there (Thanks to Andrew Dupont for the technique)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5017 // IE 8 doesn't work on object elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5018 } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5019 var old = context.getAttribute( "id" ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5020 nid = old || id;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5021
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5022 if ( !old ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5023 context.setAttribute( "id", nid );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5024 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5025
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5026 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5027 return makeArray( context.querySelectorAll( "#" + nid + " " + query ), extra );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5028
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5029 } catch(pseudoError) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5030 } finally {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5031 if ( !old ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5032 context.removeAttribute( "id" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5033 }
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 return oldSizzle(query, context, extra, seed);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5039 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5040
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5041 for ( var prop in oldSizzle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5042 Sizzle[ prop ] = oldSizzle[ prop ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5043 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5044
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5045 // release memory in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5046 div = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5047 })();
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 (function(){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5051 var html = document.documentElement,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5052 matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5053 pseudoWorks = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5054
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5055 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5056 // This should fail with an exception
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5057 // Gecko does not error, returns false instead
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5058 matches.call( document.documentElement, "[test!='']:sizzle" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5059
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5060 } catch( pseudoError ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5061 pseudoWorks = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5062 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5063
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5064 if ( matches ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5065 Sizzle.matchesSelector = function( node, expr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5066 // Make sure that attribute selectors are quoted
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5067 expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5068
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5069 if ( !Sizzle.isXML( node ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5070 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5071 if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5072 return matches.call( node, expr );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5073 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5074 } catch(e) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5075 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5076
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5077 return Sizzle(expr, null, null, [node]).length > 0;
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 })();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5081
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5082 (function(){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5083 var div = document.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5084
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5085 div.innerHTML = "<div class='test e'></div><div class='test'></div>";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5086
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5087 // Opera can't find a second classname (in 9.6)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5088 // Also, make sure that getElementsByClassName actually exists
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5089 if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5090 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5091 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5092
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5093 // Safari caches class attributes, doesn't catch changes (in 3.2)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5094 div.lastChild.className = "e";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5095
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5096 if ( div.getElementsByClassName("e").length === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5097 return;
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 Expr.order.splice(1, 0, "CLASS");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5101 Expr.find.CLASS = function( match, context, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5102 if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5103 return context.getElementsByClassName(match[1]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5104 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5105 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5106
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5107 // release memory in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5108 div = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5109 })();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5110
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5111 function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5112 for ( var i = 0, l = checkSet.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5113 var elem = checkSet[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5114
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5115 if ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5116 var match = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5117
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5118 elem = elem[dir];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5119
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5120 while ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5121 if ( elem.sizcache === doneName ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5122 match = checkSet[elem.sizset];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5123 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5124 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5125
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5126 if ( elem.nodeType === 1 && !isXML ){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5127 elem.sizcache = doneName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5128 elem.sizset = i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5129 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5130
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5131 if ( elem.nodeName.toLowerCase() === cur ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5132 match = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5133 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5134 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5135
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5136 elem = elem[dir];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5137 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5138
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5139 checkSet[i] = match;
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5144 function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5145 for ( var i = 0, l = checkSet.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5146 var elem = checkSet[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5147
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5148 if ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5149 var match = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5150
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5151 elem = elem[dir];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5152
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5153 while ( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5154 if ( elem.sizcache === doneName ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5155 match = checkSet[elem.sizset];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5156 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5157 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5158
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5159 if ( elem.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5160 if ( !isXML ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5161 elem.sizcache = doneName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5162 elem.sizset = i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5163 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5164
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5165 if ( typeof cur !== "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5166 if ( elem === cur ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5167 match = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5168 break;
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 } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5172 match = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5173 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5174 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5175 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5176
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5177 elem = elem[dir];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5178 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5179
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5180 checkSet[i] = match;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5181 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5182 }
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 if ( document.documentElement.contains ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5186 Sizzle.contains = function( a, b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5187 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5188 /// Check to see if a DOM node is within another DOM node.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5189 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5190 /// <param name="a" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5191 /// The DOM element that may contain the other element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5192 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5193 /// <param name="b" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5194 /// The DOM node that may be contained by the other element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5195 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5196 /// <returns type="Boolean" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5197
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5198 return a !== b && (a.contains ? a.contains(b) : true);
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 } else if ( document.documentElement.compareDocumentPosition ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5202 Sizzle.contains = function( a, b ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5203 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5204 /// Check to see if a DOM node is within another DOM node.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5205 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5206 /// <param name="a" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5207 /// The DOM element that may contain the other element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5208 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5209 /// <param name="b" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5210 /// The DOM node that may be contained by the other element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5211 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5212 /// <returns type="Boolean" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5213
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5214 return !!(a.compareDocumentPosition(b) & 16);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5215 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5216
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5217 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5218 Sizzle.contains = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5219 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5220 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5221 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5222
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5223 Sizzle.isXML = function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5224 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5225 /// Determines if the parameter passed is an XML document.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5226 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5227 /// <param name="elem" type="Object">The object to test</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5228 /// <returns type="Boolean">True if the parameter is an XML document; otherwise false.</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5229
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5230 // documentElement is verified for cases where it doesn't yet exist
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5231 // (such as loading iframes in IE - #4833)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5232 var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5233
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5234 return documentElement ? documentElement.nodeName !== "HTML" : false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5235 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5236
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5237 var posProcess = function( selector, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5238 var match,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5239 tmpSet = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5240 later = "",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5241 root = context.nodeType ? [context] : context;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5242
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5243 // Position selectors must be done after the filter
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5244 // And so must :not(positional) so we move all PSEUDOs to the end
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5245 while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5246 later += match[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5247 selector = selector.replace( Expr.match.PSEUDO, "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5248 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5249
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5250 selector = Expr.relative[selector] ? selector + "*" : selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5251
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5252 for ( var i = 0, l = root.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5253 Sizzle( selector, root[i], tmpSet );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5254 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5255
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5256 return Sizzle.filter( later, tmpSet );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5257 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5258
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5259 // EXPOSE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5260 jQuery.find = Sizzle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5261 jQuery.expr = Sizzle.selectors;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5262 jQuery.expr[":"] = jQuery.expr.filters;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5263 jQuery.unique = Sizzle.uniqueSort;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5264 jQuery.text = Sizzle.getText;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5265 jQuery.isXMLDoc = Sizzle.isXML;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5266 jQuery.contains = Sizzle.contains;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5267
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5268
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5269 })();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5270
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5271
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5272 var runtil = /Until$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5273 rparentsprev = /^(?:parents|prevUntil|prevAll)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5274 // Note: This RegExp should be improved, or likely pulled from Sizzle
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5275 rmultiselector = /,/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5276 isSimple = /^.[^:#\[\.,]*$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5277 slice = Array.prototype.slice,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5278 POS = jQuery.expr.match.POS;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5279
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5280 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5281 find: function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5282 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5283 /// Searches for all elements that match the specified expression.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5284 /// This method is a good way to find additional descendant
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5285 /// elements with which to process.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5286 /// All searching is done using a jQuery expression. The expression can be
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5287 /// written using CSS 1-3 Selector syntax, or basic XPath.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5288 /// Part of DOM/Traversing
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5289 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5290 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5291 /// <param name="selector" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5292 /// An expression to search with.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5293 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5294 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5295
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5296 var ret = this.pushStack( "", "find", selector ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5297 length = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5298
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5299 for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5300 length = ret.length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5301 jQuery.find( selector, this[i], ret );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5302
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5303 if ( i > 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5304 // Make sure that the results are unique
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5305 for ( var n = length; n < ret.length; n++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5306 for ( var r = 0; r < length; r++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5307 if ( ret[r] === ret[n] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5308 ret.splice(n--, 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5309 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5310 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5311 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5312 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5313 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5314 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5315
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5316 return ret;
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 has: function( target ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5320 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5321 /// Reduce the set of matched elements to those that have a descendant that matches the
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5322 /// selector or DOM element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5323 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5324 /// <param name="target" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5325 /// A string containing a selector expression to match elements against.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5326 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5327 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5328
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5329 var targets = jQuery( target );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5330 return this.filter(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5331 for ( var i = 0, l = targets.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5332 if ( jQuery.contains( this, targets[i] ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5333 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5334 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5335 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5336 });
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 not: function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5340 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5341 /// Removes any elements inside the array of elements from the set
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5342 /// of matched elements. This method is used to remove one or more
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5343 /// elements from a jQuery object.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5344 /// Part of DOM/Traversing
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5345 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5346 /// <param name="selector" type="jQuery">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5347 /// A set of elements to remove from the jQuery set of matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5348 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5349 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5350
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5351 return this.pushStack( winnow(this, selector, false), "not", selector);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5352 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5353
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5354 filter: function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5355 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5356 /// Removes all elements from the set of matched elements that do not
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5357 /// pass the specified filter. This method is used to narrow down
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5358 /// the results of a search.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5359 /// })
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5360 /// Part of DOM/Traversing
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5361 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5362 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5363 /// <param name="selector" type="Function">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5364 /// A function to use for filtering
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5365 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5366 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5367
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5368 return this.pushStack( winnow(this, selector, true), "filter", selector );
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 is: function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5372 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5373 /// Checks the current selection against an expression and returns true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5374 /// if at least one element of the selection fits the given expression.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5375 /// Does return false, if no element fits or the expression is not valid.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5376 /// filter(String) is used internally, therefore all rules that apply there
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5377 /// apply here, too.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5378 /// Part of DOM/Traversing
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5379 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5380 /// <returns type="Boolean" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5381 /// <param name="expr" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5382 /// The expression with which to filter
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5383 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5384
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5385 return !!selector && jQuery.filter( selector, this ).length > 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5386 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5387
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5388 closest: function( selectors, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5389 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5390 /// Get a set of elements containing the closest parent element that matches the specified selector, the starting element included.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5391 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5392 /// <param name="selectors" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5393 /// A string containing a selector expression to match elements against.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5394 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5395 /// <param name="context" type="Element">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5396 /// A DOM element within which a matching element may be found. If no context is passed
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5397 /// in then the context of the jQuery set will be used instead.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5398 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5399 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5400
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5401 var ret = [], i, l, cur = this[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5402
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5403 if ( jQuery.isArray( selectors ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5404 var match, selector,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5405 matches = {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5406 level = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5407
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5408 if ( cur && selectors.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5409 for ( i = 0, l = selectors.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5410 selector = selectors[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5411
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5412 if ( !matches[selector] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5413 matches[selector] = jQuery.expr.match.POS.test( selector ) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5414 jQuery( selector, context || this.context ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5415 selector;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5416 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5417 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5418
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5419 while ( cur && cur.ownerDocument && cur !== context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5420 for ( selector in matches ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5421 match = matches[selector];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5422
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5423 if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5424 ret.push({ selector: selector, elem: cur, level: level });
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 cur = cur.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5429 level++;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5430 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5431 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5432
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5433 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5434 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5435
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5436 var pos = POS.test( selectors ) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5437 jQuery( selectors, context || this.context ) : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5438
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5439 for ( i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5440 cur = this[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5441
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5442 while ( cur ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5443 if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5444 ret.push( cur );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5445 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5446
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5447 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5448 cur = cur.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5449 if ( !cur || !cur.ownerDocument || cur === context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5450 break;
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 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5454 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5455
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5456 ret = ret.length > 1 ? jQuery.unique(ret) : ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5457
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5458 return this.pushStack( ret, "closest", selectors );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5459 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5460
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5461 // Determine the position of an element within
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5462 // the matched set of elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5463 index: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5464 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5465 /// Searches every matched element for the object and returns
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5466 /// the index of the element, if found, starting with zero.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5467 /// Returns -1 if the object wasn't found.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5468 /// Part of Core
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5469 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5470 /// <returns type="Number" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5471 /// <param name="elem" type="Element">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5472 /// Object to search for
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5473 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5474
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5475 if ( !elem || typeof elem === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5476 return jQuery.inArray( this[0],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5477 // If it receives a string, the selector is used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5478 // If it receives nothing, the siblings are used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5479 elem ? jQuery( elem ) : this.parent().children() );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5480 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5481 // Locate the position of the desired element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5482 return jQuery.inArray(
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5483 // If it receives a jQuery object, the first element is used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5484 elem.jquery ? elem[0] : elem, this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5485 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5486
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5487 add: function( selector, context ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5488 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5489 /// Adds one or more Elements to the set of matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5490 /// Part of DOM/Traversing
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5491 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5492 /// <param name="selector" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5493 /// A string containing a selector expression to match additional elements against.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5494 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5495 /// <param name="context" type="Element">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5496 /// Add some elements rooted against the specified context.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5497 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5498 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5499
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5500 var set = typeof selector === "string" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5501 jQuery( selector, context || this.context ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5502 jQuery.makeArray( selector ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5503 all = jQuery.merge( this.get(), set );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5504
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5505 return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5506 all :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5507 jQuery.unique( all ) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5508 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5509
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5510 andSelf: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5511 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5512 /// Adds the previous selection to the current selection.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5513 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5514 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5515
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5516 return this.add( this.prevObject );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5517 }
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 // A painfully simple check to see if an element is disconnected
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5521 // from a document (should be improved, where feasible).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5522 function isDisconnected( node ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5523 return !node || !node.parentNode || node.parentNode.nodeType === 11;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5524 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5525
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5526 jQuery.each({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5527 parent: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5528 var parent = elem.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5529 return parent && parent.nodeType !== 11 ? parent : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5530 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5531 parents: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5532 return jQuery.dir( elem, "parentNode" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5533 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5534 parentsUntil: function( elem, i, until ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5535 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5536 /// Get the ancestors of each element in the current set of matched elements, up to but not
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5537 /// including the element matched by the selector.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5538 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5539 /// <param name="until" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5540 /// A string containing a selector expression to indicate where to stop matching ancestor
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5541 /// elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5542 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5543 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5544
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5545 return jQuery.dir( elem, "parentNode", until );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5546 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5547 next: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5548 return jQuery.nth( elem, 2, "nextSibling" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5549 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5550 prev: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5551 return jQuery.nth( elem, 2, "previousSibling" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5552 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5553 nextAll: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5554 return jQuery.dir( elem, "nextSibling" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5555 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5556 prevAll: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5557 return jQuery.dir( elem, "previousSibling" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5558 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5559 nextUntil: function( elem, i, until ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5560 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5561 /// Get all following siblings of each element up to but not including the element matched
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5562 /// by the selector.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5563 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5564 /// <param name="until" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5565 /// A string containing a selector expression to indicate where to stop matching following
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5566 /// sibling elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5567 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5568 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5569
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5570 return jQuery.dir( elem, "nextSibling", until );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5571 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5572 prevUntil: function( elem, i, until ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5573 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5574 /// Get all preceding siblings of each element up to but not including the element matched
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5575 /// by the selector.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5576 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5577 /// <param name="until" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5578 /// A string containing a selector expression to indicate where to stop matching preceding
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5579 /// sibling elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5580 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5581 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5582
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5583 return jQuery.dir( elem, "previousSibling", until );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5584 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5585 siblings: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5586 return jQuery.sibling( elem.parentNode.firstChild, elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5587 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5588 children: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5589 return jQuery.sibling( elem.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5590 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5591 contents: function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5592 return jQuery.nodeName( elem, "iframe" ) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5593 elem.contentDocument || elem.contentWindow.document :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5594 jQuery.makeArray( elem.childNodes );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5595 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5596 }, function( name, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5597 jQuery.fn[ name ] = function( until, selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5598 var ret = jQuery.map( this, fn, until );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5599
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5600 if ( !runtil.test( name ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5601 selector = until;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5602 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5603
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5604 if ( selector && typeof selector === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5605 ret = jQuery.filter( selector, ret );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5606 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5607
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5608 ret = this.length > 1 ? jQuery.unique( ret ) : ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5609
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5610 if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5611 ret = ret.reverse();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5612 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5613
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5614 return this.pushStack( ret, name, slice.call(arguments).join(",") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5615 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5616 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5617
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5618 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5619 filter: function( expr, elems, not ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5620 if ( not ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5621 expr = ":not(" + expr + ")";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5622 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5623
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5624 return elems.length === 1 ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5625 jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5626 jQuery.find.matches(expr, elems);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5627 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5628
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5629 dir: function( elem, dir, until ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5630 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5631 /// This member is internal only.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5632 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5633 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5634
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5635 var matched = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5636 cur = elem[ dir ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5637
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5638 while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5639 if ( cur.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5640 matched.push( cur );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5641 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5642 cur = cur[dir];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5643 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5644 return matched;
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 nth: function( cur, result, dir, elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5648 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5649 /// This member is internal only.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5650 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5651 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5652
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5653 result = result || 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5654 var num = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5655
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5656 for ( ; cur; cur = cur[dir] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5657 if ( cur.nodeType === 1 && ++num === result ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5658 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5659 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5660 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5661
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5662 return cur;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5663 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5664
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5665 sibling: function( n, elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5666 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5667 /// This member is internal only.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5668 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5669 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5670
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5671 var r = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5672
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5673 for ( ; n; n = n.nextSibling ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5674 if ( n.nodeType === 1 && n !== elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5675 r.push( n );
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5679 return r;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5680 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5681 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5682
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5683 // Implement the identical functionality for filter and not
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5684 function winnow( elements, qualifier, keep ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5685 if ( jQuery.isFunction( qualifier ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5686 return jQuery.grep(elements, function( elem, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5687 var retVal = !!qualifier.call( elem, i, elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5688 return retVal === keep;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5689 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5690
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5691 } else if ( qualifier.nodeType ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5692 return jQuery.grep(elements, function( elem, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5693 return (elem === qualifier) === keep;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5694 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5695
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5696 } else if ( typeof qualifier === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5697 var filtered = jQuery.grep(elements, function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5698 return elem.nodeType === 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5699 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5700
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5701 if ( isSimple.test( qualifier ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5702 return jQuery.filter(qualifier, filtered, !keep);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5703 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5704 qualifier = jQuery.filter( qualifier, filtered );
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5708 return jQuery.grep(elements, function( elem, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5709 return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5710 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5711 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5712
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5713
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5714
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5715
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5716 var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5717 rleadingWhitespace = /^\s+/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5718 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5719 rtagName = /<([\w:]+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5720 rtbody = /<tbody/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5721 rhtml = /<|&#?\w+;/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5722 rnocache = /<(?:script|object|embed|option|style)/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5723 // checked="checked" or checked (html5)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5724 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5725 raction = /\=([^="'>\s]+\/)>/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5726 wrapMap = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5727 option: [ 1, "<select multiple='multiple'>", "</select>" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5728 legend: [ 1, "<fieldset>", "</fieldset>" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5729 thead: [ 1, "<table>", "</table>" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5730 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5731 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5732 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5733 area: [ 1, "<map>", "</map>" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5734 _default: [ 0, "", "" ]
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5735 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5736
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5737 wrapMap.optgroup = wrapMap.option;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5738 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5739 wrapMap.th = wrapMap.td;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5740
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5741 // IE can't serialize <link> and <script> tags normally
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5742 if ( !jQuery.support.htmlSerialize ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5743 wrapMap._default = [ 1, "div<div>", "</div>" ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5744 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5745
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5746 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5747 text: function( text ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5748 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5749 /// Set the text contents of all matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5750 /// Similar to html(), but escapes HTML (replace &quot;&lt;&quot; and &quot;&gt;&quot; with their
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5751 /// HTML entities).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5752 /// Part of DOM/Attributes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5753 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5754 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5755 /// <param name="text" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5756 /// The text value to set the contents of the element to.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5757 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5758
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5759 if ( jQuery.isFunction(text) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5760 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5761 var self = jQuery( this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5762
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5763 self.text( text.call(this, i, self.text()) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5764 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5765 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5766
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5767 if ( typeof text !== "object" && text !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5768 return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5769 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5770
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5771 return jQuery.text( this );
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 wrapAll: function( html ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5775 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5776 /// Wrap all matched elements with a structure of other elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5777 /// This wrapping process is most useful for injecting additional
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5778 /// stucture into a document, without ruining the original semantic
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5779 /// qualities of a document.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5780 /// This works by going through the first element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5781 /// provided and finding the deepest ancestor element within its
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5782 /// structure - it is that element that will en-wrap everything else.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5783 /// This does not work with elements that contain text. Any necessary text
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5784 /// must be added after the wrapping is done.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5785 /// Part of DOM/Manipulation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5786 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5787 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5788 /// <param name="html" type="Element">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5789 /// A DOM element that will be wrapped around the target.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5790 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5791
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5792 if ( jQuery.isFunction( html ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5793 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5794 jQuery(this).wrapAll( html.call(this, i) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5795 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5796 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5797
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5798 if ( this[0] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5799 // The elements to wrap the target around
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5800 var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5801
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5802 if ( this[0].parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5803 wrap.insertBefore( this[0] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5804 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5805
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5806 wrap.map(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5807 var elem = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5808
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5809 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5810 elem = elem.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5811 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5812
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5813 return elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5814 }).append(this);
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 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5818 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5819
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5820 wrapInner: function( html ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5821 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5822 /// Wraps the inner child contents of each matched elemenht (including text nodes) with an HTML structure.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5823 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5824 /// <param name="html" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5825 /// A string of HTML or a DOM element that will be wrapped around the target contents.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5826 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5827 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5828
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5829 if ( jQuery.isFunction( html ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5830 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5831 jQuery(this).wrapInner( html.call(this, i) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5832 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5833 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5834
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5835 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5836 var self = jQuery( this ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5837 contents = self.contents();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5838
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5839 if ( contents.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5840 contents.wrapAll( html );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5841
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5842 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5843 self.append( html );
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 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5847
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5848 wrap: function( html ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5849 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5850 /// Wrap all matched elements with a structure of other elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5851 /// This wrapping process is most useful for injecting additional
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5852 /// stucture into a document, without ruining the original semantic
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5853 /// qualities of a document.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5854 /// This works by going through the first element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5855 /// provided and finding the deepest ancestor element within its
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5856 /// structure - it is that element that will en-wrap everything else.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5857 /// This does not work with elements that contain text. Any necessary text
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5858 /// must be added after the wrapping is done.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5859 /// Part of DOM/Manipulation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5860 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5861 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5862 /// <param name="html" type="Element">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5863 /// A DOM element that will be wrapped around the target.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5864 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5865
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5866 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5867 jQuery( this ).wrapAll( html );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5868 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5869 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5870
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5871 unwrap: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5872 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5873 /// Remove the parents of the set of matched elements from the DOM, leaving the matched
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5874 /// elements in their place.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5875 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5876 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5877 return this.parent().each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5878 if ( !jQuery.nodeName( this, "body" ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5879 jQuery( this ).replaceWith( this.childNodes );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5880 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5881 }).end();
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 append: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5885 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5886 /// Append content to the inside of every matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5887 /// This operation is similar to doing an appendChild to all the
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5888 /// specified elements, adding them into the document.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5889 /// Part of DOM/Manipulation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5890 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5891 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5892
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5893 return this.domManip(arguments, true, function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5894 if ( this.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5895 this.appendChild( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5896 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5897 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5898 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5899
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5900 prepend: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5901 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5902 /// Prepend content to the inside of every matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5903 /// This operation is the best way to insert elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5904 /// inside, at the beginning, of all matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5905 /// Part of DOM/Manipulation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5906 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5907 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5908
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5909 return this.domManip(arguments, true, function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5910 if ( this.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5911 this.insertBefore( elem, this.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5912 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5913 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5914 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5915
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5916 before: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5917 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5918 /// Insert content before each of the matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5919 /// Part of DOM/Manipulation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5920 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5921 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5922
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5923 if ( this[0] && this[0].parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5924 return this.domManip(arguments, false, function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5925 this.parentNode.insertBefore( elem, this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5926 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5927 } else if ( arguments.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5928 var set = jQuery(arguments[0]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5929 set.push.apply( set, this.toArray() );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5930 return this.pushStack( set, "before", arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5931 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5932 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5933
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5934 after: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5935 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5936 /// Insert content after each of the matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5937 /// Part of DOM/Manipulation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5938 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5939 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5940
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5941 if ( this[0] && this[0].parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5942 return this.domManip(arguments, false, function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5943 this.parentNode.insertBefore( elem, this.nextSibling );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5944 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5945 } else if ( arguments.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5946 var set = this.pushStack( this, "after", arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5947 set.push.apply( set, jQuery(arguments[0]).toArray() );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5948 return set;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5949 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5950 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5951
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5952 // keepData is for internal use only--do not document
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5953 remove: function( selector, keepData ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5954 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5955 if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5956 if ( !keepData && elem.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5957 jQuery.cleanData( elem.getElementsByTagName("*") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5958 jQuery.cleanData( [ elem ] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5959 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5960
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5961 if ( elem.parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5962 elem.parentNode.removeChild( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5963 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5964 }
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 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5968 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5969
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5970 empty: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5971 for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5972 // Remove element nodes and prevent memory leaks
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5973 if ( elem.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5974 jQuery.cleanData( elem.getElementsByTagName("*") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5975 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5976
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5977 // Remove any remaining nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5978 while ( elem.firstChild ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5979 elem.removeChild( elem.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5980 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5981 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5982
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5983 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5984 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5985
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5986 clone: function( events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5987 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5988 /// Clone matched DOM Elements and select the clones.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5989 /// This is useful for moving copies of the elements to another
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5990 /// location in the DOM.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5991 /// Part of DOM/Manipulation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5992 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5993 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5994 /// <param name="deep" type="Boolean" optional="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5995 /// (Optional) Set to false if you don't want to clone all descendant nodes, in addition to the element itself.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5996 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5997
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5998 // Do the clone
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5999 var ret = this.map(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6000 if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6001 // IE copies events bound via attachEvent when
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6002 // using cloneNode. Calling detachEvent on the
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6003 // clone will also remove the events from the orignal
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6004 // In order to get around this, we use innerHTML.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6005 // Unfortunately, this means some modifications to
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6006 // attributes in IE that are actually only stored
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6007 // as properties will not be copied (such as the
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6008 // the name attribute on an input).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6009 var html = this.outerHTML,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6010 ownerDocument = this.ownerDocument;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6011
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6012 if ( !html ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6013 var div = ownerDocument.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6014 div.appendChild( this.cloneNode(true) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6015 html = div.innerHTML;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6016 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6017
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6018 return jQuery.clean([html.replace(rinlinejQuery, "")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6019 // Handle the case in IE 8 where action=/test/> self-closes a tag
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6020 .replace(raction, '="$1">')
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6021 .replace(rleadingWhitespace, "")], ownerDocument)[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6022 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6023 return this.cloneNode(true);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6024 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6025 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6026
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6027 // Copy the events from the original to the clone
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6028 if ( events === true ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6029 cloneCopyEvent( this, ret );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6030 cloneCopyEvent( this.find("*"), ret.find("*") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6031 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6032
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6033 // Return the cloned set
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6034 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6035 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6036
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6037 html: function( value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6038 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6039 /// Set the html contents of every matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6040 /// This property is not available on XML documents.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6041 /// Part of DOM/Attributes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6042 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6043 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6044 /// <param name="value" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6045 /// A string of HTML to set as the content of each matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6046 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6047
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6048 if ( value === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6049 return this[0] && this[0].nodeType === 1 ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6050 this[0].innerHTML.replace(rinlinejQuery, "") :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6051 null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6052
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6053 // See if we can take a shortcut and just use innerHTML
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6054 } else if ( typeof value === "string" && !rnocache.test( value ) &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6055 (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6056 !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6057
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6058 value = value.replace(rxhtmlTag, "<$1></$2>");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6059
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6060 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6061 for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6062 // Remove element nodes and prevent memory leaks
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6063 if ( this[i].nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6064 jQuery.cleanData( this[i].getElementsByTagName("*") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6065 this[i].innerHTML = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6066 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6067 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6068
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6069 // If using innerHTML throws an exception, use the fallback method
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6070 } catch(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6071 this.empty().append( value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6072 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6073
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6074 } else if ( jQuery.isFunction( value ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6075 this.each(function(i){
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6076 var self = jQuery( this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6077
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6078 self.html( value.call(this, i, self.html()) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6079 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6080
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6081 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6082 this.empty().append( value );
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 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6086 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6087
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6088 replaceWith: function( value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6089 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6090 /// Replaces all matched element with the specified HTML or DOM elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6091 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6092 /// <param name="value" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6093 /// The content to insert. May be an HTML string, DOM element, or jQuery object.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6094 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6095 /// <returns type="jQuery">The element that was just replaced.</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6096
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6097 if ( this[0] && this[0].parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6098 // Make sure that the elements are removed from the DOM before they are inserted
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6099 // this can help fix replacing a parent with child elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6100 if ( jQuery.isFunction( value ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6101 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6102 var self = jQuery(this), old = self.html();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6103 self.replaceWith( value.call( this, i, old ) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6104 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6105 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6106
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6107 if ( typeof value !== "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6108 value = jQuery( value ).detach();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6109 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6110
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6111 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6112 var next = this.nextSibling,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6113 parent = this.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6114
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6115 jQuery( this ).remove();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6116
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6117 if ( next ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6118 jQuery(next).before( value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6119 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6120 jQuery(parent).append( value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6121 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6122 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6123 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6124 return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6125 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6126 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6127
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6128 detach: function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6129 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6130 /// Remove the set of matched elements from the DOM.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6131 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6132 /// <param name="selector" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6133 /// A selector expression that filters the set of matched elements to be removed.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6134 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6135 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6136
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6137 return this.remove( selector, true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6138 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6139
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6140 domManip: function( args, table, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6141 /// <param name="args" type="Array">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6142 /// Args
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6143 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6144 /// <param name="table" type="Boolean">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6145 /// Insert TBODY in TABLEs if one is not found.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6146 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6147 /// <param name="dir" type="Number">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6148 /// If dir&lt;0, process args in reverse order.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6149 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6150 /// <param name="fn" type="Function">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6151 /// The function doing the DOM manipulation.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6152 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6153 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6154 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6155 /// Part of Core
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6156 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6157
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6158 var results, first, fragment, parent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6159 value = args[0],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6160 scripts = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6161
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6162 // We can't cloneNode fragments that contain checked, in WebKit
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6163 if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6164 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6165 jQuery(this).domManip( args, table, callback, true );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6166 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6167 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6168
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6169 if ( jQuery.isFunction(value) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6170 return this.each(function(i) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6171 var self = jQuery(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6172 args[0] = value.call(this, i, table ? self.html() : undefined);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6173 self.domManip( args, table, callback );
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 if ( this[0] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6178 parent = value && value.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6179
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6180 // 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
6181 if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6182 results = { fragment: parent };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6183
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6184 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6185 results = jQuery.buildFragment( args, this, scripts );
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 fragment = results.fragment;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6189
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6190 if ( fragment.childNodes.length === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6191 first = fragment = fragment.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6192 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6193 first = fragment.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6194 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6195
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6196 if ( first ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6197 table = table && jQuery.nodeName( first, "tr" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6198
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6199 for ( var i = 0, l = this.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6200 callback.call(
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6201 table ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6202 root(this[i], first) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6203 this[i],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6204 i > 0 || results.cacheable || this.length > 1 ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6205 fragment.cloneNode(true) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6206 fragment
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6207 );
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6211 if ( scripts.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6212 jQuery.each( scripts, evalScript );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6213 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6214 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6215
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6216 return this;
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6220 function root( elem, cur ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6221 return jQuery.nodeName(elem, "table") ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6222 (elem.getElementsByTagName("tbody")[0] ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6223 elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6224 elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6225 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6226
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6227 function cloneCopyEvent(orig, ret) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6228 var i = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6229
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6230 ret.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6231 if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6232 return;
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 var oldData = jQuery.data( orig[i++] ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6236 curData = jQuery.data( this, oldData ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6237 events = oldData && oldData.events;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6238
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6239 if ( events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6240 delete curData.handle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6241 curData.events = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6242
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6243 for ( var type in events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6244 for ( var handler in events[ type ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6245 jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6246 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6247 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6248 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6249 });
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 jQuery.buildFragment = function( args, nodes, scripts ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6253 var fragment, cacheable, cacheresults,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6254 doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6255
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6256 // Only cache "small" (1/2 KB) strings that are associated with the main document
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6257 // Cloning options loses the selected state, so don't cache them
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6258 // 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
6259 // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6260 if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6261 !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6262
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6263 cacheable = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6264 cacheresults = jQuery.fragments[ args[0] ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6265 if ( cacheresults ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6266 if ( cacheresults !== 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6267 fragment = cacheresults;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6268 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6269 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6270 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6271
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6272 if ( !fragment ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6273 fragment = doc.createDocumentFragment();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6274 jQuery.clean( args, doc, fragment, scripts );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6275 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6276
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6277 if ( cacheable ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6278 jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6279 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6280
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6281 return { fragment: fragment, cacheable: cacheable };
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 jQuery.fragments = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6285
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6286 // jQuery.each({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6287 // appendTo: "append",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6288 // prependTo: "prepend",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6289 // insertBefore: "before",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6290 // insertAfter: "after",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6291 // replaceAll: "replaceWith"
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6292 // }, function( name, original ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6293 // jQuery.fn[ name ] = function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6294 // var ret = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6295 // insert = jQuery( selector ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6296 // parent = this.length === 1 && this[0].parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6297
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6298 // if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6299 // insert[ original ]( this[0] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6300 // return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6301
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6302 // } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6303 // for ( var i = 0, l = insert.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6304 // var elems = (i > 0 ? this.clone(true) : this).get();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6305 // jQuery( insert[i] )[ original ]( elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6306 // ret = ret.concat( elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6307 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6308 //
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6309 // return this.pushStack( ret, name, insert.selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6310 // }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6311 // };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6312 // });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6313 jQuery.fn[ "appendTo" ] = function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6314 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6315 /// Append all of the matched elements to another, specified, set of elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6316 /// As of jQuery 1.3.2, returns all of the inserted elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6317 /// This operation is, essentially, the reverse of doing a regular
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6318 /// $(A).append(B), in that instead of appending B to A, you're appending
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6319 /// A to B.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6320 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6321 /// <param name="selector" type="Selector">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6322 /// target to which the content will be appended.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6323 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6324 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6325
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6326 var ret = [], insert = jQuery( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6327
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6328 for ( var i = 0, l = insert.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6329 var elems = (i > 0 ? this.clone(true) : this).get();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6330 jQuery.fn[ "append" ].apply( jQuery(insert[i]), elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6331 ret = ret.concat( elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6332 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6333 return this.pushStack( ret, "appendTo", insert.selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6334 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6335
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6336 jQuery.fn[ "prependTo" ] = function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6337 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6338 /// Prepend all of the matched elements to another, specified, set of elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6339 /// As of jQuery 1.3.2, returns all of the inserted elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6340 /// This operation is, essentially, the reverse of doing a regular
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6341 /// $(A).prepend(B), in that instead of prepending B to A, you're prepending
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6342 /// A to B.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6343 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6344 /// <param name="selector" type="Selector">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6345 /// target to which the content will be appended.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6346 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6347 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6348
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6349 var ret = [], insert = jQuery( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6350
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6351 for ( var i = 0, l = insert.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6352 var elems = (i > 0 ? this.clone(true) : this).get();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6353 jQuery.fn[ "prepend" ].apply( jQuery(insert[i]), elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6354 ret = ret.concat( elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6355 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6356 return this.pushStack( ret, "prependTo", insert.selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6357 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6358
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6359 jQuery.fn[ "insertBefore" ] = function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6360 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6361 /// Insert all of the matched elements before another, specified, set of elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6362 /// As of jQuery 1.3.2, returns all of the inserted elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6363 /// This operation is, essentially, the reverse of doing a regular
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6364 /// $(A).before(B), in that instead of inserting B before A, you're inserting
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6365 /// A before B.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6366 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6367 /// <param name="content" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6368 /// Content after which the selected element(s) is inserted.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6369 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6370 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6371
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6372 var ret = [], insert = jQuery( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6373
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6374 for ( var i = 0, l = insert.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6375 var elems = (i > 0 ? this.clone(true) : this).get();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6376 jQuery.fn[ "before" ].apply( jQuery(insert[i]), elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6377 ret = ret.concat( elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6378 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6379 return this.pushStack( ret, "insertBefore", insert.selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6380 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6381
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6382 jQuery.fn[ "insertAfter" ] = function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6383 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6384 /// Insert all of the matched elements after another, specified, set of elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6385 /// As of jQuery 1.3.2, returns all of the inserted elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6386 /// This operation is, essentially, the reverse of doing a regular
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6387 /// $(A).after(B), in that instead of inserting B after A, you're inserting
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6388 /// A after B.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6389 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6390 /// <param name="content" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6391 /// Content after which the selected element(s) is inserted.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6392 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6393 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6394
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6395 var ret = [], insert = jQuery( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6396
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6397 for ( var i = 0, l = insert.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6398 var elems = (i > 0 ? this.clone(true) : this).get();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6399 jQuery.fn[ "after" ].apply( jQuery(insert[i]), elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6400 ret = ret.concat( elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6401 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6402 return this.pushStack( ret, "insertAfter", insert.selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6403 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6404
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6405 jQuery.fn[ "replaceAll" ] = function( selector ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6406 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6407 /// Replaces the elements matched by the specified selector with the matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6408 /// As of jQuery 1.3.2, returns all of the inserted elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6409 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6410 /// <param name="selector" type="Selector">The elements to find and replace the matched elements with.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6411 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6412
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6413 var ret = [], insert = jQuery( selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6414
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6415 for ( var i = 0, l = insert.length; i < l; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6416 var elems = (i > 0 ? this.clone(true) : this).get();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6417 jQuery.fn[ "replaceWith" ].apply( jQuery(insert[i]), elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6418 ret = ret.concat( elems );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6419 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6420 return this.pushStack( ret, "replaceAll", insert.selector );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6421 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6422
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6423 jQuery.each({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6424 // keepData is for internal use only--do not document
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6425 remove: function( selector, keepData ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6426 if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6427 if ( !keepData && this.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6428 jQuery.cleanData( this.getElementsByTagName("*") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6429 jQuery.cleanData( [ this ] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6430 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6431
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6432 if ( this.parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6433 this.parentNode.removeChild( this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6434 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6435 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6436 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6437
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6438 empty: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6439 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6440 /// Removes all child nodes from the set of matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6441 /// Part of DOM/Manipulation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6442 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6443 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6444
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6445 // Remove element nodes and prevent memory leaks
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6446 if ( this.nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6447 jQuery.cleanData( this.getElementsByTagName("*") );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6448 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6449
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6450 // Remove any remaining nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6451 while ( this.firstChild ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6452 this.removeChild( this.firstChild );
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 }, function( name, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6456 jQuery.fn[ name ] = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6457 return this.each( fn, arguments );
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6461 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6462 clean: function( elems, context, fragment, scripts ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6463 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6464 /// This method is internal only.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6465 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6466 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6467
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6468 context = context || document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6469
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6470 // !context.createElement fails in IE with an error but returns typeof 'object'
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6471 if ( typeof context.createElement === "undefined" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6472 context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6473 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6474
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6475 var ret = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6476
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6477 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6478 if ( typeof elem === "number" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6479 elem += "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6480 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6481
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6482 if ( !elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6483 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6484 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6485
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6486 // Convert html string into DOM nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6487 if ( typeof elem === "string" && !rhtml.test( elem ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6488 elem = context.createTextNode( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6489
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6490 } else if ( typeof elem === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6491 // Fix "XHTML"-style tags in all browsers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6492 elem = elem.replace(rxhtmlTag, "<$1></$2>");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6493
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6494 // Trim whitespace, otherwise indexOf won't work as expected
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6495 var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6496 wrap = wrapMap[ tag ] || wrapMap._default,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6497 depth = wrap[0],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6498 div = context.createElement("div");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6499
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6500 // Go to html and back, then peel off extra wrappers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6501 div.innerHTML = wrap[1] + elem + wrap[2];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6502
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6503 // Move to the right depth
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6504 while ( depth-- ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6505 div = div.lastChild;
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 // Remove IE's autoinserted <tbody> from table fragments
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6509 if ( !jQuery.support.tbody ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6510
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6511 // String was a <table>, *may* have spurious <tbody>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6512 var hasBody = rtbody.test(elem),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6513 tbody = tag === "table" && !hasBody ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6514 div.firstChild && div.firstChild.childNodes :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6515
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6516 // String was a bare <thead> or <tfoot>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6517 wrap[1] === "<table>" && !hasBody ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6518 div.childNodes :
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 for ( var j = tbody.length - 1; j >= 0 ; --j ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6522 if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6523 tbody[ j ].parentNode.removeChild( tbody[ j ] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6524 }
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 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6528
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6529 // IE completely kills leading whitespace when innerHTML is used
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6530 if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6531 div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6532 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6533
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6534 elem = div.childNodes;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6535 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6536
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6537 if ( elem.nodeType ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6538 ret.push( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6539 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6540 ret = jQuery.merge( ret, elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6541 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6542 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6543
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6544 if ( fragment ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6545 for ( i = 0; ret[i]; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6546 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
6547 scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6548
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6549 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6550 if ( ret[i].nodeType === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6551 ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6552 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6553 fragment.appendChild( ret[i] );
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 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6557
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6558 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6559 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6560
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6561 cleanData: function( elems ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6562 var data, id, cache = jQuery.cache,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6563 special = jQuery.event.special,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6564 deleteExpando = jQuery.support.deleteExpando;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6565
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6566 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6567 if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6568 continue;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6569 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6570
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6571 id = elem[ jQuery.expando ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6572
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6573 if ( id ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6574 data = cache[ id ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6575
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6576 if ( data && data.events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6577 for ( var type in data.events ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6578 if ( special[ type ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6579 jQuery.event.remove( elem, type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6580
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6581 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6582 jQuery.removeEvent( elem, type, data.handle );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6583 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6584 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6585 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6586
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6587 if ( deleteExpando ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6588 delete elem[ jQuery.expando ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6589
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6590 } else if ( elem.removeAttribute ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6591 elem.removeAttribute( jQuery.expando );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6592 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6593
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6594 delete cache[ id ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6595 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6596 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6597 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6598 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6599
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6600 function evalScript( i, elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6601 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6602 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6603 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6604 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6605
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6606 if ( elem.src ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6607 jQuery.ajax({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6608 url: elem.src,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6609 async: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6610 dataType: "script"
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6611 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6612 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6613 jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6614 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6615
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6616 if ( elem.parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6617 elem.parentNode.removeChild( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6618 }
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6622
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6623
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6624 var ralpha = /alpha\([^)]*\)/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6625 ropacity = /opacity=([^)]*)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6626 rdashAlpha = /-([a-z])/ig,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6627 rupper = /([A-Z])/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6628 rnumpx = /^-?\d+(?:px)?$/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6629 rnum = /^-?\d/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6630
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6631 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6632 cssWidth = [ "Left", "Right" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6633 cssHeight = [ "Top", "Bottom" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6634 curCSS,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6635
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6636 getComputedStyle,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6637 currentStyle,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6638
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6639 fcamelCase = function( all, letter ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6640 return letter.toUpperCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6641 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6642
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6643 jQuery.fn.css = function( name, value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6644 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6645 /// Set a single style property to a value, on all matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6646 /// If a number is provided, it is automatically converted into a pixel value.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6647 /// Part of CSS
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6648 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6649 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6650 /// <param name="name" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6651 /// A CSS property name.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6652 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6653 /// <param name="value" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6654 /// A value to set for the property.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6655 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6656
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6657 // Setting 'undefined' is a no-op
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6658 if ( arguments.length === 2 && value === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6659 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6660 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6661
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6662 return jQuery.access( this, name, value, true, function( elem, name, value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6663 return value !== undefined ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6664 jQuery.style( elem, name, value ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6665 jQuery.css( elem, name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6666 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6667 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6668
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6669 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6670 // Add in style property hooks for overriding the default
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6671 // behavior of getting and setting a style property
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6672 cssHooks: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6673 opacity: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6674 get: function( elem, computed ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6675 if ( computed ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6676 // We should always get a number back from opacity
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6677 var ret = curCSS( elem, "opacity", "opacity" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6678 return ret === "" ? "1" : ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6679
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6680 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6681 return elem.style.opacity;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6682 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6683 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6684 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6685 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6686
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6687 // Exclude the following css properties to add px
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6688 cssNumber: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6689 "zIndex": true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6690 "fontWeight": true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6691 "opacity": true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6692 "zoom": true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6693 "lineHeight": true
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6694 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6695
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6696 // Add in properties whose names you wish to fix before
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6697 // setting or getting the value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6698 cssProps: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6699 // normalize float css property
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6700 "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6701 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6702
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6703 // Get and set the style property on a DOM Node
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6704 style: function( elem, name, value, extra ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6705 // Don't set styles on text and comment nodes
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6706 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6707 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6708 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6709
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6710 // Make sure that we're working with the right name
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6711 var ret, origName = jQuery.camelCase( name ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6712 style = elem.style, hooks = jQuery.cssHooks[ origName ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6713
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6714 name = jQuery.cssProps[ origName ] || origName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6715
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6716 // Check if we're setting a value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6717 if ( value !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6718 // Make sure that NaN and null values aren't set. See: #7116
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6719 if ( typeof value === "number" && isNaN( value ) || value == null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6720 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6721 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6722
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6723 // 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
6724 if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6725 value += "px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6726 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6727
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6728 // If a hook was provided, use that value, otherwise just set the specified value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6729 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6730 // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6731 // Fixes bug #5509
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6732 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6733 style[ name ] = value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6734 } catch(e) {}
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 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6738 // If a hook was provided get the non-computed value from there
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6739 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6740 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6741 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6742
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6743 // Otherwise just get the value from the style object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6744 return style[ name ];
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6748 css: function( elem, name, extra ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6749 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6750 /// This method is internal only.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6751 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6752 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6753
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6754 // Make sure that we're working with the right name
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6755 var ret, origName = jQuery.camelCase( name ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6756 hooks = jQuery.cssHooks[ origName ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6757
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6758 name = jQuery.cssProps[ origName ] || origName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6759
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6760 // If a hook was provided get the computed value from there
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6761 if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6762 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6763
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6764 // Otherwise, if a way to get the computed value exists, use that
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6765 } else if ( curCSS ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6766 return curCSS( elem, name, origName );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6767 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6768 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6769
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6770 // A method for quickly swapping in/out CSS properties to get correct calculations
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6771 swap: function( elem, options, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6772 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6773 /// Swap in/out style options.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6774 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6775
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6776 var old = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6777
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6778 // Remember the old values, and insert the new ones
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6779 for ( var name in options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6780 old[ name ] = elem.style[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6781 elem.style[ name ] = options[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6782 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6783
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6784 callback.call( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6785
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6786 // Revert the old values
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6787 for ( name in options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6788 elem.style[ name ] = old[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6789 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6790 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6791
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6792 camelCase: function( string ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6793 return string.replace( rdashAlpha, fcamelCase );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6794 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6795 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6796
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6797 // DEPRECATED, Use jQuery.css() instead
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6798 jQuery.curCSS = jQuery.css;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6799
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6800 jQuery.each(["height", "width"], function( i, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6801 jQuery.cssHooks[ name ] = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6802 get: function( elem, computed, extra ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6803 var val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6804
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6805 if ( computed ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6806 if ( elem.offsetWidth !== 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6807 val = getWH( elem, name, extra );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6808
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6809 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6810 jQuery.swap( elem, cssShow, function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6811 val = getWH( elem, name, extra );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6812 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6813 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6814
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6815 if ( val <= 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6816 val = curCSS( elem, name, name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6817
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6818 if ( val === "0px" && currentStyle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6819 val = currentStyle( elem, name, name );
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 ( val != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6823 // Should return "auto" instead of 0, use 0 for
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6824 // temporary backwards-compat
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6825 return val === "" || val === "auto" ? "0px" : val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6826 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6827 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6828
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6829 if ( val < 0 || val == null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6830 val = elem.style[ name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6831
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6832 // Should return "auto" instead of 0, use 0 for
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6833 // temporary backwards-compat
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6834 return val === "" || val === "auto" ? "0px" : val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6835 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6836
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6837 return typeof val === "string" ? val : val + "px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6838 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6839 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6840
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6841 set: function( elem, value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6842 if ( rnumpx.test( value ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6843 // ignore negative width and height values #1599
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6844 value = parseFloat(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6845
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6846 if ( value >= 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6847 return value + "px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6848 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6849
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6850 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6851 return value;
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 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6855 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6856
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6857 if ( !jQuery.support.opacity ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6858 jQuery.cssHooks.opacity = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6859 get: function( elem, computed ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6860 // IE uses filters for opacity
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6861 return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6862 (parseFloat(RegExp.$1) / 100) + "" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6863 computed ? "1" : "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6864 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6865
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6866 set: function( elem, value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6867 var style = elem.style;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6868
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6869 // IE has trouble with opacity if it does not have layout
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6870 // Force it by setting the zoom level
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6871 style.zoom = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6872
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6873 // Set the alpha filter to set the opacity
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6874 var opacity = jQuery.isNaN(value) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6875 "" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6876 "alpha(opacity=" + value * 100 + ")",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6877 filter = style.filter || "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6878
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6879 style.filter = ralpha.test(filter) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6880 filter.replace(ralpha, opacity) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6881 style.filter + ' ' + opacity;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6882 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6883 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6884 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6885
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6886 if ( document.defaultView && document.defaultView.getComputedStyle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6887 getComputedStyle = function( elem, newName, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6888 var ret, defaultView, computedStyle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6889
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6890 name = name.replace( rupper, "-$1" ).toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6891
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6892 if ( !(defaultView = elem.ownerDocument.defaultView) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6893 return undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6894 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6895
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6896 if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6897 ret = computedStyle.getPropertyValue( name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6898 if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6899 ret = jQuery.style( elem, name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6900 }
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 return ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6904 };
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 ( document.documentElement.currentStyle ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6908 currentStyle = function( elem, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6909 var left, rsLeft,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6910 ret = elem.currentStyle && elem.currentStyle[ name ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6911 style = elem.style;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6912
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6913 // From the awesome hack by Dean Edwards
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6914 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6915
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6916 // If we're not dealing with a regular pixel number
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6917 // 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
6918 if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6919 // Remember the original values
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6920 left = style.left;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6921 rsLeft = elem.runtimeStyle.left;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6922
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6923 // Put in the new values to get a computed value out
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6924 elem.runtimeStyle.left = elem.currentStyle.left;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6925 style.left = name === "fontSize" ? "1em" : (ret || 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6926 ret = style.pixelLeft + "px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6927
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6928 // Revert the changed values
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6929 style.left = left;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6930 elem.runtimeStyle.left = rsLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6931 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6932
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6933 return ret === "" ? "auto" : ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6934 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6935 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6936
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6937 curCSS = getComputedStyle || currentStyle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6938
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6939 function getWH( elem, name, extra ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6940 var which = name === "width" ? cssWidth : cssHeight,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6941 val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6942
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6943 if ( extra === "border" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6944 return val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6945 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6946
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6947 jQuery.each( which, function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6948 if ( !extra ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6949 val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6950 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6951
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6952 if ( extra === "margin" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6953 val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6954
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6955 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6956 val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6957 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6958 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6959
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6960 return val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6961 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6962
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6963 if ( jQuery.expr && jQuery.expr.filters ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6964 jQuery.expr.filters.hidden = function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6965 var width = elem.offsetWidth,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6966 height = elem.offsetHeight;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6967
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6968 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
6969 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6970
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6971 jQuery.expr.filters.visible = function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6972 return !jQuery.expr.filters.hidden( elem );
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
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
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6979 var jsc = jQuery.now(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6980 rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6981 rselectTextarea = /^(?:select|textarea)/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6982 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
6983 rnoContent = /^(?:GET|HEAD)$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6984 rbracket = /\[\]$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6985 jsre = /\=\?(&|$)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6986 rquery = /\?/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6987 rts = /([?&])_=[^&]*/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6988 rurl = /^(\w+:)?\/\/([^\/?#]+)/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6989 r20 = /%20/g,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6990 rhash = /#.*$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6991
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6992 // Keep a copy of the old load method
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6993 _load = jQuery.fn.load;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6994
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6995 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6996 load: function( url, params, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6997 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6998 /// Loads HTML from a remote file and injects it into the DOM. By default performs a GET request, but if parameters are included
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6999 /// then a POST will be performed.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7000 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7001 /// <param name="url" type="String">The URL of the HTML page to load.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7002 /// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7003 /// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(responseText, textStatus, XMLHttpRequest) such that this maps the injected DOM element.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7004 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7005
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7006 if ( typeof url !== "string" && _load ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7007 return _load.apply( this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7008
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7009 // Don't do a request if no elements are being requested
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7010 } else if ( !this.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7011 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7012 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7013
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7014 var off = url.indexOf(" ");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7015 if ( off >= 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7016 var selector = url.slice(off, url.length);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7017 url = url.slice(0, off);
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 // Default to a GET request
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7021 var type = "GET";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7022
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7023 // If the second parameter was provided
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7024 if ( params ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7025 // If it's a function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7026 if ( jQuery.isFunction( params ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7027 // We assume that it's the callback
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7028 callback = params;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7029 params = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7030
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7031 // Otherwise, build a param string
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7032 } else if ( typeof params === "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7033 params = jQuery.param( params, jQuery.ajaxSettings.traditional );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7034 type = "POST";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7035 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7036 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7037
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7038 var self = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7039
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7040 // Request the remote document
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7041 jQuery.ajax({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7042 url: url,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7043 type: type,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7044 dataType: "html",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7045 data: params,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7046 complete: function( res, status ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7047 // If successful, inject the HTML into all the matched elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7048 if ( status === "success" || status === "notmodified" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7049 // See if a selector was specified
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7050 self.html( selector ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7051 // Create a dummy div to hold the results
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7052 jQuery("<div>")
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7053 // inject the contents of the document in, removing the scripts
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7054 // to avoid any 'Permission Denied' errors in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7055 .append(res.responseText.replace(rscript, ""))
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7056
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7057 // Locate the specified elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7058 .find(selector) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7059
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7060 // If not, just inject the full result
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7061 res.responseText );
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 if ( callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7065 self.each( callback, [res.responseText, status, res] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7066 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7067 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7068 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7069
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7070 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7071 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7072
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7073 serialize: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7074 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7075 /// Serializes a set of input elements into a string of data.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7076 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7077 /// <returns type="String">The serialized result</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7078
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7079 return jQuery.param(this.serializeArray());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7080 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7081
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7082 serializeArray: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7083 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7084 /// Serializes all forms and form elements but returns a JSON data structure.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7085 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7086 /// <returns type="String">A JSON data structure representing the serialized items.</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7087
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7088 return this.map(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7089 return this.elements ? jQuery.makeArray(this.elements) : this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7090 })
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7091 .filter(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7092 return this.name && !this.disabled &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7093 (this.checked || rselectTextarea.test(this.nodeName) ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7094 rinput.test(this.type));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7095 })
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7096 .map(function( i, elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7097 var val = jQuery(this).val();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7098
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7099 return val == null ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7100 null :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7101 jQuery.isArray(val) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7102 jQuery.map( val, function( val, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7103 return { name: elem.name, value: val };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7104 }) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7105 { name: elem.name, value: val };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7106 }).get();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7107 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7108 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7109
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7110 // Attach a bunch of functions for handling common AJAX events
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7111 // jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7112 // jQuery.fn[o] = function( f ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7113 // return this.bind(o, f);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7114 // };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7115 // });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7116
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7117 jQuery.fn["ajaxStart"] = function( f ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7118 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7119 /// Attach a function to be executed whenever an AJAX request begins and there is none already active. This is an Ajax Event.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7120 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7121 /// <param name="f" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7122 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7123
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7124 return this.bind("ajaxStart", f);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7125 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7126
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7127 jQuery.fn["ajaxStop"] = function( f ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7128 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7129 /// Attach a function to be executed whenever all AJAX requests have ended. This is an Ajax Event.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7130 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7131 /// <param name="f" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7132 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7133
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7134 return this.bind("ajaxStop", f);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7135 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7136
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7137 jQuery.fn["ajaxComplete"] = function( f ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7138 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7139 /// Attach a function to be executed whenever an AJAX request completes. This is an Ajax Event.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7140 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7141 /// <param name="f" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7142 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7143
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7144 return this.bind("ajaxComplete", f);
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 jQuery.fn["ajaxError"] = function( f ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7148 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7149 /// Attach a function to be executed whenever an AJAX request fails. This is an Ajax Event.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7150 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7151 /// <param name="f" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7152 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7153
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7154 return this.bind("ajaxError", f);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7155 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7156
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7157 jQuery.fn["ajaxSuccess"] = function( f ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7158 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7159 /// Attach a function to be executed whenever an AJAX request completes successfully. This is an Ajax Event.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7160 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7161 /// <param name="f" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7162 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7163
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7164 return this.bind("ajaxSuccess", f);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7165 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7166
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7167 jQuery.fn["ajaxSend"] = function( f ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7168 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7169 /// Attach a function to be executed before an AJAX request is sent. This is an Ajax Event.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7170 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7171 /// <param name="f" type="Function">The function to execute.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7172 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7173
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7174 return this.bind("ajaxSend", f);
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 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7178 get: function( url, data, callback, type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7179 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7180 /// Loads a remote page using an HTTP GET request.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7181 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7182 /// <param name="url" type="String">The URL of the HTML page to load.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7183 /// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7184 /// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(responseText, textStatus) such that this maps the options for this AJAX request.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7185 /// <param name="type" optional="true" type="String">Type of data to be returned to callback function. Valid valiues are xml, html, script, json, text, _default.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7186 /// <returns type="XMLHttpRequest" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7187
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7188 // shift arguments if data argument was omited
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7189 if ( jQuery.isFunction( data ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7190 type = type || callback;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7191 callback = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7192 data = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7193 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7194
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7195 return jQuery.ajax({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7196 type: "GET",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7197 url: url,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7198 data: data,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7199 success: callback,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7200 dataType: type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7201 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7202 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7203
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7204 getScript: function( url, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7205 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7206 /// Loads and executes a local JavaScript file using an HTTP GET request.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7207 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7208 /// <param name="url" type="String">The URL of the script to load.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7209 /// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(data, textStatus) such that this maps the options for the AJAX request.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7210 /// <returns type="XMLHttpRequest" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7211
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7212 return jQuery.get(url, null, callback, "script");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7213 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7214
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7215 getJSON: function( url, data, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7216 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7217 /// Loads JSON data using an HTTP GET request.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7218 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7219 /// <param name="url" type="String">The URL of the JSON data to load.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7220 /// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7221 /// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete if the data is loaded successfully. It should map function(data, textStatus) such that this maps the options for this AJAX request.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7222 /// <returns type="XMLHttpRequest" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7223
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7224 return jQuery.get(url, data, callback, "json");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7225 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7226
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7227 post: function( url, data, callback, type ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7228 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7229 /// Loads a remote page using an HTTP POST request.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7230 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7231 /// <param name="url" type="String">The URL of the HTML page to load.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7232 /// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7233 /// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(responseText, textStatus) such that this maps the options for this AJAX request.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7234 /// <param name="type" optional="true" type="String">Type of data to be returned to callback function. Valid valiues are xml, html, script, json, text, _default.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7235 /// <returns type="XMLHttpRequest" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7236
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7237 // shift arguments if data argument was omited
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7238 if ( jQuery.isFunction( data ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7239 type = type || callback;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7240 callback = data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7241 data = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7242 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7243
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7244 return jQuery.ajax({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7245 type: "POST",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7246 url: url,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7247 data: data,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7248 success: callback,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7249 dataType: type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7250 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7251 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7252
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7253 ajaxSetup: function( settings ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7254 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7255 /// Sets up global settings for AJAX requests.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7256 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7257 /// <param name="settings" type="Options">A set of key/value pairs that configure the default Ajax request.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7258
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7259 jQuery.extend( jQuery.ajaxSettings, settings );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7260 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7261
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7262 ajaxSettings: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7263 url: location.href,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7264 global: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7265 type: "GET",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7266 contentType: "application/x-www-form-urlencoded",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7267 processData: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7268 async: true,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7269 /*
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7270 timeout: 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7271 data: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7272 username: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7273 password: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7274 traditional: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7275 */
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7276 // This function can be overriden by calling jQuery.ajaxSetup
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7277 xhr: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7278 return new window.XMLHttpRequest();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7279 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7280 accepts: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7281 xml: "application/xml, text/xml",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7282 html: "text/html",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7283 script: "text/javascript, application/javascript",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7284 json: "application/json, text/javascript",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7285 text: "text/plain",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7286 _default: "*/*"
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7287 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7288 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7289
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7290 ajax: function( origSettings ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7291 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7292 /// Load a remote page using an HTTP request.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7293 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7294 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7295
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7296 var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7297 jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7298
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7299 s.url = s.url.replace( rhash, "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7300
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7301 // Use original (not extended) context object if it was provided
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7302 s.context = origSettings && origSettings.context != null ? origSettings.context : s;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7303
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7304 // convert data if not already a string
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7305 if ( s.data && s.processData && typeof s.data !== "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7306 s.data = jQuery.param( s.data, s.traditional );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7307 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7308
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7309 // Handle JSONP Parameter Callbacks
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7310 if ( s.dataType === "jsonp" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7311 if ( type === "GET" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7312 if ( !jsre.test( s.url ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7313 s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7314 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7315 } else if ( !s.data || !jsre.test(s.data) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7316 s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7317 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7318 s.dataType = "json";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7319 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7320
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7321 // Build temporary JSONP function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7322 if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7323 jsonp = s.jsonpCallback || ("jsonp" + jsc++);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7324
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7325 // Replace the =? sequence both in the query string and the data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7326 if ( s.data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7327 s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7328 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7329
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7330 s.url = s.url.replace(jsre, "=" + jsonp + "$1");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7331
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7332 // We need to make sure
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7333 // that a JSONP style response is executed properly
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7334 s.dataType = "script";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7335
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7336 // Handle JSONP-style loading
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7337 var customJsonp = window[ jsonp ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7338
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7339 window[ jsonp ] = function( tmp ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7340 if ( jQuery.isFunction( customJsonp ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7341 customJsonp( tmp );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7342
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7343 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7344 // Garbage collect
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7345 window[ jsonp ] = undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7346
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7347 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7348 delete window[ jsonp ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7349 } catch( jsonpError ) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7350 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7351
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7352 data = tmp;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7353 jQuery.handleSuccess( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7354 jQuery.handleComplete( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7355
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7356 if ( head ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7357 head.removeChild( script );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7358 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7359 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7360 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7361
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7362 if ( s.dataType === "script" && s.cache === null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7363 s.cache = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7364 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7365
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7366 if ( s.cache === false && noContent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7367 var ts = jQuery.now();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7368
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7369 // try replacing _= if it is there
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7370 var ret = s.url.replace(rts, "$1_=" + ts);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7371
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7372 // if nothing was replaced, add timestamp to the end
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7373 s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7374 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7375
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7376 // If data is available, append data to url for GET/HEAD requests
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7377 if ( s.data && noContent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7378 s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7379 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7380
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7381 // Watch for a new set of requests
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7382 if ( s.global && jQuery.active++ === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7383 jQuery.event.trigger( "ajaxStart" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7384 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7385
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7386 // Matches an absolute URL, and saves the domain
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7387 var parts = rurl.exec( s.url ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7388 remote = parts && (parts[1] && parts[1].toLowerCase() !== location.protocol || parts[2].toLowerCase() !== location.host);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7389
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7390 // If we're requesting a remote document
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7391 // and trying to load JSON or Script with a GET
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7392 if ( s.dataType === "script" && type === "GET" && remote ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7393 var head = document.getElementsByTagName("head")[0] || document.documentElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7394 var script = document.createElement("script");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7395 if ( s.scriptCharset ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7396 script.charset = s.scriptCharset;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7397 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7398 script.src = s.url;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7399
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7400 // Handle Script loading
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7401 if ( !jsonp ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7402 var done = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7403
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7404 // Attach handlers for all browsers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7405 script.onload = script.onreadystatechange = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7406 if ( !done && (!this.readyState ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7407 this.readyState === "loaded" || this.readyState === "complete") ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7408 done = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7409 jQuery.handleSuccess( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7410 jQuery.handleComplete( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7411
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7412 // Handle memory leak in IE
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7413 script.onload = script.onreadystatechange = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7414 if ( head && script.parentNode ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7415 head.removeChild( script );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7416 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7417 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7418 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7419 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7420
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7421 // Use insertBefore instead of appendChild to circumvent an IE6 bug.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7422 // This arises when a base node is used (#2709 and #4378).
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7423 head.insertBefore( script, head.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7424
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7425 // We handle everything using the script element injection
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7426 return undefined;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7427 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7428
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7429 var requestDone = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7430
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7431 // Create the request object
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7432 var xhr = s.xhr();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7433
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7434 if ( !xhr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7435 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7436 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7437
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7438 // Open the socket
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7439 // Passing null username, generates a login popup on Opera (#2865)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7440 if ( s.username ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7441 xhr.open(type, s.url, s.async, s.username, s.password);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7442 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7443 xhr.open(type, s.url, s.async);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7444 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7445
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7446 // Need an extra try/catch for cross domain requests in Firefox 3
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7447 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7448 // Set content-type if data specified and content-body is valid for this type
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7449 if ( (s.data != null && !noContent) || (origSettings && origSettings.contentType) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7450 xhr.setRequestHeader("Content-Type", s.contentType);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7451 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7452
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7453 // 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
7454 if ( s.ifModified ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7455 if ( jQuery.lastModified[s.url] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7456 xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7457 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7458
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7459 if ( jQuery.etag[s.url] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7460 xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7461 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7462 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7463
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7464 // Set header so the called script knows that it's an XMLHttpRequest
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7465 // Only send the header if it's not a remote XHR
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7466 if ( !remote ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7467 xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7468 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7469
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7470 // Set the Accepts header for the server, depending on the dataType
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7471 xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7472 s.accepts[ s.dataType ] + ", */*; q=0.01" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7473 s.accepts._default );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7474 } catch( headerError ) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7475
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7476 // Allow custom headers/mimetypes and early abort
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7477 if ( s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7478 // Handle the global AJAX counter
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7479 if ( s.global && jQuery.active-- === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7480 jQuery.event.trigger( "ajaxStop" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7481 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7482
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7483 // close opended socket
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7484 xhr.abort();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7485 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7486 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7487
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7488 if ( s.global ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7489 jQuery.triggerGlobal( s, "ajaxSend", [xhr, s] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7490 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7491
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7492 // Wait for a response to come back
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7493 var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7494 // The request was aborted
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7495 if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7496 // Opera doesn't call onreadystatechange before this point
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7497 // so we simulate the call
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7498 if ( !requestDone ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7499 jQuery.handleComplete( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7500 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7501
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7502 requestDone = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7503 if ( xhr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7504 xhr.onreadystatechange = jQuery.noop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7505 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7506
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7507 // The transfer is complete and the data is available, or the request timed out
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7508 } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7509 requestDone = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7510 xhr.onreadystatechange = jQuery.noop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7511
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7512 status = isTimeout === "timeout" ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7513 "timeout" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7514 !jQuery.httpSuccess( xhr ) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7515 "error" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7516 s.ifModified && jQuery.httpNotModified( xhr, s.url ) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7517 "notmodified" :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7518 "success";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7519
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7520 var errMsg;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7521
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7522 if ( status === "success" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7523 // Watch for, and catch, XML document parse errors
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7524 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7525 // process the data (runs the xml through httpData regardless of callback)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7526 data = jQuery.httpData( xhr, s.dataType, s );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7527 } catch( parserError ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7528 status = "parsererror";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7529 errMsg = parserError;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7530 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7531 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7532
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7533 // Make sure that the request was successful or notmodified
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7534 if ( status === "success" || status === "notmodified" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7535 // JSONP handles its own success callback
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7536 if ( !jsonp ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7537 jQuery.handleSuccess( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7538 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7539 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7540 jQuery.handleError( s, xhr, status, errMsg );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7541 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7542
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7543 // Fire the complete handlers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7544 if ( !jsonp ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7545 jQuery.handleComplete( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7546 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7547
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7548 if ( isTimeout === "timeout" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7549 xhr.abort();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7550 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7551
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7552 // Stop memory leaks
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7553 if ( s.async ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7554 xhr = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7555 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7556 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7557 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7558
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7559 // 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
7560 // Opera doesn't fire onreadystatechange at all on abort
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7561 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7562 var oldAbort = xhr.abort;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7563 xhr.abort = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7564 if ( xhr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7565 // oldAbort has no call property in IE7 so
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7566 // just do it this way, which works in all
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7567 // browsers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7568 Function.prototype.call.call( oldAbort, xhr );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7569 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7570
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7571 onreadystatechange( "abort" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7572 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7573 } catch( abortError ) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7574
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7575 // Timeout checker
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7576 if ( s.async && s.timeout > 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7577 setTimeout(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7578 // Check to see if the request is still happening
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7579 if ( xhr && !requestDone ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7580 onreadystatechange( "timeout" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7581 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7582 }, s.timeout);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7583 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7584
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7585 // Send the data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7586 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7587 xhr.send( noContent || s.data == null ? null : s.data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7588
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7589 } catch( sendError ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7590 jQuery.handleError( s, xhr, null, sendError );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7591
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7592 // Fire the complete handlers
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7593 jQuery.handleComplete( s, xhr, status, data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7594 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7595
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7596 // firefox 1.5 doesn't fire statechange for sync requests
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7597 if ( !s.async ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7598 onreadystatechange();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7599 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7600
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7601 // return XMLHttpRequest to allow aborting the request etc.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7602 return xhr;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7603 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7604
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7605 // Serialize an array of form elements or a set of
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7606 // key/values into a query string
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7607 param: function( a, traditional ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7608 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7609 /// Create a serialized representation of an array or object, suitable for use in a URL
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7610 /// query string or Ajax request.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7611 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7612 /// <param name="a" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7613 /// An array or object to serialize.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7614 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7615 /// <param name="traditional" type="Boolean">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7616 /// A Boolean indicating whether to perform a traditional "shallow" serialization.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7617 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7618 /// <returns type="String" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7619
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7620 var s = [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7621 add = function( key, value ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7622 // If value is a function, invoke it and return its value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7623 value = jQuery.isFunction(value) ? value() : value;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7624 s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7625 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7626
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7627 // Set traditional to true for jQuery <= 1.3.2 behavior.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7628 if ( traditional === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7629 traditional = jQuery.ajaxSettings.traditional;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7630 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7631
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7632 // 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
7633 if ( jQuery.isArray(a) || a.jquery ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7634 // Serialize the form elements
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7635 jQuery.each( a, function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7636 add( this.name, this.value );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7637 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7638
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7639 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7640 // If traditional, encode the "old" way (the way 1.3.2 or older
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7641 // did it), otherwise encode params recursively.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7642 for ( var prefix in a ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7643 buildParams( prefix, a[prefix], traditional, add );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7644 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7645 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7646
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7647 // Return the resulting serialization
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7648 return s.join("&").replace(r20, "+");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7649 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7650 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7651
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7652 function buildParams( prefix, obj, traditional, add ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7653 if ( jQuery.isArray(obj) && obj.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7654 // Serialize array item.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7655 jQuery.each( obj, function( i, v ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7656 if ( traditional || rbracket.test( prefix ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7657 // Treat each array item as a scalar.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7658 add( prefix, v );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7659
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7660 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7661 // If array item is non-scalar (array or object), encode its
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7662 // numeric index to resolve deserialization ambiguity issues.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7663 // Note that rack (as of 1.0.0) can't currently deserialize
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7664 // nested arrays properly, and attempting to do so may cause
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7665 // a server error. Possible fixes are to modify rack's
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7666 // deserialization algorithm or to provide an option or flag
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7667 // to force array serialization to be shallow.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7668 buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7669 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7670 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7671
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7672 } else if ( !traditional && obj != null && typeof obj === "object" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7673 if ( jQuery.isEmptyObject( obj ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7674 add( prefix, "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7675
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7676 // Serialize object item.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7677 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7678 jQuery.each( obj, function( k, v ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7679 buildParams( prefix + "[" + k + "]", v, traditional, add );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7680 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7681 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7682
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7683 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7684 // Serialize scalar item.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7685 add( prefix, obj );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7686 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7687 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7688
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7689 // This is still on the jQuery object... for now
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7690 // Want to move this to jQuery.ajax some day
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7691 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7692
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7693 // Counter for holding the number of active queries
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7694 active: 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7695
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7696 // Last-Modified header cache for next request
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7697 lastModified: {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7698 etag: {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7699
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7700 handleError: function( s, xhr, status, e ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7701 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7702 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7703 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7704 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7705
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7706 // If a local callback was specified, fire it
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7707 if ( s.error ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7708 s.error.call( s.context, xhr, status, e );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7709 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7710
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7711 // Fire the global callback
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7712 if ( s.global ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7713 jQuery.triggerGlobal( s, "ajaxError", [xhr, s, e] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7714 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7715 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7716
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7717 handleSuccess: function( s, xhr, status, data ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7718 // If a local callback was specified, fire it and pass it the data
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7719 if ( s.success ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7720 s.success.call( s.context, data, status, xhr );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7721 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7722
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7723 // Fire the global callback
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7724 if ( s.global ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7725 jQuery.triggerGlobal( s, "ajaxSuccess", [xhr, s] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7726 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7727 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7728
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7729 handleComplete: function( s, xhr, status ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7730 // Process result
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7731 if ( s.complete ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7732 s.complete.call( s.context, xhr, status );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7733 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7734
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7735 // The request was completed
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7736 if ( s.global ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7737 jQuery.triggerGlobal( s, "ajaxComplete", [xhr, s] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7738 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7739
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7740 // Handle the global AJAX counter
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7741 if ( s.global && jQuery.active-- === 1 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7742 jQuery.event.trigger( "ajaxStop" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7743 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7744 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7745
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7746 triggerGlobal: function( s, type, args ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7747 (s.context && s.context.url == null ? jQuery(s.context) : jQuery.event).trigger(type, args);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7748 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7749
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7750 // Determines if an XMLHttpRequest was successful or not
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7751 httpSuccess: function( xhr ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7752 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7753 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7754 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7755 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7756
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7757 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7758 // 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
7759 return !xhr.status && location.protocol === "file:" ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7760 xhr.status >= 200 && xhr.status < 300 ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7761 xhr.status === 304 || xhr.status === 1223;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7762 } catch(e) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7763
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7764 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7765 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7766
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7767 // Determines if an XMLHttpRequest returns NotModified
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7768 httpNotModified: function( xhr, url ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7769 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7770 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7771 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7772 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7773
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7774 var lastModified = xhr.getResponseHeader("Last-Modified"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7775 etag = xhr.getResponseHeader("Etag");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7776
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7777 if ( lastModified ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7778 jQuery.lastModified[url] = lastModified;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7779 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7780
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7781 if ( etag ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7782 jQuery.etag[url] = etag;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7783 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7784
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7785 return xhr.status === 304;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7786 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7787
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7788 httpData: function( xhr, type, s ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7789 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7790 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7791 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7792 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7793
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7794 var ct = xhr.getResponseHeader("content-type") || "",
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7795 xml = type === "xml" || !type && ct.indexOf("xml") >= 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7796 data = xml ? xhr.responseXML : xhr.responseText;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7797
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7798 if ( xml && data.documentElement.nodeName === "parsererror" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7799 jQuery.error( "parsererror" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7800 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7801
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7802 // Allow a pre-filtering function to sanitize the response
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7803 // s is checked to keep backwards compatibility
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7804 if ( s && s.dataFilter ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7805 data = s.dataFilter( data, type );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7806 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7807
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7808 // The filter can actually parse the response
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7809 if ( typeof data === "string" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7810 // Get the JavaScript object, if JSON is used.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7811 if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7812 data = jQuery.parseJSON( data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7813
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7814 // If the type is "script", eval it in global context
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7815 } else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7816 jQuery.globalEval( data );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7817 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7818 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7819
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7820 return data;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7821 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7822
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7823 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7824
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7825 /*
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7826 * Create the request object; Microsoft failed to properly
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7827 * implement the XMLHttpRequest in IE7 (can't request local files),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7828 * so we use the ActiveXObject when it is available
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7829 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7830 * we need a fallback.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7831 */
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7832 if ( window.ActiveXObject ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7833 jQuery.ajaxSettings.xhr = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7834 if ( window.location.protocol !== "file:" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7835 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7836 return new window.XMLHttpRequest();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7837 } catch(xhrError) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7838 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7839
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7840 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7841 return new window.ActiveXObject("Microsoft.XMLHTTP");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7842 } catch(activeError) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7843 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7844 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7845
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7846 // Does this browser support XHR requests?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7847 jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7848
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7849
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7850
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7851
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7852 var elemdisplay = {},
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7853 rfxtypes = /^(?:toggle|show|hide)$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7854 rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7855 timerId,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7856 fxAttrs = [
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7857 // height animations
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7858 [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7859 // width animations
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7860 [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7861 // opacity animations
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7862 [ "opacity" ]
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7863 ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7864
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7865 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7866 show: function( speed, easing, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7867 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7868 /// Show all matched elements using a graceful animation and firing an optional callback after completion.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7869 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7870 /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7871 /// the number of milliseconds to run the animation</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7872 /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7873 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7874
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7875 var elem, display;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7876
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7877 if ( speed || speed === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7878 return this.animate( genFx("show", 3), speed, easing, callback);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7879
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7880 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7881 for ( var i = 0, j = this.length; i < j; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7882 elem = this[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7883 display = elem.style.display;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7884
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7885 // Reset the inline display of this element to learn if it is
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7886 // being hidden by cascaded rules or not
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7887 if ( !jQuery.data(elem, "olddisplay") && display === "none" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7888 display = elem.style.display = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7889 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7890
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7891 // Set elements which have been overridden with display: none
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7892 // in a stylesheet to whatever the default browser style is
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7893 // for such an element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7894 if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7895 jQuery.data(elem, "olddisplay", defaultDisplay(elem.nodeName));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7896 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7897 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7898
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7899 // Set the display of most of the elements in a second loop
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7900 // to avoid the constant reflow
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7901 for ( i = 0; i < j; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7902 elem = this[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7903 display = elem.style.display;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7904
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7905 if ( display === "" || display === "none" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7906 elem.style.display = jQuery.data(elem, "olddisplay") || "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7907 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7908 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7909
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7910 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7911 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7912 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7913
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7914 hide: function( speed, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7915 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7916 /// Hides all matched elements using a graceful animation and firing an optional callback after completion.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7917 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7918 /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7919 /// the number of milliseconds to run the animation</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7920 /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7921 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7922
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7923 if ( speed || speed === 0 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7924 return this.animate( genFx("hide", 3), speed, easing, callback);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7925
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7926 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7927 for ( var i = 0, j = this.length; i < j; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7928 var display = jQuery.css( this[i], "display" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7929
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7930 if ( display !== "none" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7931 jQuery.data( this[i], "olddisplay", display );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7932 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7933 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7934
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7935 // Set the display of the elements in a second loop
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7936 // to avoid the constant reflow
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7937 for ( i = 0; i < j; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7938 this[i].style.display = "none";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7939 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7940
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7941 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7942 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7943 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7944
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7945 // Save the old toggle function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7946 _toggle: jQuery.fn.toggle,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7947
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7948 toggle: function( fn, fn2, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7949 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7950 /// Toggles displaying each of the set of matched elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7951 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7952 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7953
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7954 var bool = typeof fn === "boolean";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7955
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7956 if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7957 this._toggle.apply( this, arguments );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7958
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7959 } else if ( fn == null || bool ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7960 this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7961 var state = bool ? fn : jQuery(this).is(":hidden");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7962 jQuery(this)[ state ? "show" : "hide" ]();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7963 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7964
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7965 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7966 this.animate(genFx("toggle", 3), fn, fn2, callback);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7967 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7968
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7969 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7970 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7971
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7972 fadeTo: function( speed, to, easing, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7973 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7974 /// Fades the opacity of all matched elements to a specified opacity.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7975 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7976 /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7977 /// the number of milliseconds to run the animation</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7978 /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7979 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7980
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7981 return this.filter(":hidden").css("opacity", 0).show().end()
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7982 .animate({opacity: to}, speed, easing, callback);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7983 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7984
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7985 animate: function( prop, speed, easing, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7986 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7987 /// A function for making custom animations.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7988 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7989 /// <param name="prop" type="Options">A set of style attributes that you wish to animate and to what end.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7990 /// <param name="speed" optional="true" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7991 /// the number of milliseconds to run the animation</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7992 /// <param name="easing" optional="true" type="String">The name of the easing effect that you want to use. There are two built-in values, 'linear' and 'swing'.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7993 /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7994 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7995
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7996 var optall = jQuery.speed(speed, easing, callback);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7997
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7998 if ( jQuery.isEmptyObject( prop ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7999 return this.each( optall.complete );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8000 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8001
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8002 return this[ optall.queue === false ? "each" : "queue" ](function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8003 // XXX 'this' does not always have a nodeName when running the
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8004 // test suite
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8005
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8006 var opt = jQuery.extend({}, optall), p,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8007 isElement = this.nodeType === 1,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8008 hidden = isElement && jQuery(this).is(":hidden"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8009 self = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8010
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8011 for ( p in prop ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8012 var name = jQuery.camelCase( p );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8013
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8014 if ( p !== name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8015 prop[ name ] = prop[ p ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8016 delete prop[ p ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8017 p = name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8018 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8019
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8020 if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8021 return opt.complete.call(this);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8022 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8023
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8024 if ( isElement && ( p === "height" || p === "width" ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8025 // Make sure that nothing sneaks out
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8026 // Record all 3 overflow attributes because IE does not
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8027 // change the overflow attribute when overflowX and
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8028 // overflowY are set to the same value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8029 opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8030
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8031 // Set display property to inline-block for height/width
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8032 // animations on inline elements that are having width/height
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8033 // animated
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8034 if ( jQuery.css( this, "display" ) === "inline" &&
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8035 jQuery.css( this, "float" ) === "none" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8036 if ( !jQuery.support.inlineBlockNeedsLayout ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8037 this.style.display = "inline-block";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8038
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8039 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8040 var display = defaultDisplay(this.nodeName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8041
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8042 // inline-level elements accept inline-block;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8043 // block-level elements need to be inline with layout
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8044 if ( display === "inline" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8045 this.style.display = "inline-block";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8046
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8047 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8048 this.style.display = "inline";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8049 this.style.zoom = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8050 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8051 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8052 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8053 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8054
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8055 if ( jQuery.isArray( prop[p] ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8056 // Create (if needed) and add to specialEasing
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8057 (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8058 prop[p] = prop[p][0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8059 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8060 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8061
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8062 if ( opt.overflow != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8063 this.style.overflow = "hidden";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8064 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8065
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8066 opt.curAnim = jQuery.extend({}, prop);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8067
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8068 jQuery.each( prop, function( name, val ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8069 var e = new jQuery.fx( self, opt, name );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8070
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8071 if ( rfxtypes.test(val) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8072 e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8073
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8074 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8075 var parts = rfxnum.exec(val),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8076 start = e.cur() || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8077
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8078 if ( parts ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8079 var end = parseFloat( parts[2] ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8080 unit = parts[3] || "px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8081
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8082 // We need to compute starting value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8083 if ( unit !== "px" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8084 jQuery.style( self, name, (end || 1) + unit);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8085 start = ((end || 1) / e.cur()) * start;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8086 jQuery.style( self, name, start + unit);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8087 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8088
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8089 // If a +=/-= token was provided, we're doing a relative animation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8090 if ( parts[1] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8091 end = ((parts[1] === "-=" ? -1 : 1) * end) + start;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8092 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8093
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8094 e.custom( start, end, unit );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8095
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8096 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8097 e.custom( start, val, "" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8098 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8099 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8100 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8101
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8102 // For JS strict compliance
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8103 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8104 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8105 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8106
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8107 stop: function( clearQueue, gotoEnd ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8108 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8109 /// Stops all currently animations on the specified elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8110 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8111 /// <param name="clearQueue" optional="true" type="Boolean">True to clear animations that are queued to run.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8112 /// <param name="gotoEnd" optional="true" type="Boolean">True to move the element value to the end of its animation target.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8113 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8114
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8115 var timers = jQuery.timers;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8116
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8117 if ( clearQueue ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8118 this.queue([]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8119 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8120
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8121 this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8122 // 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
8123 for ( var i = timers.length - 1; i >= 0; i-- ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8124 if ( timers[i].elem === this ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8125 if (gotoEnd) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8126 // force the next step to be the last
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8127 timers[i](true);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8128 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8129
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8130 timers.splice(i, 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8131 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8132 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8133 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8134
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8135 // start the next in the queue if the last step wasn't forced
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8136 if ( !gotoEnd ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8137 this.dequeue();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8138 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8139
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8140 return this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8141 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8142
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8143 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8144
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8145 function genFx( type, num ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8146 var obj = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8147
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8148 jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8149 obj[ this ] = type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8150 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8151
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8152 return obj;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8153 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8154
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8155 // Generate shortcuts for custom animations
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8156 // jQuery.each({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8157 // slideDown: genFx("show", 1),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8158 // slideUp: genFx("hide", 1),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8159 // slideToggle: genFx("toggle", 1),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8160 // fadeIn: { opacity: "show" },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8161 // fadeOut: { opacity: "hide" },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8162 // fadeToggle: { opacity: "toggle" }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8163 // }, function( name, props ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8164 // jQuery.fn[ name ] = function( speed, easing, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8165 // return this.animate( props, speed, easing, callback );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8166 // };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8167 // });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8168
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8169 jQuery.fn[ "slideDown" ] = function( speed, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8170 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8171 /// Reveal all matched elements by adjusting their height.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8172 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8173 /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8174 /// the number of milliseconds to run the animation</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8175 /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8176 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8177
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8178 return this.animate( genFx("show", 1), speed, callback );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8179 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8180
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8181 jQuery.fn[ "slideUp" ] = function( speed, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8182 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8183 /// Hiding all matched elements by adjusting their height.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8184 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8185 /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8186 /// the number of milliseconds to run the animation</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8187 /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8188 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8189
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8190 return this.animate( genFx("hide", 1), speed, callback );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8191 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8192
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8193 jQuery.fn[ "slideToggle" ] = function( speed, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8194 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8195 /// Toggles the visibility of all matched elements by adjusting their height.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8196 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8197 /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8198 /// the number of milliseconds to run the animation</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8199 /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8200 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8201
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8202 return this.animate( genFx("toggle", 1), speed, callback );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8203 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8204
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8205 jQuery.fn[ "fadeIn" ] = function( speed, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8206 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8207 /// Fades in all matched elements by adjusting their opacity.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8208 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8209 /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8210 /// the number of milliseconds to run the animation</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8211 /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8212 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8213
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8214 return this.animate( { opacity: "show" }, speed, callback );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8215 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8216
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8217 jQuery.fn[ "fadeOut" ] = function( speed, callback ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8218 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8219 /// Fades the opacity of all matched elements to a specified opacity.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8220 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8221 /// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8222 /// the number of milliseconds to run the animation</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8223 /// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8224 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8225
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8226 return this.animate( { opacity: "hide" }, speed, callback );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8227 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8228
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8229 jQuery.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8230 speed: function( speed, easing, fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8231 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8232 /// This member is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8233 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8234 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8235
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8236 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8237 complete: fn || !fn && easing ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8238 jQuery.isFunction( speed ) && speed,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8239 duration: speed,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8240 easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8241 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8242
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8243 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8244 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
8245
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8246 // Queueing
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8247 opt.old = opt.complete;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8248 opt.complete = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8249 if ( opt.queue !== false ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8250 jQuery(this).dequeue();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8251 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8252 if ( jQuery.isFunction( opt.old ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8253 opt.old.call( this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8254 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8255 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8256
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8257 return opt;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8258 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8259
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8260 easing: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8261 linear: function( p, n, firstNum, diff ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8262 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8263 /// This member is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8264 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8265 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8266
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8267 return firstNum + diff * p;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8268 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8269 swing: function( p, n, firstNum, diff ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8270 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8271 /// This member is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8272 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8273 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8274
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8275 return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8276 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8277 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8278
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8279 timers: [],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8280
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8281 fx: function( elem, options, prop ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8282 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8283 /// This member is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8284 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8285 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8286
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8287 this.options = options;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8288 this.elem = elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8289 this.prop = prop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8290
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8291 if ( !options.orig ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8292 options.orig = {};
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8293 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8294 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8295
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8296 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8297
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8298 jQuery.fx.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8299 // Simple function for setting a style value
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8300 update: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8301 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8302 /// This member is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8303 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8304 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8305
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8306 if ( this.options.step ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8307 this.options.step.call( this.elem, this.now, this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8308 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8309
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8310 (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8311 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8312
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8313 // Get the current size
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8314 cur: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8315 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8316 /// This member is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8317 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8318 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8319
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8320 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
8321 return this.elem[ this.prop ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8322 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8323
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8324 var r = parseFloat( jQuery.css( this.elem, this.prop ) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8325 return r && r > -10000 ? r : 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8326 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8327
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8328 // Start an animation from one number to another
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8329 custom: function( from, to, unit ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8330 var self = this,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8331 fx = jQuery.fx;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8332
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8333 this.startTime = jQuery.now();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8334 this.start = from;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8335 this.end = to;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8336 this.unit = unit || this.unit || "px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8337 this.now = this.start;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8338 this.pos = this.state = 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8339
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8340 function t( gotoEnd ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8341 return self.step(gotoEnd);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8342 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8343
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8344 t.elem = this.elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8345
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8346 if ( t() && jQuery.timers.push(t) && !timerId ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8347 timerId = setInterval(fx.tick, fx.interval);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8348 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8349 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8350
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8351 // Simple 'show' function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8352 show: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8353 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8354 /// Displays each of the set of matched elements if they are hidden.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8355 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8356
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8357 // Remember where we started, so that we can go back to it later
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8358 this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8359 this.options.show = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8360
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8361 // Begin the animation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8362 // Make sure that we start at a small width/height to avoid any
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8363 // flash of content
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8364 this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8365
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8366 // Start by showing the element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8367 jQuery( this.elem ).show();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8368 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8369
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8370 // Simple 'hide' function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8371 hide: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8372 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8373 /// Hides each of the set of matched elements if they are shown.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8374 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8375
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8376 // Remember where we started, so that we can go back to it later
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8377 this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8378 this.options.hide = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8379
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8380 // Begin the animation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8381 this.custom(this.cur(), 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8382 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8383
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8384 // Each step of an animation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8385 step: function( gotoEnd ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8386 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8387 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8388 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8389 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8390
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8391 var t = jQuery.now(), done = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8392
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8393 if ( gotoEnd || t >= this.options.duration + this.startTime ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8394 this.now = this.end;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8395 this.pos = this.state = 1;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8396 this.update();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8397
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8398 this.options.curAnim[ this.prop ] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8399
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8400 for ( var i in this.options.curAnim ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8401 if ( this.options.curAnim[i] !== true ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8402 done = false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8403 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8404 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8405
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8406 if ( done ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8407 // Reset the overflow
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8408 if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8409 var elem = this.elem,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8410 options = this.options;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8411
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8412 jQuery.each( [ "", "X", "Y" ], function (index, value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8413 elem.style[ "overflow" + value ] = options.overflow[index];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8414 } );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8415 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8416
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8417 // Hide the element if the "hide" operation was done
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8418 if ( this.options.hide ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8419 jQuery(this.elem).hide();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8420 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8421
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8422 // Reset the properties, if the item has been hidden or shown
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8423 if ( this.options.hide || this.options.show ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8424 for ( var p in this.options.curAnim ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8425 jQuery.style( this.elem, p, this.options.orig[p] );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8426 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8427 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8428
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8429 // Execute the complete function
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8430 this.options.complete.call( this.elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8431 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8432
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8433 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8434
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8435 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8436 var n = t - this.startTime;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8437 this.state = n / this.options.duration;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8438
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8439 // Perform the easing function, defaults to swing
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8440 var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8441 var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8442 this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8443 this.now = this.start + ((this.end - this.start) * this.pos);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8444
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8445 // Perform the next step of the animation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8446 this.update();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8447 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8448
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8449 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8450 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8451 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8452
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8453 jQuery.extend( jQuery.fx, {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8454 tick: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8455 var timers = jQuery.timers;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8456
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8457 for ( var i = 0; i < timers.length; i++ ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8458 if ( !timers[i]() ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8459 timers.splice(i--, 1);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8460 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8461 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8462
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8463 if ( !timers.length ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8464 jQuery.fx.stop();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8465 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8466 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8467
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8468 interval: 13,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8469
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8470 stop: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8471 clearInterval( timerId );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8472 timerId = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8473 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8474
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8475 speeds: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8476 slow: 600,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8477 fast: 200,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8478 // Default speed
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8479 _default: 400
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8480 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8481
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8482 step: {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8483 opacity: function( fx ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8484 jQuery.style( fx.elem, "opacity", fx.now );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8485 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8486
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8487 _default: function( fx ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8488 if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8489 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
8490 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8491 fx.elem[ fx.prop ] = fx.now;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8492 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8493 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8494 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8495 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8496
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8497 if ( jQuery.expr && jQuery.expr.filters ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8498 jQuery.expr.filters.animated = function( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8499 return jQuery.grep(jQuery.timers, function( fn ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8500 return elem === fn.elem;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8501 }).length;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8502 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8503 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8504
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8505 function defaultDisplay( nodeName ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8506 if ( !elemdisplay[ nodeName ] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8507 var elem = jQuery("<" + nodeName + ">").appendTo("body"),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8508 display = elem.css("display");
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8509
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8510 elem.remove();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8511
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8512 if ( display === "none" || display === "" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8513 display = "block";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8514 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8515
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8516 elemdisplay[ nodeName ] = display;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8517 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8518
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8519 return elemdisplay[ nodeName ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8520 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8521
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8522
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8523
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8524
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8525 var rtable = /^t(?:able|d|h)$/i,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8526 rroot = /^(?:body|html)$/i;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8527
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8528 if ( "getBoundingClientRect" in document.documentElement ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8529 jQuery.fn.offset = function( options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8530 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8531 /// Set the current coordinates of every element in the set of matched elements,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8532 /// relative to the document.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8533 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8534 /// <param name="options" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8535 /// An object containing the properties top and left, which are integers indicating the
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8536 /// new top and left coordinates for the elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8537 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8538 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8539
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8540 var elem = this[0], box;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8541
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8542 if ( options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8543 return this.each(function( i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8544 jQuery.offset.setOffset( this, options, i );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8545 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8546 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8547
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8548 if ( !elem || !elem.ownerDocument ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8549 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8550 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8551
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8552 if ( elem === elem.ownerDocument.body ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8553 return jQuery.offset.bodyOffset( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8554 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8555
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8556 try {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8557 box = elem.getBoundingClientRect();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8558 } catch(e) {}
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8559
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8560 var doc = elem.ownerDocument,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8561 docElem = doc.documentElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8562
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8563 // Make sure we're not dealing with a disconnected DOM node
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8564 if ( !box || !jQuery.contains( docElem, elem ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8565 return box || { top: 0, left: 0 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8566 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8567
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8568 var body = doc.body,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8569 win = getWindow(doc),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8570 clientTop = docElem.clientTop || body.clientTop || 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8571 clientLeft = docElem.clientLeft || body.clientLeft || 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8572 scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8573 scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8574 top = box.top + scrollTop - clientTop,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8575 left = box.left + scrollLeft - clientLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8576
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8577 return { top: top, left: left };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8578 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8579
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8580 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8581 jQuery.fn.offset = function( options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8582 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8583 /// Set the current coordinates of every element in the set of matched elements,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8584 /// relative to the document.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8585 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8586 /// <param name="options" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8587 /// An object containing the properties top and left, which are integers indicating the
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8588 /// new top and left coordinates for the elements.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8589 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8590 /// <returns type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8591
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8592 var elem = this[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8593
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8594 if ( options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8595 return this.each(function( i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8596 jQuery.offset.setOffset( this, options, i );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8597 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8598 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8599
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8600 if ( !elem || !elem.ownerDocument ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8601 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8602 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8603
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8604 if ( elem === elem.ownerDocument.body ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8605 return jQuery.offset.bodyOffset( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8606 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8607
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8608 jQuery.offset.initialize();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8609
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8610 var computedStyle,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8611 offsetParent = elem.offsetParent,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8612 prevOffsetParent = elem,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8613 doc = elem.ownerDocument,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8614 docElem = doc.documentElement,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8615 body = doc.body,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8616 defaultView = doc.defaultView,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8617 prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8618 top = elem.offsetTop,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8619 left = elem.offsetLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8620
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8621 while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8622 if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8623 break;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8624 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8625
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8626 computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8627 top -= elem.scrollTop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8628 left -= elem.scrollLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8629
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8630 if ( elem === offsetParent ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8631 top += elem.offsetTop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8632 left += elem.offsetLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8633
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8634 if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8635 top += parseFloat( computedStyle.borderTopWidth ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8636 left += parseFloat( computedStyle.borderLeftWidth ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8637 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8638
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8639 prevOffsetParent = offsetParent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8640 offsetParent = elem.offsetParent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8641 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8642
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8643 if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8644 top += parseFloat( computedStyle.borderTopWidth ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8645 left += parseFloat( computedStyle.borderLeftWidth ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8646 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8647
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8648 prevComputedStyle = computedStyle;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8649 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8650
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8651 if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8652 top += body.offsetTop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8653 left += body.offsetLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8654 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8655
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8656 if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8657 top += Math.max( docElem.scrollTop, body.scrollTop );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8658 left += Math.max( docElem.scrollLeft, body.scrollLeft );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8659 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8660
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8661 return { top: top, left: left };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8662 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8663 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8664
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8665 jQuery.offset = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8666 initialize: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8667 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
8668 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
8669
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8670 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
8671
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8672 container.innerHTML = html;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8673 body.insertBefore( container, body.firstChild );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8674 innerDiv = container.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8675 checkDiv = innerDiv.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8676 td = innerDiv.nextSibling.firstChild.firstChild;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8677
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8678 this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8679 this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8680
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8681 checkDiv.style.position = "fixed";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8682 checkDiv.style.top = "20px";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8683
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8684 // safari subtracts parent border width here which is 5px
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8685 this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8686 checkDiv.style.position = checkDiv.style.top = "";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8687
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8688 innerDiv.style.overflow = "hidden";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8689 innerDiv.style.position = "relative";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8690
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8691 this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8692
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8693 this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8694
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8695 body.removeChild( container );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8696 body = container = innerDiv = checkDiv = table = td = null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8697 jQuery.offset.initialize = jQuery.noop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8698 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8699
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8700 bodyOffset: function( body ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8701 var top = body.offsetTop,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8702 left = body.offsetLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8703
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8704 jQuery.offset.initialize();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8705
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8706 if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8707 top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8708 left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8709 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8710
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8711 return { top: top, left: left };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8712 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8713
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8714 setOffset: function( elem, options, i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8715 var position = jQuery.css( elem, "position" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8716
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8717 // set position first, in-case top/left are set even on static elem
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8718 if ( position === "static" ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8719 elem.style.position = "relative";
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8720 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8721
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8722 var curElem = jQuery( elem ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8723 curOffset = curElem.offset(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8724 curCSSTop = jQuery.css( elem, "top" ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8725 curCSSLeft = jQuery.css( elem, "left" ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8726 calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8727 props = {}, curPosition = {}, curTop, curLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8728
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8729 // 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
8730 if ( calculatePosition ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8731 curPosition = curElem.position();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8732 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8733
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8734 curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8735 curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8736
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8737 if ( jQuery.isFunction( options ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8738 options = options.call( elem, i, curOffset );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8739 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8740
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8741 if (options.top != null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8742 props.top = (options.top - curOffset.top) + curTop;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8743 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8744 if (options.left != null) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8745 props.left = (options.left - curOffset.left) + curLeft;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8746 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8747
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8748 if ( "using" in options ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8749 options.using.call( elem, props );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8750 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8751 curElem.css( props );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8752 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8753 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8754 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8755
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8756
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8757 jQuery.fn.extend({
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8758 position: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8759 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8760 /// Gets the top and left positions of an element relative to its offset parent.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8761 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8762 /// <returns type="Object">An object with two integer properties, 'top' and 'left'.</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8763
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8764 if ( !this[0] ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8765 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8766 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8767
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8768 var elem = this[0],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8769
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8770 // Get *real* offsetParent
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8771 offsetParent = this.offsetParent(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8772
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8773 // Get correct offsets
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8774 offset = this.offset(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8775 parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8776
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8777 // Subtract element margins
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8778 // note: when an element has margin: auto the offsetLeft and marginLeft
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8779 // are the same in Safari causing offset.left to incorrectly be 0
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8780 offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8781 offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8782
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8783 // Add offsetParent borders
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8784 parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8785 parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8786
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8787 // Subtract the two offsets
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8788 return {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8789 top: offset.top - parentOffset.top,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8790 left: offset.left - parentOffset.left
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8791 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8792 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8793
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8794 offsetParent: function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8795 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8796 /// This method is internal.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8797 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8798 /// <private />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8799
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8800 return this.map(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8801 var offsetParent = this.offsetParent || document.body;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8802 while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8803 offsetParent = offsetParent.offsetParent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8804 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8805 return offsetParent;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8806 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8807 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8808 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8809
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8810
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8811 // Create scrollLeft and scrollTop methods
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8812 jQuery.each( ["Left", "Top"], function( i, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8813 var method = "scroll" + name;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8814
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8815 jQuery.fn[ method ] = function(val) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8816 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8817 /// Gets and optionally sets the scroll left offset of the first matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8818 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8819 /// <param name="val" type="Number" integer="true" optional="true">A positive number representing the desired scroll left offset.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8820 /// <returns type="Number" integer="true">The scroll left offset of the first matched element.</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8821
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8822 var elem = this[0], win;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8823
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8824 if ( !elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8825 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8826 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8827
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8828 if ( val !== undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8829 // Set the scroll offset
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8830 return this.each(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8831 win = getWindow( this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8832
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8833 if ( win ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8834 win.scrollTo(
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8835 !i ? val : jQuery(win).scrollLeft(),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8836 i ? val : jQuery(win).scrollTop()
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8837 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8838
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8839 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8840 this[ method ] = val;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8841 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8842 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8843 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8844 win = getWindow( elem );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8845
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8846 // Return the scroll offset
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8847 return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8848 jQuery.support.boxModel && win.document.documentElement[ method ] ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8849 win.document.body[ method ] :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8850 elem[ method ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8851 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8852 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8853 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8854
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8855 function getWindow( elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8856 return jQuery.isWindow( elem ) ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8857 elem :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8858 elem.nodeType === 9 ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8859 elem.defaultView || elem.parentWindow :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8860 false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8861 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8862
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8863
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8864
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8865
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8866 // Create innerHeight, innerWidth, outerHeight and outerWidth methods
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8867 jQuery.each([ "Height" ], function( i, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8868
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8869 var type = name.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8870
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8871 // innerHeight and innerWidth
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8872 jQuery.fn["inner" + name] = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8873 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8874 /// Gets the inner height of the first matched element, excluding border but including padding.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8875 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8876 /// <returns type="Number" integer="true">The outer height of the first matched element.</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8877
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8878 return this[0] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8879 parseFloat( jQuery.css( this[0], type, "padding" ) ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8880 null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8881 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8882
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8883 // outerHeight and outerWidth
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8884 jQuery.fn["outer" + name] = function( margin ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8885 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8886 /// Gets the outer height of the first matched element, including border and padding by default.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8887 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8888 /// <param name="margins" type="Map">A set of key/value pairs that specify the options for the method.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8889 /// <returns type="Number" integer="true">The outer height of the first matched element.</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8890
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8891 return this[0] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8892 parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8893 null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8894 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8895
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8896 jQuery.fn[ type ] = function( size ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8897 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8898 /// Set the CSS height of every matched element. If no explicit unit
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8899 /// was specified (like 'em' or '%') then &quot;px&quot; is added to the width. If no parameter is specified, it gets
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8900 /// the current computed pixel height of the first matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8901 /// Part of CSS
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8902 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8903 /// <returns type="jQuery" type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8904 /// <param name="cssProperty" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8905 /// Set the CSS property to the specified value. Omit to get the value of the first matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8906 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8907
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8908 // Get window width or height
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8909 var elem = this[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8910 if ( !elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8911 return size == null ? null : this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8912 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8913
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8914 if ( jQuery.isFunction( size ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8915 return this.each(function( i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8916 var self = jQuery( this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8917 self[ type ]( size.call( this, i, self[ type ]() ) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8918 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8919 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8920
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8921 if ( jQuery.isWindow( elem ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8922 // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8923 return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8924 elem.document.body[ "client" + name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8925
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8926 // Get document width or height
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8927 } else if ( elem.nodeType === 9 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8928 // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8929 return Math.max(
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8930 elem.documentElement["client" + name],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8931 elem.body["scroll" + name], elem.documentElement["scroll" + name],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8932 elem.body["offset" + name], elem.documentElement["offset" + name]
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8933 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8934
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8935 // Get or set width or height on the element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8936 } else if ( size === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8937 var orig = jQuery.css( elem, type ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8938 ret = parseFloat( orig );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8939
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8940 return jQuery.isNaN( ret ) ? orig : ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8941
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8942 // 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
8943 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8944 return this.css( type, typeof size === "string" ? size : size + "px" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8945 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8946 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8947
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8948 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8949
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8950 // Create innerHeight, innerWidth, outerHeight and outerWidth methods
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8951 jQuery.each([ "Width" ], function( i, name ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8952
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8953 var type = name.toLowerCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8954
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8955 // innerHeight and innerWidth
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8956 jQuery.fn["inner" + name] = function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8957 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8958 /// Gets the inner width of the first matched element, excluding border but including padding.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8959 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8960 /// <returns type="Number" integer="true">The outer width of the first matched element.</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8961
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8962 return this[0] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8963 parseFloat( jQuery.css( this[0], type, "padding" ) ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8964 null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8965 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8966
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8967 // outerHeight and outerWidth
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8968 jQuery.fn["outer" + name] = function( margin ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8969 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8970 /// Gets the outer width of the first matched element, including border and padding by default.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8971 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8972 /// <param name="margin" type="Map">A set of key/value pairs that specify the options for the method.</param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8973 /// <returns type="Number" integer="true">The outer width of the first matched element.</returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8974
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8975 return this[0] ?
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8976 parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8977 null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8978 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8979
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8980 jQuery.fn[ type ] = function( size ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8981 /// <summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8982 /// Set the CSS width of every matched element. If no explicit unit
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8983 /// was specified (like 'em' or '%') then &quot;px&quot; is added to the width. If no parameter is specified, it gets
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8984 /// the current computed pixel width of the first matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8985 /// Part of CSS
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8986 /// </summary>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8987 /// <returns type="jQuery" type="jQuery" />
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8988 /// <param name="cssProperty" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8989 /// Set the CSS property to the specified value. Omit to get the value of the first matched element.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8990 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8991
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8992 // Get window width or height
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8993 var elem = this[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8994 if ( !elem ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8995 return size == null ? null : this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8996 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8997
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8998 if ( jQuery.isFunction( size ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8999 return this.each(function( i ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9000 var self = jQuery( this );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9001 self[ type ]( size.call( this, i, self[ type ]() ) );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9002 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9003 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9004
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9005 if ( jQuery.isWindow( elem ) ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9006 // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9007 return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9008 elem.document.body[ "client" + name ];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9009
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9010 // Get document width or height
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9011 } else if ( elem.nodeType === 9 ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9012 // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9013 return Math.max(
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9014 elem.documentElement["client" + name],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9015 elem.body["scroll" + name], elem.documentElement["scroll" + name],
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9016 elem.body["offset" + name], elem.documentElement["offset" + name]
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9017 );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9018
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9019 // Get or set width or height on the element
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9020 } else if ( size === undefined ) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9021 var orig = jQuery.css( elem, type ),
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9022 ret = parseFloat( orig );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9023
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9024 return jQuery.isNaN( ret ) ? orig : ret;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9025
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9026 // 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
9027 } else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9028 return this.css( type, typeof size === "string" ? size : size + "px" );
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9029 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9030 };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9031
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9032 });
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9033
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9034
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9035 })(window);