annotate jquery-1.10.2.js @ 9:7300ed4c1481 draft default tip

Uploaded
author saskia-hiltemann
date Mon, 04 Sep 2017 10:49:00 -0400
parents 440f4aa3db97
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1 /*!
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2 * jQuery JavaScript Library v1.10.2
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3 * http://jquery.com/
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4 *
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5 * Includes Sizzle.js
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6 * http://sizzlejs.com/
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7 *
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8 * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9 * Released under the MIT license
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
10 * http://jquery.org/license
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
11 *
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
12 * Date: 2013-07-03T13:48Z
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
13 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
14 (function( window, undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
15
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
16 // Can't do this because several apps including ASP.NET trace
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
17 // the stack via arguments.caller.callee and Firefox dies if
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
18 // you try to trace through "use strict" call chains. (#13335)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
19 // Support: Firefox 18+
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
20 //"use strict";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
21 var
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
22 // The deferred used on DOM ready
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
23 readyList,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
24
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
25 // A central reference to the root jQuery(document)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
26 rootjQuery,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
27
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
28 // Support: IE<10
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
29 // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
30 core_strundefined = typeof undefined,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
31
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
32 // Use the correct document accordingly with window argument (sandbox)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
33 location = window.location,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
34 document = window.document,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
35 docElem = document.documentElement,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
36
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
37 // Map over jQuery in case of overwrite
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
38 _jQuery = window.jQuery,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
39
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
40 // Map over the $ in case of overwrite
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
41 _$ = window.$,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
42
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
43 // [[Class]] -> type pairs
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
44 class2type = {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
45
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
46 // List of deleted data cache ids, so we can reuse them
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
47 core_deletedIds = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
48
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
49 core_version = "1.10.2",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
50
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
51 // Save a reference to some core methods
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
52 core_concat = core_deletedIds.concat,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
53 core_push = core_deletedIds.push,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
54 core_slice = core_deletedIds.slice,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
55 core_indexOf = core_deletedIds.indexOf,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
56 core_toString = class2type.toString,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
57 core_hasOwn = class2type.hasOwnProperty,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
58 core_trim = core_version.trim,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
59
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
60 // Define a local copy of jQuery
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
61 jQuery = function( selector, context ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
62 // The jQuery object is actually just the init constructor 'enhanced'
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
63 return new jQuery.fn.init( selector, context, rootjQuery );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
64 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
65
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
66 // Used for matching numbers
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
67 core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
68
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
69 // Used for splitting on whitespace
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
70 core_rnotwhite = /\S+/g,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
71
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
72 // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
73 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
74
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
75 // A simple way to check for HTML strings
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
76 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
77 // Strict HTML recognition (#11290: must start with <)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
78 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
79
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
80 // Match a standalone tag
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
81 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
82
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
83 // JSON RegExp
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
84 rvalidchars = /^[\],:{}\s]*$/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
85 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
86 rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
87 rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
88
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
89 // Matches dashed string for camelizing
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
90 rmsPrefix = /^-ms-/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
91 rdashAlpha = /-([\da-z])/gi,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
92
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
93 // Used by jQuery.camelCase as callback to replace()
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
94 fcamelCase = function( all, letter ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
95 return letter.toUpperCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
96 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
97
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
98 // The ready event handler
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
99 completed = function( event ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
100
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
101 // readyState === "complete" is good enough for us to call the dom ready in oldIE
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
102 if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
103 detach();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
104 jQuery.ready();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
105 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
106 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
107 // Clean-up method for dom ready events
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
108 detach = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
109 if ( document.addEventListener ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
110 document.removeEventListener( "DOMContentLoaded", completed, false );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
111 window.removeEventListener( "load", completed, false );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
112
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
113 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
114 document.detachEvent( "onreadystatechange", completed );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
115 window.detachEvent( "onload", completed );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
116 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
117 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
118
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
119 jQuery.fn = jQuery.prototype = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
120 // The current version of jQuery being used
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
121 jquery: core_version,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
122
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
123 constructor: jQuery,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
124 init: function( selector, context, rootjQuery ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
125 var match, elem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
126
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
127 // HANDLE: $(""), $(null), $(undefined), $(false)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
128 if ( !selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
129 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
130 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
131
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
132 // Handle HTML strings
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
133 if ( typeof selector === "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
134 if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
135 // Assume that strings that start and end with <> are HTML and skip the regex check
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
136 match = [ null, selector, null ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
137
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
138 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
139 match = rquickExpr.exec( selector );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
140 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
141
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
142 // Match html or make sure no context is specified for #id
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
143 if ( match && (match[1] || !context) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
144
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
145 // HANDLE: $(html) -> $(array)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
146 if ( match[1] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
147 context = context instanceof jQuery ? context[0] : context;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
148
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
149 // scripts is true for back-compat
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
150 jQuery.merge( this, jQuery.parseHTML(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
151 match[1],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
152 context && context.nodeType ? context.ownerDocument || context : document,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
153 true
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
154 ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
155
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
156 // HANDLE: $(html, props)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
157 if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
158 for ( match in context ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
159 // Properties of context are called as methods if possible
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
160 if ( jQuery.isFunction( this[ match ] ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
161 this[ match ]( context[ match ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
162
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
163 // ...and otherwise set as attributes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
164 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
165 this.attr( match, context[ match ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
166 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
167 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
168 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
169
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
170 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
171
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
172 // HANDLE: $(#id)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
173 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
174 elem = document.getElementById( match[2] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
175
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
176 // Check parentNode to catch when Blackberry 4.6 returns
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
177 // nodes that are no longer in the document #6963
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
178 if ( elem && elem.parentNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
179 // Handle the case where IE and Opera return items
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
180 // by name instead of ID
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
181 if ( elem.id !== match[2] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
182 return rootjQuery.find( selector );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
183 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
184
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
185 // Otherwise, we inject the element directly into the jQuery object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
186 this.length = 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
187 this[0] = elem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
188 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
189
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
190 this.context = document;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
191 this.selector = selector;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
192 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
193 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
194
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
195 // HANDLE: $(expr, $(...))
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
196 } else if ( !context || context.jquery ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
197 return ( context || rootjQuery ).find( selector );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
198
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
199 // HANDLE: $(expr, context)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
200 // (which is just equivalent to: $(context).find(expr)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
201 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
202 return this.constructor( context ).find( selector );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
203 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
204
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
205 // HANDLE: $(DOMElement)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
206 } else if ( selector.nodeType ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
207 this.context = this[0] = selector;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
208 this.length = 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
209 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
210
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
211 // HANDLE: $(function)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
212 // Shortcut for document ready
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
213 } else if ( jQuery.isFunction( selector ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
214 return rootjQuery.ready( selector );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
215 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
216
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
217 if ( selector.selector !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
218 this.selector = selector.selector;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
219 this.context = selector.context;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
220 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
221
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
222 return jQuery.makeArray( selector, this );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
223 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
224
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
225 // Start with an empty selector
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
226 selector: "",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
227
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
228 // The default length of a jQuery object is 0
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
229 length: 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
230
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
231 toArray: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
232 return core_slice.call( this );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
233 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
234
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
235 // Get the Nth element in the matched element set OR
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
236 // Get the whole matched element set as a clean array
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
237 get: function( num ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
238 return num == null ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
239
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
240 // Return a 'clean' array
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
241 this.toArray() :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
242
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
243 // Return just the object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
244 ( num < 0 ? this[ this.length + num ] : this[ num ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
245 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
246
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
247 // Take an array of elements and push it onto the stack
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
248 // (returning the new matched element set)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
249 pushStack: function( elems ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
250
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
251 // Build a new jQuery matched element set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
252 var ret = jQuery.merge( this.constructor(), elems );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
253
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
254 // Add the old object onto the stack (as a reference)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
255 ret.prevObject = this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
256 ret.context = this.context;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
257
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
258 // Return the newly-formed element set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
259 return ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
260 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
261
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
262 // Execute a callback for every element in the matched set.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
263 // (You can seed the arguments with an array of args, but this is
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
264 // only used internally.)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
265 each: function( callback, args ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
266 return jQuery.each( this, callback, args );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
267 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
268
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
269 ready: function( fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
270 // Add the callback
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
271 jQuery.ready.promise().done( fn );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
272
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
273 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
274 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
275
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
276 slice: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
277 return this.pushStack( core_slice.apply( this, arguments ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
278 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
279
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
280 first: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
281 return this.eq( 0 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
282 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
283
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
284 last: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
285 return this.eq( -1 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
286 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
287
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
288 eq: function( i ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
289 var len = this.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
290 j = +i + ( i < 0 ? len : 0 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
291 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
292 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
293
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
294 map: function( callback ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
295 return this.pushStack( jQuery.map(this, function( elem, i ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
296 return callback.call( elem, i, elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
297 }));
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
298 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
299
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
300 end: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
301 return this.prevObject || this.constructor(null);
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
302 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
303
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
304 // For internal use only.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
305 // Behaves like an Array's method, not like a jQuery method.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
306 push: core_push,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
307 sort: [].sort,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
308 splice: [].splice
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
309 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
310
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
311 // Give the init function the jQuery prototype for later instantiation
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
312 jQuery.fn.init.prototype = jQuery.fn;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
313
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
314 jQuery.extend = jQuery.fn.extend = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
315 var src, copyIsArray, copy, name, options, clone,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
316 target = arguments[0] || {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
317 i = 1,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
318 length = arguments.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
319 deep = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
320
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
321 // Handle a deep copy situation
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
322 if ( typeof target === "boolean" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
323 deep = target;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
324 target = arguments[1] || {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
325 // skip the boolean and the target
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
326 i = 2;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
327 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
328
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
329 // Handle case when target is a string or something (possible in deep copy)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
330 if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
331 target = {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
332 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
333
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
334 // extend jQuery itself if only one argument is passed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
335 if ( length === i ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
336 target = this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
337 --i;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
338 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
339
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
340 for ( ; i < length; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
341 // Only deal with non-null/undefined values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
342 if ( (options = arguments[ i ]) != null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
343 // Extend the base object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
344 for ( name in options ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
345 src = target[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
346 copy = options[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
347
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
348 // Prevent never-ending loop
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
349 if ( target === copy ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
350 continue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
351 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
352
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
353 // Recurse if we're merging plain objects or arrays
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
354 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
355 if ( copyIsArray ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
356 copyIsArray = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
357 clone = src && jQuery.isArray(src) ? src : [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
358
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
359 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
360 clone = src && jQuery.isPlainObject(src) ? src : {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
361 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
362
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
363 // Never move original objects, clone them
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
364 target[ name ] = jQuery.extend( deep, clone, copy );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
365
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
366 // Don't bring in undefined values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
367 } else if ( copy !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
368 target[ name ] = copy;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
369 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
370 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
371 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
372 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
373
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
374 // Return the modified object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
375 return target;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
376 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
377
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
378 jQuery.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
379 // Unique for each copy of jQuery on the page
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
380 // Non-digits removed to match rinlinejQuery
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
381 expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
382
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
383 noConflict: function( deep ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
384 if ( window.$ === jQuery ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
385 window.$ = _$;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
386 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
387
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
388 if ( deep && window.jQuery === jQuery ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
389 window.jQuery = _jQuery;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
390 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
391
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
392 return jQuery;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
393 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
394
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
395 // Is the DOM ready to be used? Set to true once it occurs.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
396 isReady: false,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
397
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
398 // A counter to track how many items to wait for before
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
399 // the ready event fires. See #6781
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
400 readyWait: 1,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
401
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
402 // Hold (or release) the ready event
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
403 holdReady: function( hold ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
404 if ( hold ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
405 jQuery.readyWait++;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
406 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
407 jQuery.ready( true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
408 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
409 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
410
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
411 // Handle when the DOM is ready
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
412 ready: function( wait ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
413
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
414 // Abort if there are pending holds or we're already ready
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
415 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
416 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
417 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
418
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
419 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
420 if ( !document.body ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
421 return setTimeout( jQuery.ready );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
422 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
423
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
424 // Remember that the DOM is ready
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
425 jQuery.isReady = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
426
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
427 // If a normal DOM Ready event fired, decrement, and wait if need be
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
428 if ( wait !== true && --jQuery.readyWait > 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
429 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
430 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
431
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
432 // If there are functions bound, to execute
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
433 readyList.resolveWith( document, [ jQuery ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
434
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
435 // Trigger any bound ready events
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
436 if ( jQuery.fn.trigger ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
437 jQuery( document ).trigger("ready").off("ready");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
438 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
439 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
440
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
441 // See test/unit/core.js for details concerning isFunction.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
442 // Since version 1.3, DOM methods and functions like alert
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
443 // aren't supported. They return false on IE (#2968).
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
444 isFunction: function( obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
445 return jQuery.type(obj) === "function";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
446 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
447
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
448 isArray: Array.isArray || function( obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
449 return jQuery.type(obj) === "array";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
450 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
451
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
452 isWindow: function( obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
453 /* jshint eqeqeq: false */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
454 return obj != null && obj == obj.window;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
455 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
456
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
457 isNumeric: function( obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
458 return !isNaN( parseFloat(obj) ) && isFinite( obj );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
459 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
460
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
461 type: function( obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
462 if ( obj == null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
463 return String( obj );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
464 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
465 return typeof obj === "object" || typeof obj === "function" ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
466 class2type[ core_toString.call(obj) ] || "object" :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
467 typeof obj;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
468 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
469
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
470 isPlainObject: function( obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
471 var key;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
472
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
473 // Must be an Object.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
474 // Because of IE, we also have to check the presence of the constructor property.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
475 // Make sure that DOM nodes and window objects don't pass through, as well
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
476 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
477 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
478 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
479
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
480 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
481 // Not own constructor property must be Object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
482 if ( obj.constructor &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
483 !core_hasOwn.call(obj, "constructor") &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
484 !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
485 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
486 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
487 } catch ( e ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
488 // IE8,9 Will throw exceptions on certain host objects #9897
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
489 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
490 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
491
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
492 // Support: IE<9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
493 // Handle iteration over inherited properties before own properties.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
494 if ( jQuery.support.ownLast ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
495 for ( key in obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
496 return core_hasOwn.call( obj, key );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
497 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
498 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
499
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
500 // Own properties are enumerated firstly, so to speed up,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
501 // if last one is own, then all properties are own.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
502 for ( key in obj ) {}
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
503
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
504 return key === undefined || core_hasOwn.call( obj, key );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
505 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
506
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
507 isEmptyObject: function( obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
508 var name;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
509 for ( name in obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
510 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
511 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
512 return true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
513 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
514
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
515 error: function( msg ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
516 throw new Error( msg );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
517 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
518
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
519 // data: string of html
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
520 // context (optional): If specified, the fragment will be created in this context, defaults to document
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
521 // keepScripts (optional): If true, will include scripts passed in the html string
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
522 parseHTML: function( data, context, keepScripts ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
523 if ( !data || typeof data !== "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
524 return null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
525 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
526 if ( typeof context === "boolean" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
527 keepScripts = context;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
528 context = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
529 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
530 context = context || document;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
531
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
532 var parsed = rsingleTag.exec( data ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
533 scripts = !keepScripts && [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
534
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
535 // Single tag
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
536 if ( parsed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
537 return [ context.createElement( parsed[1] ) ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
538 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
539
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
540 parsed = jQuery.buildFragment( [ data ], context, scripts );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
541 if ( scripts ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
542 jQuery( scripts ).remove();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
543 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
544 return jQuery.merge( [], parsed.childNodes );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
545 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
546
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
547 parseJSON: function( data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
548 // Attempt to parse using the native JSON parser first
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
549 if ( window.JSON && window.JSON.parse ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
550 return window.JSON.parse( data );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
551 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
552
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
553 if ( data === null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
554 return data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
555 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
556
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
557 if ( typeof data === "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
558
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
559 // Make sure leading/trailing whitespace is removed (IE can't handle it)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
560 data = jQuery.trim( data );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
561
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
562 if ( data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
563 // Make sure the incoming data is actual JSON
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
564 // Logic borrowed from http://json.org/json2.js
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
565 if ( rvalidchars.test( data.replace( rvalidescape, "@" )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
566 .replace( rvalidtokens, "]" )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
567 .replace( rvalidbraces, "")) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
568
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
569 return ( new Function( "return " + data ) )();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
570 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
571 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
572 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
573
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
574 jQuery.error( "Invalid JSON: " + data );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
575 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
576
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
577 // Cross-browser xml parsing
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
578 parseXML: function( data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
579 var xml, tmp;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
580 if ( !data || typeof data !== "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
581 return null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
582 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
583 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
584 if ( window.DOMParser ) { // Standard
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
585 tmp = new DOMParser();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
586 xml = tmp.parseFromString( data , "text/xml" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
587 } else { // IE
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
588 xml = new ActiveXObject( "Microsoft.XMLDOM" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
589 xml.async = "false";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
590 xml.loadXML( data );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
591 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
592 } catch( e ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
593 xml = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
594 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
595 if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
596 jQuery.error( "Invalid XML: " + data );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
597 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
598 return xml;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
599 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
600
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
601 noop: function() {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
602
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
603 // Evaluates a script in a global context
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
604 // Workarounds based on findings by Jim Driscoll
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
605 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
606 globalEval: function( data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
607 if ( data && jQuery.trim( data ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
608 // We use execScript on Internet Explorer
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
609 // We use an anonymous function so that context is window
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
610 // rather than jQuery in Firefox
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
611 ( window.execScript || function( data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
612 window[ "eval" ].call( window, data );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
613 } )( data );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
614 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
615 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
616
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
617 // Convert dashed to camelCase; used by the css and data modules
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
618 // Microsoft forgot to hump their vendor prefix (#9572)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
619 camelCase: function( string ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
620 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
621 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
622
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
623 nodeName: function( elem, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
624 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
625 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
626
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
627 // args is for internal usage only
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
628 each: function( obj, callback, args ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
629 var value,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
630 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
631 length = obj.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
632 isArray = isArraylike( obj );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
633
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
634 if ( args ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
635 if ( isArray ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
636 for ( ; i < length; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
637 value = callback.apply( obj[ i ], args );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
638
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
639 if ( value === false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
640 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
641 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
642 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
643 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
644 for ( i in obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
645 value = callback.apply( obj[ i ], args );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
646
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
647 if ( value === false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
648 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
649 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
650 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
651 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
652
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
653 // A special, fast, case for the most common use of each
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
654 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
655 if ( isArray ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
656 for ( ; i < length; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
657 value = callback.call( obj[ i ], i, obj[ i ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
658
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
659 if ( value === false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
660 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
661 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
662 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
663 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
664 for ( i in obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
665 value = callback.call( obj[ i ], i, obj[ i ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
666
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
667 if ( value === false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
668 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
669 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
670 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
671 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
672 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
673
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
674 return obj;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
675 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
676
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
677 // Use native String.trim function wherever possible
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
678 trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
679 function( text ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
680 return text == null ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
681 "" :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
682 core_trim.call( text );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
683 } :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
684
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
685 // Otherwise use our own trimming functionality
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
686 function( text ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
687 return text == null ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
688 "" :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
689 ( text + "" ).replace( rtrim, "" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
690 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
691
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
692 // results is for internal usage only
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
693 makeArray: function( arr, results ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
694 var ret = results || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
695
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
696 if ( arr != null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
697 if ( isArraylike( Object(arr) ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
698 jQuery.merge( ret,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
699 typeof arr === "string" ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
700 [ arr ] : arr
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
701 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
702 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
703 core_push.call( ret, arr );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
704 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
705 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
706
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
707 return ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
708 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
709
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
710 inArray: function( elem, arr, i ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
711 var len;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
712
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
713 if ( arr ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
714 if ( core_indexOf ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
715 return core_indexOf.call( arr, elem, i );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
716 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
717
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
718 len = arr.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
719 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
720
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
721 for ( ; i < len; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
722 // Skip accessing in sparse arrays
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
723 if ( i in arr && arr[ i ] === elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
724 return i;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
725 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
726 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
727 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
728
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
729 return -1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
730 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
731
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
732 merge: function( first, second ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
733 var l = second.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
734 i = first.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
735 j = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
736
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
737 if ( typeof l === "number" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
738 for ( ; j < l; j++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
739 first[ i++ ] = second[ j ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
740 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
741 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
742 while ( second[j] !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
743 first[ i++ ] = second[ j++ ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
744 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
745 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
746
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
747 first.length = i;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
748
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
749 return first;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
750 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
751
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
752 grep: function( elems, callback, inv ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
753 var retVal,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
754 ret = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
755 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
756 length = elems.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
757 inv = !!inv;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
758
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
759 // Go through the array, only saving the items
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
760 // that pass the validator function
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
761 for ( ; i < length; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
762 retVal = !!callback( elems[ i ], i );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
763 if ( inv !== retVal ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
764 ret.push( elems[ i ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
765 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
766 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
767
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
768 return ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
769 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
770
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
771 // arg is for internal usage only
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
772 map: function( elems, callback, arg ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
773 var value,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
774 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
775 length = elems.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
776 isArray = isArraylike( elems ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
777 ret = [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
778
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
779 // Go through the array, translating each of the items to their
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
780 if ( isArray ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
781 for ( ; i < length; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
782 value = callback( elems[ i ], i, arg );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
783
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
784 if ( value != null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
785 ret[ ret.length ] = value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
786 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
787 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
788
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
789 // Go through every key on the object,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
790 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
791 for ( i in elems ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
792 value = callback( elems[ i ], i, arg );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
793
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
794 if ( value != null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
795 ret[ ret.length ] = value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
796 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
797 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
798 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
799
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
800 // Flatten any nested arrays
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
801 return core_concat.apply( [], ret );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
802 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
803
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
804 // A global GUID counter for objects
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
805 guid: 1,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
806
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
807 // Bind a function to a context, optionally partially applying any
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
808 // arguments.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
809 proxy: function( fn, context ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
810 var args, proxy, tmp;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
811
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
812 if ( typeof context === "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
813 tmp = fn[ context ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
814 context = fn;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
815 fn = tmp;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
816 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
817
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
818 // Quick check to determine if target is callable, in the spec
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
819 // this throws a TypeError, but we will just return undefined.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
820 if ( !jQuery.isFunction( fn ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
821 return undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
822 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
823
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
824 // Simulated bind
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
825 args = core_slice.call( arguments, 2 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
826 proxy = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
827 return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
828 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
829
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
830 // Set the guid of unique handler to the same of original handler, so it can be removed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
831 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
832
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
833 return proxy;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
834 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
835
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
836 // Multifunctional method to get and set values of a collection
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
837 // The value/s can optionally be executed if it's a function
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
838 access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
839 var i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
840 length = elems.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
841 bulk = key == null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
842
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
843 // Sets many values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
844 if ( jQuery.type( key ) === "object" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
845 chainable = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
846 for ( i in key ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
847 jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
848 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
849
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
850 // Sets one value
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
851 } else if ( value !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
852 chainable = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
853
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
854 if ( !jQuery.isFunction( value ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
855 raw = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
856 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
857
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
858 if ( bulk ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
859 // Bulk operations run against the entire set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
860 if ( raw ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
861 fn.call( elems, value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
862 fn = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
863
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
864 // ...except when executing function values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
865 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
866 bulk = fn;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
867 fn = function( elem, key, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
868 return bulk.call( jQuery( elem ), value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
869 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
870 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
871 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
872
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
873 if ( fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
874 for ( ; i < length; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
875 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
876 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
877 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
878 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
879
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
880 return chainable ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
881 elems :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
882
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
883 // Gets
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
884 bulk ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
885 fn.call( elems ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
886 length ? fn( elems[0], key ) : emptyGet;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
887 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
888
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
889 now: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
890 return ( new Date() ).getTime();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
891 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
892
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
893 // A method for quickly swapping in/out CSS properties to get correct calculations.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
894 // Note: this method belongs to the css module but it's needed here for the support module.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
895 // If support gets modularized, this method should be moved back to the css module.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
896 swap: function( elem, options, callback, args ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
897 var ret, name,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
898 old = {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
899
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
900 // Remember the old values, and insert the new ones
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
901 for ( name in options ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
902 old[ name ] = elem.style[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
903 elem.style[ name ] = options[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
904 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
905
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
906 ret = callback.apply( elem, args || [] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
907
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
908 // Revert the old values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
909 for ( name in options ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
910 elem.style[ name ] = old[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
911 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
912
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
913 return ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
914 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
915 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
916
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
917 jQuery.ready.promise = function( obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
918 if ( !readyList ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
919
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
920 readyList = jQuery.Deferred();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
921
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
922 // Catch cases where $(document).ready() is called after the browser event has already occurred.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
923 // we once tried to use readyState "interactive" here, but it caused issues like the one
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
924 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
925 if ( document.readyState === "complete" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
926 // Handle it asynchronously to allow scripts the opportunity to delay ready
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
927 setTimeout( jQuery.ready );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
928
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
929 // Standards-based browsers support DOMContentLoaded
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
930 } else if ( document.addEventListener ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
931 // Use the handy event callback
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
932 document.addEventListener( "DOMContentLoaded", completed, false );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
933
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
934 // A fallback to window.onload, that will always work
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
935 window.addEventListener( "load", completed, false );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
936
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
937 // If IE event model is used
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
938 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
939 // Ensure firing before onload, maybe late but safe also for iframes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
940 document.attachEvent( "onreadystatechange", completed );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
941
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
942 // A fallback to window.onload, that will always work
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
943 window.attachEvent( "onload", completed );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
944
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
945 // If IE and not a frame
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
946 // continually check to see if the document is ready
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
947 var top = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
948
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
949 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
950 top = window.frameElement == null && document.documentElement;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
951 } catch(e) {}
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
952
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
953 if ( top && top.doScroll ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
954 (function doScrollCheck() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
955 if ( !jQuery.isReady ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
956
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
957 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
958 // Use the trick by Diego Perini
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
959 // http://javascript.nwbox.com/IEContentLoaded/
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
960 top.doScroll("left");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
961 } catch(e) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
962 return setTimeout( doScrollCheck, 50 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
963 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
964
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
965 // detach all dom ready events
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
966 detach();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
967
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
968 // and execute any waiting functions
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
969 jQuery.ready();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
970 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
971 })();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
972 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
973 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
974 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
975 return readyList.promise( obj );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
976 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
977
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
978 // Populate the class2type map
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
979 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
980 class2type[ "[object " + name + "]" ] = name.toLowerCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
981 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
982
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
983 function isArraylike( obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
984 var length = obj.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
985 type = jQuery.type( obj );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
986
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
987 if ( jQuery.isWindow( obj ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
988 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
989 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
990
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
991 if ( obj.nodeType === 1 && length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
992 return true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
993 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
994
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
995 return type === "array" || type !== "function" &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
996 ( length === 0 ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
997 typeof length === "number" && length > 0 && ( length - 1 ) in obj );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
998 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
999
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1000 // All jQuery objects should point back to these
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1001 rootjQuery = jQuery(document);
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1002 /*!
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1003 * Sizzle CSS Selector Engine v1.10.2
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1004 * http://sizzlejs.com/
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1005 *
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1006 * Copyright 2013 jQuery Foundation, Inc. and other contributors
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1007 * Released under the MIT license
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1008 * http://jquery.org/license
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1009 *
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1010 * Date: 2013-07-03
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1011 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1012 (function( window, undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1013
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1014 var i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1015 support,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1016 cachedruns,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1017 Expr,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1018 getText,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1019 isXML,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1020 compile,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1021 outermostContext,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1022 sortInput,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1023
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1024 // Local document vars
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1025 setDocument,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1026 document,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1027 docElem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1028 documentIsHTML,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1029 rbuggyQSA,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1030 rbuggyMatches,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1031 matches,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1032 contains,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1033
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1034 // Instance-specific data
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1035 expando = "sizzle" + -(new Date()),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1036 preferredDoc = window.document,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1037 dirruns = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1038 done = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1039 classCache = createCache(),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1040 tokenCache = createCache(),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1041 compilerCache = createCache(),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1042 hasDuplicate = false,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1043 sortOrder = function( a, b ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1044 if ( a === b ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1045 hasDuplicate = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1046 return 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1047 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1048 return 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1049 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1050
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1051 // General-purpose constants
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1052 strundefined = typeof undefined,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1053 MAX_NEGATIVE = 1 << 31,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1054
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1055 // Instance methods
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1056 hasOwn = ({}).hasOwnProperty,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1057 arr = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1058 pop = arr.pop,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1059 push_native = arr.push,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1060 push = arr.push,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1061 slice = arr.slice,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1062 // Use a stripped-down indexOf if we can't use a native one
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1063 indexOf = arr.indexOf || function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1064 var i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1065 len = this.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1066 for ( ; i < len; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1067 if ( this[i] === elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1068 return i;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1069 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1070 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1071 return -1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1072 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1073
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1074 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1075
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1076 // Regular expressions
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1077
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1078 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1079 whitespace = "[\\x20\\t\\r\\n\\f]",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1080 // http://www.w3.org/TR/css3-syntax/#characters
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1081 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1082
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1083 // Loosely modeled on CSS identifier characters
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1084 // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1085 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1086 identifier = characterEncoding.replace( "w", "w#" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1087
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1088 // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1089 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1090 "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1091
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1092 // Prefer arguments quoted,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1093 // then not containing pseudos/brackets,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1094 // then attribute selectors/non-parenthetical expressions,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1095 // then anything else
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1096 // These preferences are here to reduce the number of selectors
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1097 // needing tokenize in the PSEUDO preFilter
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1098 pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1099
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1100 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1101 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1102
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1103 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1104 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1105
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1106 rsibling = new RegExp( whitespace + "*[+~]" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1107 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1108
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1109 rpseudo = new RegExp( pseudos ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1110 ridentifier = new RegExp( "^" + identifier + "$" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1111
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1112 matchExpr = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1113 "ID": new RegExp( "^#(" + characterEncoding + ")" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1114 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1115 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1116 "ATTR": new RegExp( "^" + attributes ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1117 "PSEUDO": new RegExp( "^" + pseudos ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1118 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1119 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1120 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1121 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1122 // For use in libraries implementing .is()
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1123 // We use this for POS matching in `select`
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1124 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1125 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1126 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1127
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1128 rnative = /^[^{]+\{\s*\[native \w/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1129
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1130 // Easily-parseable/retrievable ID or TAG or CLASS selectors
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1131 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1132
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1133 rinputs = /^(?:input|select|textarea|button)$/i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1134 rheader = /^h\d$/i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1135
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1136 rescape = /'|\\/g,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1137
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1138 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1139 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1140 funescape = function( _, escaped, escapedWhitespace ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1141 var high = "0x" + escaped - 0x10000;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1142 // NaN means non-codepoint
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1143 // Support: Firefox
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1144 // Workaround erroneous numeric interpretation of +"0x"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1145 return high !== high || escapedWhitespace ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1146 escaped :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1147 // BMP codepoint
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1148 high < 0 ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1149 String.fromCharCode( high + 0x10000 ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1150 // Supplemental Plane codepoint (surrogate pair)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1151 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1152 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1153
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1154 // Optimize for push.apply( _, NodeList )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1155 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1156 push.apply(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1157 (arr = slice.call( preferredDoc.childNodes )),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1158 preferredDoc.childNodes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1159 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1160 // Support: Android<4.0
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1161 // Detect silently failing push.apply
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1162 arr[ preferredDoc.childNodes.length ].nodeType;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1163 } catch ( e ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1164 push = { apply: arr.length ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1165
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1166 // Leverage slice if possible
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1167 function( target, els ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1168 push_native.apply( target, slice.call(els) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1169 } :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1170
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1171 // Support: IE<9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1172 // Otherwise append directly
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1173 function( target, els ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1174 var j = target.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1175 i = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1176 // Can't trust NodeList.length
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1177 while ( (target[j++] = els[i++]) ) {}
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1178 target.length = j - 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1179 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1180 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1181 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1182
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1183 function Sizzle( selector, context, results, seed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1184 var match, elem, m, nodeType,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1185 // QSA vars
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1186 i, groups, old, nid, newContext, newSelector;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1187
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1188 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1189 setDocument( context );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1190 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1191
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1192 context = context || document;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1193 results = results || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1194
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1195 if ( !selector || typeof selector !== "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1196 return results;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1197 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1198
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1199 if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1200 return [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1201 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1202
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1203 if ( documentIsHTML && !seed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1204
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1205 // Shortcuts
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1206 if ( (match = rquickExpr.exec( selector )) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1207 // Speed-up: Sizzle("#ID")
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1208 if ( (m = match[1]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1209 if ( nodeType === 9 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1210 elem = context.getElementById( m );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1211 // Check parentNode to catch when Blackberry 4.6 returns
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1212 // nodes that are no longer in the document #6963
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1213 if ( elem && elem.parentNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1214 // Handle the case where IE, Opera, and Webkit return items
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1215 // by name instead of ID
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1216 if ( elem.id === m ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1217 results.push( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1218 return results;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1219 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1220 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1221 return results;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1222 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1223 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1224 // Context is not a document
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1225 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1226 contains( context, elem ) && elem.id === m ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1227 results.push( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1228 return results;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1229 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1230 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1231
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1232 // Speed-up: Sizzle("TAG")
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1233 } else if ( match[2] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1234 push.apply( results, context.getElementsByTagName( selector ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1235 return results;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1236
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1237 // Speed-up: Sizzle(".CLASS")
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1238 } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1239 push.apply( results, context.getElementsByClassName( m ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1240 return results;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1241 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1242 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1243
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1244 // QSA path
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1245 if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1246 nid = old = expando;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1247 newContext = context;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1248 newSelector = nodeType === 9 && selector;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1249
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1250 // qSA works strangely on Element-rooted queries
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1251 // We can work around this by specifying an extra ID on the root
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1252 // and working up from there (Thanks to Andrew Dupont for the technique)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1253 // IE 8 doesn't work on object elements
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1254 if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1255 groups = tokenize( selector );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1256
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1257 if ( (old = context.getAttribute("id")) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1258 nid = old.replace( rescape, "\\$&" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1259 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1260 context.setAttribute( "id", nid );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1261 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1262 nid = "[id='" + nid + "'] ";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1263
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1264 i = groups.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1265 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1266 groups[i] = nid + toSelector( groups[i] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1267 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1268 newContext = rsibling.test( selector ) && context.parentNode || context;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1269 newSelector = groups.join(",");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1270 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1271
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1272 if ( newSelector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1273 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1274 push.apply( results,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1275 newContext.querySelectorAll( newSelector )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1276 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1277 return results;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1278 } catch(qsaError) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1279 } finally {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1280 if ( !old ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1281 context.removeAttribute("id");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1282 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1283 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1284 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1285 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1286 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1287
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1288 // All others
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1289 return select( selector.replace( rtrim, "$1" ), context, results, seed );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1290 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1291
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1292 /**
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1293 * Create key-value caches of limited size
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1294 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1295 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1296 * deleting the oldest entry
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1297 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1298 function createCache() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1299 var keys = [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1300
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1301 function cache( key, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1302 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1303 if ( keys.push( key += " " ) > Expr.cacheLength ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1304 // Only keep the most recent entries
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1305 delete cache[ keys.shift() ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1306 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1307 return (cache[ key ] = value);
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1308 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1309 return cache;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1310 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1311
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1312 /**
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1313 * Mark a function for special use by Sizzle
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1314 * @param {Function} fn The function to mark
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1315 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1316 function markFunction( fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1317 fn[ expando ] = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1318 return fn;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1319 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1320
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1321 /**
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1322 * Support testing using an element
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1323 * @param {Function} fn Passed the created div and expects a boolean result
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1324 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1325 function assert( fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1326 var div = document.createElement("div");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1327
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1328 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1329 return !!fn( div );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1330 } catch (e) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1331 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1332 } finally {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1333 // Remove from its parent by default
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1334 if ( div.parentNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1335 div.parentNode.removeChild( div );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1336 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1337 // release memory in IE
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1338 div = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1339 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1340 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1341
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1342 /**
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1343 * Adds the same handler for all of the specified attrs
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1344 * @param {String} attrs Pipe-separated list of attributes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1345 * @param {Function} handler The method that will be applied
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1346 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1347 function addHandle( attrs, handler ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1348 var arr = attrs.split("|"),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1349 i = attrs.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1350
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1351 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1352 Expr.attrHandle[ arr[i] ] = handler;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1353 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1354 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1355
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1356 /**
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1357 * Checks document order of two siblings
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1358 * @param {Element} a
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1359 * @param {Element} b
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1360 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1361 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1362 function siblingCheck( a, b ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1363 var cur = b && a,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1364 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1365 ( ~b.sourceIndex || MAX_NEGATIVE ) -
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1366 ( ~a.sourceIndex || MAX_NEGATIVE );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1367
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1368 // Use IE sourceIndex if available on both nodes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1369 if ( diff ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1370 return diff;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1371 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1372
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1373 // Check if b follows a
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1374 if ( cur ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1375 while ( (cur = cur.nextSibling) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1376 if ( cur === b ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1377 return -1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1378 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1379 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1380 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1381
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1382 return a ? 1 : -1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1383 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1384
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1385 /**
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1386 * Returns a function to use in pseudos for input types
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1387 * @param {String} type
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1388 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1389 function createInputPseudo( type ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1390 return function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1391 var name = elem.nodeName.toLowerCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1392 return name === "input" && elem.type === type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1393 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1394 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1395
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1396 /**
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1397 * Returns a function to use in pseudos for buttons
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1398 * @param {String} type
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1399 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1400 function createButtonPseudo( type ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1401 return function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1402 var name = elem.nodeName.toLowerCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1403 return (name === "input" || name === "button") && elem.type === type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1404 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1405 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1406
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1407 /**
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1408 * Returns a function to use in pseudos for positionals
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1409 * @param {Function} fn
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1410 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1411 function createPositionalPseudo( fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1412 return markFunction(function( argument ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1413 argument = +argument;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1414 return markFunction(function( seed, matches ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1415 var j,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1416 matchIndexes = fn( [], seed.length, argument ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1417 i = matchIndexes.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1418
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1419 // Match elements found at the specified indexes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1420 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1421 if ( seed[ (j = matchIndexes[i]) ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1422 seed[j] = !(matches[j] = seed[j]);
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1423 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1424 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1425 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1426 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1427 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1428
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1429 /**
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1430 * Detect xml
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1431 * @param {Element|Object} elem An element or a document
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1432 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1433 isXML = Sizzle.isXML = function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1434 // documentElement is verified for cases where it doesn't yet exist
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1435 // (such as loading iframes in IE - #4833)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1436 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1437 return documentElement ? documentElement.nodeName !== "HTML" : false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1438 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1439
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1440 // Expose support vars for convenience
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1441 support = Sizzle.support = {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1442
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1443 /**
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1444 * Sets document-related variables once based on the current document
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1445 * @param {Element|Object} [doc] An element or document object to use to set the document
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1446 * @returns {Object} Returns the current document
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1447 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1448 setDocument = Sizzle.setDocument = function( node ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1449 var doc = node ? node.ownerDocument || node : preferredDoc,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1450 parent = doc.defaultView;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1451
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1452 // If no document and documentElement is available, return
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1453 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1454 return document;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1455 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1456
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1457 // Set our document
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1458 document = doc;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1459 docElem = doc.documentElement;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1460
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1461 // Support tests
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1462 documentIsHTML = !isXML( doc );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1463
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1464 // Support: IE>8
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1465 // If iframe document is assigned to "document" variable and if iframe has been reloaded,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1466 // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1467 // IE6-8 do not support the defaultView property so parent will be undefined
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1468 if ( parent && parent.attachEvent && parent !== parent.top ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1469 parent.attachEvent( "onbeforeunload", function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1470 setDocument();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1471 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1472 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1473
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1474 /* Attributes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1475 ---------------------------------------------------------------------- */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1476
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1477 // Support: IE<8
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1478 // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1479 support.attributes = assert(function( div ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1480 div.className = "i";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1481 return !div.getAttribute("className");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1482 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1483
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1484 /* getElement(s)By*
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1485 ---------------------------------------------------------------------- */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1486
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1487 // Check if getElementsByTagName("*") returns only elements
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1488 support.getElementsByTagName = assert(function( div ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1489 div.appendChild( doc.createComment("") );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1490 return !div.getElementsByTagName("*").length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1491 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1492
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1493 // Check if getElementsByClassName can be trusted
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1494 support.getElementsByClassName = assert(function( div ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1495 div.innerHTML = "<div class='a'></div><div class='a i'></div>";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1496
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1497 // Support: Safari<4
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1498 // Catch class over-caching
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1499 div.firstChild.className = "i";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1500 // Support: Opera<10
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1501 // Catch gEBCN failure to find non-leading classes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1502 return div.getElementsByClassName("i").length === 2;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1503 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1504
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1505 // Support: IE<10
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1506 // Check if getElementById returns elements by name
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1507 // The broken getElementById methods don't pick up programatically-set names,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1508 // so use a roundabout getElementsByName test
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1509 support.getById = assert(function( div ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1510 docElem.appendChild( div ).id = expando;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1511 return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1512 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1513
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1514 // ID find and filter
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1515 if ( support.getById ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1516 Expr.find["ID"] = function( id, context ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1517 if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1518 var m = context.getElementById( id );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1519 // Check parentNode to catch when Blackberry 4.6 returns
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1520 // nodes that are no longer in the document #6963
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1521 return m && m.parentNode ? [m] : [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1522 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1523 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1524 Expr.filter["ID"] = function( id ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1525 var attrId = id.replace( runescape, funescape );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1526 return function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1527 return elem.getAttribute("id") === attrId;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1528 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1529 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1530 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1531 // Support: IE6/7
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1532 // getElementById is not reliable as a find shortcut
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1533 delete Expr.find["ID"];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1534
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1535 Expr.filter["ID"] = function( id ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1536 var attrId = id.replace( runescape, funescape );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1537 return function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1538 var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1539 return node && node.value === attrId;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1540 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1541 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1542 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1543
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1544 // Tag
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1545 Expr.find["TAG"] = support.getElementsByTagName ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1546 function( tag, context ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1547 if ( typeof context.getElementsByTagName !== strundefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1548 return context.getElementsByTagName( tag );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1549 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1550 } :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1551 function( tag, context ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1552 var elem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1553 tmp = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1554 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1555 results = context.getElementsByTagName( tag );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1556
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1557 // Filter out possible comments
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1558 if ( tag === "*" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1559 while ( (elem = results[i++]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1560 if ( elem.nodeType === 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1561 tmp.push( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1562 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1563 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1564
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1565 return tmp;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1566 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1567 return results;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1568 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1569
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1570 // Class
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1571 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1572 if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1573 return context.getElementsByClassName( className );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1574 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1575 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1576
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1577 /* QSA/matchesSelector
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1578 ---------------------------------------------------------------------- */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1579
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1580 // QSA and matchesSelector support
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1581
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1582 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1583 rbuggyMatches = [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1584
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1585 // qSa(:focus) reports false when true (Chrome 21)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1586 // We allow this because of a bug in IE8/9 that throws an error
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1587 // whenever `document.activeElement` is accessed on an iframe
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1588 // So, we allow :focus to pass through QSA all the time to avoid the IE error
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1589 // See http://bugs.jquery.com/ticket/13378
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1590 rbuggyQSA = [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1591
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1592 if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1593 // Build QSA regex
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1594 // Regex strategy adopted from Diego Perini
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1595 assert(function( div ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1596 // Select is set to empty string on purpose
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1597 // This is to test IE's treatment of not explicitly
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1598 // setting a boolean content attribute,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1599 // since its presence should be enough
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1600 // http://bugs.jquery.com/ticket/12359
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1601 div.innerHTML = "<select><option selected=''></option></select>";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1602
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1603 // Support: IE8
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1604 // Boolean attributes and "value" are not treated correctly
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1605 if ( !div.querySelectorAll("[selected]").length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1606 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1607 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1608
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1609 // Webkit/Opera - :checked should return selected option elements
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1610 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1611 // IE8 throws error here and will not see later tests
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1612 if ( !div.querySelectorAll(":checked").length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1613 rbuggyQSA.push(":checked");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1614 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1615 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1616
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1617 assert(function( div ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1618
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1619 // Support: Opera 10-12/IE8
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1620 // ^= $= *= and empty values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1621 // Should not select anything
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1622 // Support: Windows 8 Native Apps
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1623 // The type attribute is restricted during .innerHTML assignment
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1624 var input = doc.createElement("input");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1625 input.setAttribute( "type", "hidden" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1626 div.appendChild( input ).setAttribute( "t", "" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1627
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1628 if ( div.querySelectorAll("[t^='']").length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1629 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1630 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1631
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1632 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1633 // IE8 throws error here and will not see later tests
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1634 if ( !div.querySelectorAll(":enabled").length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1635 rbuggyQSA.push( ":enabled", ":disabled" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1636 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1637
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1638 // Opera 10-11 does not throw on post-comma invalid pseudos
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1639 div.querySelectorAll("*,:x");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1640 rbuggyQSA.push(",.*:");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1641 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1642 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1643
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1644 if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1645 docElem.mozMatchesSelector ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1646 docElem.oMatchesSelector ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1647 docElem.msMatchesSelector) )) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1648
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1649 assert(function( div ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1650 // Check to see if it's possible to do matchesSelector
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1651 // on a disconnected node (IE 9)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1652 support.disconnectedMatch = matches.call( div, "div" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1653
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1654 // This should fail with an exception
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1655 // Gecko does not error, returns false instead
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1656 matches.call( div, "[s!='']:x" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1657 rbuggyMatches.push( "!=", pseudos );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1658 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1659 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1660
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1661 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1662 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1663
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1664 /* Contains
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1665 ---------------------------------------------------------------------- */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1666
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1667 // Element contains another
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1668 // Purposefully does not implement inclusive descendent
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1669 // As in, an element does not contain itself
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1670 contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1671 function( a, b ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1672 var adown = a.nodeType === 9 ? a.documentElement : a,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1673 bup = b && b.parentNode;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1674 return a === bup || !!( bup && bup.nodeType === 1 && (
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1675 adown.contains ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1676 adown.contains( bup ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1677 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1678 ));
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1679 } :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1680 function( a, b ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1681 if ( b ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1682 while ( (b = b.parentNode) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1683 if ( b === a ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1684 return true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1685 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1686 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1687 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1688 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1689 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1690
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1691 /* Sorting
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1692 ---------------------------------------------------------------------- */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1693
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1694 // Document order sorting
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1695 sortOrder = docElem.compareDocumentPosition ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1696 function( a, b ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1697
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1698 // Flag for duplicate removal
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1699 if ( a === b ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1700 hasDuplicate = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1701 return 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1702 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1703
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1704 var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1705
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1706 if ( compare ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1707 // Disconnected nodes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1708 if ( compare & 1 ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1709 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1710
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1711 // Choose the first element that is related to our preferred document
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1712 if ( a === doc || contains(preferredDoc, a) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1713 return -1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1714 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1715 if ( b === doc || contains(preferredDoc, b) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1716 return 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1717 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1718
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1719 // Maintain original order
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1720 return sortInput ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1721 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1722 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1723 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1724
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1725 return compare & 4 ? -1 : 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1726 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1727
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1728 // Not directly comparable, sort on existence of method
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1729 return a.compareDocumentPosition ? -1 : 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1730 } :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1731 function( a, b ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1732 var cur,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1733 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1734 aup = a.parentNode,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1735 bup = b.parentNode,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1736 ap = [ a ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1737 bp = [ b ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1738
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1739 // Exit early if the nodes are identical
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1740 if ( a === b ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1741 hasDuplicate = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1742 return 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1743
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1744 // Parentless nodes are either documents or disconnected
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1745 } else if ( !aup || !bup ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1746 return a === doc ? -1 :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1747 b === doc ? 1 :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1748 aup ? -1 :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1749 bup ? 1 :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1750 sortInput ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1751 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1752 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1753
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1754 // If the nodes are siblings, we can do a quick check
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1755 } else if ( aup === bup ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1756 return siblingCheck( a, b );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1757 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1758
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1759 // Otherwise we need full lists of their ancestors for comparison
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1760 cur = a;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1761 while ( (cur = cur.parentNode) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1762 ap.unshift( cur );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1763 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1764 cur = b;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1765 while ( (cur = cur.parentNode) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1766 bp.unshift( cur );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1767 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1768
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1769 // Walk down the tree looking for a discrepancy
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1770 while ( ap[i] === bp[i] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1771 i++;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1772 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1773
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1774 return i ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1775 // Do a sibling check if the nodes have a common ancestor
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1776 siblingCheck( ap[i], bp[i] ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1777
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1778 // Otherwise nodes in our document sort first
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1779 ap[i] === preferredDoc ? -1 :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1780 bp[i] === preferredDoc ? 1 :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1781 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1782 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1783
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1784 return doc;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1785 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1786
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1787 Sizzle.matches = function( expr, elements ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1788 return Sizzle( expr, null, null, elements );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1789 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1790
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1791 Sizzle.matchesSelector = function( elem, expr ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1792 // Set document vars if needed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1793 if ( ( elem.ownerDocument || elem ) !== document ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1794 setDocument( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1795 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1796
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1797 // Make sure that attribute selectors are quoted
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1798 expr = expr.replace( rattributeQuotes, "='$1']" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1799
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1800 if ( support.matchesSelector && documentIsHTML &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1801 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1802 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1803
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1804 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1805 var ret = matches.call( elem, expr );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1806
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1807 // IE 9's matchesSelector returns false on disconnected nodes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1808 if ( ret || support.disconnectedMatch ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1809 // As well, disconnected nodes are said to be in a document
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1810 // fragment in IE 9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1811 elem.document && elem.document.nodeType !== 11 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1812 return ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1813 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1814 } catch(e) {}
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1815 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1816
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1817 return Sizzle( expr, document, null, [elem] ).length > 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1818 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1819
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1820 Sizzle.contains = function( context, elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1821 // Set document vars if needed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1822 if ( ( context.ownerDocument || context ) !== document ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1823 setDocument( context );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1824 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1825 return contains( context, elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1826 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1827
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1828 Sizzle.attr = function( elem, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1829 // Set document vars if needed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1830 if ( ( elem.ownerDocument || elem ) !== document ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1831 setDocument( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1832 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1833
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1834 var fn = Expr.attrHandle[ name.toLowerCase() ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1835 // Don't get fooled by Object.prototype properties (jQuery #13807)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1836 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1837 fn( elem, name, !documentIsHTML ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1838 undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1839
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1840 return val === undefined ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1841 support.attributes || !documentIsHTML ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1842 elem.getAttribute( name ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1843 (val = elem.getAttributeNode(name)) && val.specified ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1844 val.value :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1845 null :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1846 val;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1847 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1848
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1849 Sizzle.error = function( msg ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1850 throw new Error( "Syntax error, unrecognized expression: " + msg );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1851 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1852
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1853 /**
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1854 * Document sorting and removing duplicates
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1855 * @param {ArrayLike} results
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1856 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1857 Sizzle.uniqueSort = function( results ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1858 var elem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1859 duplicates = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1860 j = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1861 i = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1862
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1863 // Unless we *know* we can detect duplicates, assume their presence
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1864 hasDuplicate = !support.detectDuplicates;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1865 sortInput = !support.sortStable && results.slice( 0 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1866 results.sort( sortOrder );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1867
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1868 if ( hasDuplicate ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1869 while ( (elem = results[i++]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1870 if ( elem === results[ i ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1871 j = duplicates.push( i );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1872 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1873 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1874 while ( j-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1875 results.splice( duplicates[ j ], 1 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1876 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1877 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1878
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1879 return results;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1880 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1881
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1882 /**
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1883 * Utility function for retrieving the text value of an array of DOM nodes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1884 * @param {Array|Element} elem
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1885 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1886 getText = Sizzle.getText = function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1887 var node,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1888 ret = "",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1889 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1890 nodeType = elem.nodeType;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1891
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1892 if ( !nodeType ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1893 // If no nodeType, this is expected to be an array
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1894 for ( ; (node = elem[i]); i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1895 // Do not traverse comment nodes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1896 ret += getText( node );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1897 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1898 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1899 // Use textContent for elements
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1900 // innerText usage removed for consistency of new lines (see #11153)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1901 if ( typeof elem.textContent === "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1902 return elem.textContent;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1903 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1904 // Traverse its children
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1905 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1906 ret += getText( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1907 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1908 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1909 } else if ( nodeType === 3 || nodeType === 4 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1910 return elem.nodeValue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1911 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1912 // Do not include comment or processing instruction nodes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1913
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1914 return ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1915 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1916
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1917 Expr = Sizzle.selectors = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1918
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1919 // Can be adjusted by the user
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1920 cacheLength: 50,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1921
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1922 createPseudo: markFunction,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1923
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1924 match: matchExpr,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1925
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1926 attrHandle: {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1927
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1928 find: {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1929
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1930 relative: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1931 ">": { dir: "parentNode", first: true },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1932 " ": { dir: "parentNode" },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1933 "+": { dir: "previousSibling", first: true },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1934 "~": { dir: "previousSibling" }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1935 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1936
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1937 preFilter: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1938 "ATTR": function( match ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1939 match[1] = match[1].replace( runescape, funescape );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1940
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1941 // Move the given value to match[3] whether quoted or unquoted
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1942 match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1943
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1944 if ( match[2] === "~=" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1945 match[3] = " " + match[3] + " ";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1946 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1947
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1948 return match.slice( 0, 4 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1949 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1950
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1951 "CHILD": function( match ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1952 /* matches from matchExpr["CHILD"]
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1953 1 type (only|nth|...)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1954 2 what (child|of-type)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1955 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1956 4 xn-component of xn+y argument ([+-]?\d*n|)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1957 5 sign of xn-component
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1958 6 x of xn-component
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1959 7 sign of y-component
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1960 8 y of y-component
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1961 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1962 match[1] = match[1].toLowerCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1963
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1964 if ( match[1].slice( 0, 3 ) === "nth" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1965 // nth-* requires argument
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1966 if ( !match[3] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1967 Sizzle.error( match[0] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1968 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1969
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1970 // numeric x and y parameters for Expr.filter.CHILD
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1971 // remember that false/true cast respectively to 0/1
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1972 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1973 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1974
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1975 // other types prohibit arguments
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1976 } else if ( match[3] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1977 Sizzle.error( match[0] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1978 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1979
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1980 return match;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1981 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1982
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1983 "PSEUDO": function( match ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1984 var excess,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1985 unquoted = !match[5] && match[2];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1986
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1987 if ( matchExpr["CHILD"].test( match[0] ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1988 return null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1989 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1990
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1991 // Accept quoted arguments as-is
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1992 if ( match[3] && match[4] !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1993 match[2] = match[4];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1994
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1995 // Strip excess characters from unquoted arguments
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1996 } else if ( unquoted && rpseudo.test( unquoted ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1997 // Get excess from tokenize (recursively)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1998 (excess = tokenize( unquoted, true )) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
1999 // advance to the next closing parenthesis
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2000 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2001
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2002 // excess is a negative index
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2003 match[0] = match[0].slice( 0, excess );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2004 match[2] = unquoted.slice( 0, excess );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2005 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2006
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2007 // Return only captures needed by the pseudo filter method (type and argument)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2008 return match.slice( 0, 3 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2009 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2010 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2011
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2012 filter: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2013
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2014 "TAG": function( nodeNameSelector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2015 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2016 return nodeNameSelector === "*" ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2017 function() { return true; } :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2018 function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2019 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2020 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2021 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2022
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2023 "CLASS": function( className ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2024 var pattern = classCache[ className + " " ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2025
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2026 return pattern ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2027 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2028 classCache( className, function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2029 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2030 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2031 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2032
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2033 "ATTR": function( name, operator, check ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2034 return function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2035 var result = Sizzle.attr( elem, name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2036
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2037 if ( result == null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2038 return operator === "!=";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2039 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2040 if ( !operator ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2041 return true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2042 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2043
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2044 result += "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2045
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2046 return operator === "=" ? result === check :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2047 operator === "!=" ? result !== check :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2048 operator === "^=" ? check && result.indexOf( check ) === 0 :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2049 operator === "*=" ? check && result.indexOf( check ) > -1 :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2050 operator === "$=" ? check && result.slice( -check.length ) === check :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2051 operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2052 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2053 false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2054 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2055 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2056
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2057 "CHILD": function( type, what, argument, first, last ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2058 var simple = type.slice( 0, 3 ) !== "nth",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2059 forward = type.slice( -4 ) !== "last",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2060 ofType = what === "of-type";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2061
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2062 return first === 1 && last === 0 ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2063
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2064 // Shortcut for :nth-*(n)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2065 function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2066 return !!elem.parentNode;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2067 } :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2068
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2069 function( elem, context, xml ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2070 var cache, outerCache, node, diff, nodeIndex, start,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2071 dir = simple !== forward ? "nextSibling" : "previousSibling",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2072 parent = elem.parentNode,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2073 name = ofType && elem.nodeName.toLowerCase(),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2074 useCache = !xml && !ofType;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2075
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2076 if ( parent ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2077
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2078 // :(first|last|only)-(child|of-type)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2079 if ( simple ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2080 while ( dir ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2081 node = elem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2082 while ( (node = node[ dir ]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2083 if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2084 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2085 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2086 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2087 // Reverse direction for :only-* (if we haven't yet done so)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2088 start = dir = type === "only" && !start && "nextSibling";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2089 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2090 return true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2091 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2092
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2093 start = [ forward ? parent.firstChild : parent.lastChild ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2094
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2095 // non-xml :nth-child(...) stores cache data on `parent`
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2096 if ( forward && useCache ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2097 // Seek `elem` from a previously-cached index
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2098 outerCache = parent[ expando ] || (parent[ expando ] = {});
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2099 cache = outerCache[ type ] || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2100 nodeIndex = cache[0] === dirruns && cache[1];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2101 diff = cache[0] === dirruns && cache[2];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2102 node = nodeIndex && parent.childNodes[ nodeIndex ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2103
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2104 while ( (node = ++nodeIndex && node && node[ dir ] ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2105
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2106 // Fallback to seeking `elem` from the start
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2107 (diff = nodeIndex = 0) || start.pop()) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2108
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2109 // When found, cache indexes on `parent` and break
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2110 if ( node.nodeType === 1 && ++diff && node === elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2111 outerCache[ type ] = [ dirruns, nodeIndex, diff ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2112 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2113 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2114 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2115
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2116 // Use previously-cached element index if available
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2117 } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2118 diff = cache[1];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2119
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2120 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2121 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2122 // Use the same loop as above to seek `elem` from the start
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2123 while ( (node = ++nodeIndex && node && node[ dir ] ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2124 (diff = nodeIndex = 0) || start.pop()) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2125
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2126 if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2127 // Cache the index of each encountered element
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2128 if ( useCache ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2129 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2130 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2131
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2132 if ( node === elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2133 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2134 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2135 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2136 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2137 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2138
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2139 // Incorporate the offset, then check against cycle size
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2140 diff -= last;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2141 return diff === first || ( diff % first === 0 && diff / first >= 0 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2142 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2143 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2144 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2145
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2146 "PSEUDO": function( pseudo, argument ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2147 // pseudo-class names are case-insensitive
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2148 // http://www.w3.org/TR/selectors/#pseudo-classes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2149 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2150 // Remember that setFilters inherits from pseudos
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2151 var args,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2152 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2153 Sizzle.error( "unsupported pseudo: " + pseudo );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2154
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2155 // The user may use createPseudo to indicate that
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2156 // arguments are needed to create the filter function
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2157 // just as Sizzle does
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2158 if ( fn[ expando ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2159 return fn( argument );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2160 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2161
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2162 // But maintain support for old signatures
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2163 if ( fn.length > 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2164 args = [ pseudo, pseudo, "", argument ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2165 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2166 markFunction(function( seed, matches ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2167 var idx,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2168 matched = fn( seed, argument ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2169 i = matched.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2170 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2171 idx = indexOf.call( seed, matched[i] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2172 seed[ idx ] = !( matches[ idx ] = matched[i] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2173 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2174 }) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2175 function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2176 return fn( elem, 0, args );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2177 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2178 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2179
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2180 return fn;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2181 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2182 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2183
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2184 pseudos: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2185 // Potentially complex pseudos
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2186 "not": markFunction(function( selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2187 // Trim the selector passed to compile
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2188 // to avoid treating leading and trailing
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2189 // spaces as combinators
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2190 var input = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2191 results = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2192 matcher = compile( selector.replace( rtrim, "$1" ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2193
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2194 return matcher[ expando ] ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2195 markFunction(function( seed, matches, context, xml ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2196 var elem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2197 unmatched = matcher( seed, null, xml, [] ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2198 i = seed.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2199
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2200 // Match elements unmatched by `matcher`
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2201 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2202 if ( (elem = unmatched[i]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2203 seed[i] = !(matches[i] = elem);
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2204 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2205 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2206 }) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2207 function( elem, context, xml ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2208 input[0] = elem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2209 matcher( input, null, xml, results );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2210 return !results.pop();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2211 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2212 }),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2213
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2214 "has": markFunction(function( selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2215 return function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2216 return Sizzle( selector, elem ).length > 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2217 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2218 }),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2219
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2220 "contains": markFunction(function( text ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2221 return function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2222 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2223 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2224 }),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2225
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2226 // "Whether an element is represented by a :lang() selector
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2227 // is based solely on the element's language value
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2228 // being equal to the identifier C,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2229 // or beginning with the identifier C immediately followed by "-".
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2230 // The matching of C against the element's language value is performed case-insensitively.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2231 // The identifier C does not have to be a valid language name."
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2232 // http://www.w3.org/TR/selectors/#lang-pseudo
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2233 "lang": markFunction( function( lang ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2234 // lang value must be a valid identifier
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2235 if ( !ridentifier.test(lang || "") ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2236 Sizzle.error( "unsupported lang: " + lang );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2237 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2238 lang = lang.replace( runescape, funescape ).toLowerCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2239 return function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2240 var elemLang;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2241 do {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2242 if ( (elemLang = documentIsHTML ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2243 elem.lang :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2244 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2245
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2246 elemLang = elemLang.toLowerCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2247 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2248 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2249 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2250 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2251 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2252 }),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2253
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2254 // Miscellaneous
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2255 "target": function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2256 var hash = window.location && window.location.hash;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2257 return hash && hash.slice( 1 ) === elem.id;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2258 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2259
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2260 "root": function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2261 return elem === docElem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2262 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2263
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2264 "focus": function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2265 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2266 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2267
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2268 // Boolean properties
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2269 "enabled": function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2270 return elem.disabled === false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2271 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2272
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2273 "disabled": function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2274 return elem.disabled === true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2275 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2276
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2277 "checked": function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2278 // In CSS3, :checked should return both checked and selected elements
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2279 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2280 var nodeName = elem.nodeName.toLowerCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2281 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2282 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2283
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2284 "selected": function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2285 // Accessing this property makes selected-by-default
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2286 // options in Safari work properly
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2287 if ( elem.parentNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2288 elem.parentNode.selectedIndex;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2289 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2290
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2291 return elem.selected === true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2292 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2293
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2294 // Contents
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2295 "empty": function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2296 // http://www.w3.org/TR/selectors/#empty-pseudo
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2297 // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2298 // not comment, processing instructions, or others
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2299 // Thanks to Diego Perini for the nodeName shortcut
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2300 // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2301 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2302 if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2303 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2304 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2305 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2306 return true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2307 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2308
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2309 "parent": function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2310 return !Expr.pseudos["empty"]( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2311 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2312
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2313 // Element/input types
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2314 "header": function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2315 return rheader.test( elem.nodeName );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2316 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2317
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2318 "input": function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2319 return rinputs.test( elem.nodeName );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2320 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2321
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2322 "button": function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2323 var name = elem.nodeName.toLowerCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2324 return name === "input" && elem.type === "button" || name === "button";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2325 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2326
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2327 "text": function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2328 var attr;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2329 // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2330 // use getAttribute instead to test this case
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2331 return elem.nodeName.toLowerCase() === "input" &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2332 elem.type === "text" &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2333 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2334 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2335
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2336 // Position-in-collection
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2337 "first": createPositionalPseudo(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2338 return [ 0 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2339 }),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2340
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2341 "last": createPositionalPseudo(function( matchIndexes, length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2342 return [ length - 1 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2343 }),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2344
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2345 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2346 return [ argument < 0 ? argument + length : argument ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2347 }),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2348
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2349 "even": createPositionalPseudo(function( matchIndexes, length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2350 var i = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2351 for ( ; i < length; i += 2 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2352 matchIndexes.push( i );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2353 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2354 return matchIndexes;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2355 }),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2356
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2357 "odd": createPositionalPseudo(function( matchIndexes, length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2358 var i = 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2359 for ( ; i < length; i += 2 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2360 matchIndexes.push( i );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2361 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2362 return matchIndexes;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2363 }),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2364
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2365 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2366 var i = argument < 0 ? argument + length : argument;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2367 for ( ; --i >= 0; ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2368 matchIndexes.push( i );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2369 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2370 return matchIndexes;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2371 }),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2372
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2373 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2374 var i = argument < 0 ? argument + length : argument;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2375 for ( ; ++i < length; ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2376 matchIndexes.push( i );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2377 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2378 return matchIndexes;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2379 })
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2380 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2381 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2382
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2383 Expr.pseudos["nth"] = Expr.pseudos["eq"];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2384
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2385 // Add button/input type pseudos
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2386 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2387 Expr.pseudos[ i ] = createInputPseudo( i );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2388 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2389 for ( i in { submit: true, reset: true } ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2390 Expr.pseudos[ i ] = createButtonPseudo( i );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2391 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2392
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2393 // Easy API for creating new setFilters
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2394 function setFilters() {}
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2395 setFilters.prototype = Expr.filters = Expr.pseudos;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2396 Expr.setFilters = new setFilters();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2397
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2398 function tokenize( selector, parseOnly ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2399 var matched, match, tokens, type,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2400 soFar, groups, preFilters,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2401 cached = tokenCache[ selector + " " ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2402
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2403 if ( cached ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2404 return parseOnly ? 0 : cached.slice( 0 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2405 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2406
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2407 soFar = selector;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2408 groups = [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2409 preFilters = Expr.preFilter;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2410
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2411 while ( soFar ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2412
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2413 // Comma and first run
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2414 if ( !matched || (match = rcomma.exec( soFar )) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2415 if ( match ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2416 // Don't consume trailing commas as valid
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2417 soFar = soFar.slice( match[0].length ) || soFar;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2418 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2419 groups.push( tokens = [] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2420 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2421
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2422 matched = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2423
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2424 // Combinators
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2425 if ( (match = rcombinators.exec( soFar )) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2426 matched = match.shift();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2427 tokens.push({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2428 value: matched,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2429 // Cast descendant combinators to space
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2430 type: match[0].replace( rtrim, " " )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2431 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2432 soFar = soFar.slice( matched.length );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2433 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2434
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2435 // Filters
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2436 for ( type in Expr.filter ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2437 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2438 (match = preFilters[ type ]( match ))) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2439 matched = match.shift();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2440 tokens.push({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2441 value: matched,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2442 type: type,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2443 matches: match
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2444 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2445 soFar = soFar.slice( matched.length );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2446 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2447 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2448
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2449 if ( !matched ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2450 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2451 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2452 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2453
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2454 // Return the length of the invalid excess
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2455 // if we're just parsing
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2456 // Otherwise, throw an error or return tokens
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2457 return parseOnly ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2458 soFar.length :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2459 soFar ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2460 Sizzle.error( selector ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2461 // Cache the tokens
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2462 tokenCache( selector, groups ).slice( 0 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2463 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2464
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2465 function toSelector( tokens ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2466 var i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2467 len = tokens.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2468 selector = "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2469 for ( ; i < len; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2470 selector += tokens[i].value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2471 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2472 return selector;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2473 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2474
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2475 function addCombinator( matcher, combinator, base ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2476 var dir = combinator.dir,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2477 checkNonElements = base && dir === "parentNode",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2478 doneName = done++;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2479
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2480 return combinator.first ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2481 // Check against closest ancestor/preceding element
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2482 function( elem, context, xml ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2483 while ( (elem = elem[ dir ]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2484 if ( elem.nodeType === 1 || checkNonElements ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2485 return matcher( elem, context, xml );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2486 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2487 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2488 } :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2489
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2490 // Check against all ancestor/preceding elements
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2491 function( elem, context, xml ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2492 var data, cache, outerCache,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2493 dirkey = dirruns + " " + doneName;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2494
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2495 // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2496 if ( xml ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2497 while ( (elem = elem[ dir ]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2498 if ( elem.nodeType === 1 || checkNonElements ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2499 if ( matcher( elem, context, xml ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2500 return true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2501 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2502 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2503 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2504 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2505 while ( (elem = elem[ dir ]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2506 if ( elem.nodeType === 1 || checkNonElements ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2507 outerCache = elem[ expando ] || (elem[ expando ] = {});
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2508 if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2509 if ( (data = cache[1]) === true || data === cachedruns ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2510 return data === true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2511 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2512 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2513 cache = outerCache[ dir ] = [ dirkey ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2514 cache[1] = matcher( elem, context, xml ) || cachedruns;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2515 if ( cache[1] === true ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2516 return true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2517 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2518 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2519 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2520 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2521 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2522 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2523 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2524
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2525 function elementMatcher( matchers ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2526 return matchers.length > 1 ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2527 function( elem, context, xml ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2528 var i = matchers.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2529 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2530 if ( !matchers[i]( elem, context, xml ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2531 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2532 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2533 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2534 return true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2535 } :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2536 matchers[0];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2537 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2538
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2539 function condense( unmatched, map, filter, context, xml ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2540 var elem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2541 newUnmatched = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2542 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2543 len = unmatched.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2544 mapped = map != null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2545
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2546 for ( ; i < len; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2547 if ( (elem = unmatched[i]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2548 if ( !filter || filter( elem, context, xml ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2549 newUnmatched.push( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2550 if ( mapped ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2551 map.push( i );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2552 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2553 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2554 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2555 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2556
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2557 return newUnmatched;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2558 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2559
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2560 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2561 if ( postFilter && !postFilter[ expando ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2562 postFilter = setMatcher( postFilter );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2563 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2564 if ( postFinder && !postFinder[ expando ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2565 postFinder = setMatcher( postFinder, postSelector );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2566 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2567 return markFunction(function( seed, results, context, xml ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2568 var temp, i, elem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2569 preMap = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2570 postMap = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2571 preexisting = results.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2572
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2573 // Get initial elements from seed or context
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2574 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2575
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2576 // Prefilter to get matcher input, preserving a map for seed-results synchronization
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2577 matcherIn = preFilter && ( seed || !selector ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2578 condense( elems, preMap, preFilter, context, xml ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2579 elems,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2580
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2581 matcherOut = matcher ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2582 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2583 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2584
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2585 // ...intermediate processing is necessary
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2586 [] :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2587
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2588 // ...otherwise use results directly
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2589 results :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2590 matcherIn;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2591
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2592 // Find primary matches
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2593 if ( matcher ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2594 matcher( matcherIn, matcherOut, context, xml );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2595 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2596
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2597 // Apply postFilter
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2598 if ( postFilter ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2599 temp = condense( matcherOut, postMap );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2600 postFilter( temp, [], context, xml );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2601
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2602 // Un-match failing elements by moving them back to matcherIn
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2603 i = temp.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2604 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2605 if ( (elem = temp[i]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2606 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2607 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2608 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2609 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2610
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2611 if ( seed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2612 if ( postFinder || preFilter ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2613 if ( postFinder ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2614 // Get the final matcherOut by condensing this intermediate into postFinder contexts
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2615 temp = [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2616 i = matcherOut.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2617 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2618 if ( (elem = matcherOut[i]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2619 // Restore matcherIn since elem is not yet a final match
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2620 temp.push( (matcherIn[i] = elem) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2621 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2622 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2623 postFinder( null, (matcherOut = []), temp, xml );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2624 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2625
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2626 // Move matched elements from seed to results to keep them synchronized
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2627 i = matcherOut.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2628 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2629 if ( (elem = matcherOut[i]) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2630 (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2631
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2632 seed[temp] = !(results[temp] = elem);
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2633 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2634 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2635 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2636
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2637 // Add elements to results, through postFinder if defined
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2638 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2639 matcherOut = condense(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2640 matcherOut === results ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2641 matcherOut.splice( preexisting, matcherOut.length ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2642 matcherOut
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2643 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2644 if ( postFinder ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2645 postFinder( null, results, matcherOut, xml );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2646 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2647 push.apply( results, matcherOut );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2648 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2649 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2650 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2651 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2652
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2653 function matcherFromTokens( tokens ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2654 var checkContext, matcher, j,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2655 len = tokens.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2656 leadingRelative = Expr.relative[ tokens[0].type ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2657 implicitRelative = leadingRelative || Expr.relative[" "],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2658 i = leadingRelative ? 1 : 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2659
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2660 // The foundational matcher ensures that elements are reachable from top-level context(s)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2661 matchContext = addCombinator( function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2662 return elem === checkContext;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2663 }, implicitRelative, true ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2664 matchAnyContext = addCombinator( function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2665 return indexOf.call( checkContext, elem ) > -1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2666 }, implicitRelative, true ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2667 matchers = [ function( elem, context, xml ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2668 return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2669 (checkContext = context).nodeType ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2670 matchContext( elem, context, xml ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2671 matchAnyContext( elem, context, xml ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2672 } ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2673
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2674 for ( ; i < len; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2675 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2676 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2677 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2678 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2679
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2680 // Return special upon seeing a positional matcher
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2681 if ( matcher[ expando ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2682 // Find the next relative operator (if any) for proper handling
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2683 j = ++i;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2684 for ( ; j < len; j++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2685 if ( Expr.relative[ tokens[j].type ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2686 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2687 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2688 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2689 return setMatcher(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2690 i > 1 && elementMatcher( matchers ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2691 i > 1 && toSelector(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2692 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2693 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2694 ).replace( rtrim, "$1" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2695 matcher,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2696 i < j && matcherFromTokens( tokens.slice( i, j ) ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2697 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2698 j < len && toSelector( tokens )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2699 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2700 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2701 matchers.push( matcher );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2702 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2703 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2704
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2705 return elementMatcher( matchers );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2706 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2707
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2708 function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2709 // A counter to specify which element is currently being matched
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2710 var matcherCachedRuns = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2711 bySet = setMatchers.length > 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2712 byElement = elementMatchers.length > 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2713 superMatcher = function( seed, context, xml, results, expandContext ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2714 var elem, j, matcher,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2715 setMatched = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2716 matchedCount = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2717 i = "0",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2718 unmatched = seed && [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2719 outermost = expandContext != null,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2720 contextBackup = outermostContext,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2721 // We must always have either seed elements or context
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2722 elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2723 // Use integer dirruns iff this is the outermost matcher
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2724 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2725
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2726 if ( outermost ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2727 outermostContext = context !== document && context;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2728 cachedruns = matcherCachedRuns;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2729 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2730
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2731 // Add elements passing elementMatchers directly to results
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2732 // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2733 for ( ; (elem = elems[i]) != null; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2734 if ( byElement && elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2735 j = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2736 while ( (matcher = elementMatchers[j++]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2737 if ( matcher( elem, context, xml ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2738 results.push( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2739 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2740 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2741 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2742 if ( outermost ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2743 dirruns = dirrunsUnique;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2744 cachedruns = ++matcherCachedRuns;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2745 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2746 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2747
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2748 // Track unmatched elements for set filters
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2749 if ( bySet ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2750 // They will have gone through all possible matchers
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2751 if ( (elem = !matcher && elem) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2752 matchedCount--;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2753 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2754
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2755 // Lengthen the array for every element, matched or not
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2756 if ( seed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2757 unmatched.push( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2758 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2759 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2760 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2761
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2762 // Apply set filters to unmatched elements
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2763 matchedCount += i;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2764 if ( bySet && i !== matchedCount ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2765 j = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2766 while ( (matcher = setMatchers[j++]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2767 matcher( unmatched, setMatched, context, xml );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2768 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2769
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2770 if ( seed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2771 // Reintegrate element matches to eliminate the need for sorting
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2772 if ( matchedCount > 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2773 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2774 if ( !(unmatched[i] || setMatched[i]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2775 setMatched[i] = pop.call( results );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2776 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2777 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2778 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2779
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2780 // Discard index placeholder values to get only actual matches
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2781 setMatched = condense( setMatched );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2782 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2783
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2784 // Add matches to results
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2785 push.apply( results, setMatched );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2786
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2787 // Seedless set matches succeeding multiple successful matchers stipulate sorting
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2788 if ( outermost && !seed && setMatched.length > 0 &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2789 ( matchedCount + setMatchers.length ) > 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2790
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2791 Sizzle.uniqueSort( results );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2792 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2793 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2794
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2795 // Override manipulation of globals by nested matchers
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2796 if ( outermost ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2797 dirruns = dirrunsUnique;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2798 outermostContext = contextBackup;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2799 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2800
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2801 return unmatched;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2802 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2803
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2804 return bySet ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2805 markFunction( superMatcher ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2806 superMatcher;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2807 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2808
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2809 compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2810 var i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2811 setMatchers = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2812 elementMatchers = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2813 cached = compilerCache[ selector + " " ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2814
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2815 if ( !cached ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2816 // Generate a function of recursive functions that can be used to check each element
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2817 if ( !group ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2818 group = tokenize( selector );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2819 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2820 i = group.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2821 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2822 cached = matcherFromTokens( group[i] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2823 if ( cached[ expando ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2824 setMatchers.push( cached );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2825 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2826 elementMatchers.push( cached );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2827 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2828 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2829
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2830 // Cache the compiled function
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2831 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2832 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2833 return cached;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2834 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2835
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2836 function multipleContexts( selector, contexts, results ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2837 var i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2838 len = contexts.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2839 for ( ; i < len; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2840 Sizzle( selector, contexts[i], results );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2841 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2842 return results;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2843 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2844
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2845 function select( selector, context, results, seed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2846 var i, tokens, token, type, find,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2847 match = tokenize( selector );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2848
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2849 if ( !seed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2850 // Try to minimize operations if there is only one group
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2851 if ( match.length === 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2852
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2853 // Take a shortcut and set the context if the root selector is an ID
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2854 tokens = match[0] = match[0].slice( 0 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2855 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2856 support.getById && context.nodeType === 9 && documentIsHTML &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2857 Expr.relative[ tokens[1].type ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2858
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2859 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2860 if ( !context ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2861 return results;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2862 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2863 selector = selector.slice( tokens.shift().value.length );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2864 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2865
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2866 // Fetch a seed set for right-to-left matching
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2867 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2868 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2869 token = tokens[i];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2870
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2871 // Abort if we hit a combinator
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2872 if ( Expr.relative[ (type = token.type) ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2873 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2874 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2875 if ( (find = Expr.find[ type ]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2876 // Search, expanding context for leading sibling combinators
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2877 if ( (seed = find(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2878 token.matches[0].replace( runescape, funescape ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2879 rsibling.test( tokens[0].type ) && context.parentNode || context
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2880 )) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2881
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2882 // If seed is empty or no tokens remain, we can return early
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2883 tokens.splice( i, 1 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2884 selector = seed.length && toSelector( tokens );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2885 if ( !selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2886 push.apply( results, seed );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2887 return results;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2888 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2889
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2890 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2891 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2892 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2893 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2894 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2895 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2896
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2897 // Compile and execute a filtering function
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2898 // Provide `match` to avoid retokenization if we modified the selector above
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2899 compile( selector, match )(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2900 seed,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2901 context,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2902 !documentIsHTML,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2903 results,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2904 rsibling.test( selector )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2905 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2906 return results;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2907 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2908
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2909 // One-time assignments
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2910
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2911 // Sort stability
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2912 support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2913
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2914 // Support: Chrome<14
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2915 // Always assume duplicates if they aren't passed to the comparison function
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2916 support.detectDuplicates = hasDuplicate;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2917
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2918 // Initialize against the default document
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2919 setDocument();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2920
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2921 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2922 // Detached nodes confoundingly follow *each other*
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2923 support.sortDetached = assert(function( div1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2924 // Should return 1, but returns 4 (following)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2925 return div1.compareDocumentPosition( document.createElement("div") ) & 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2926 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2927
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2928 // Support: IE<8
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2929 // Prevent attribute/property "interpolation"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2930 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2931 if ( !assert(function( div ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2932 div.innerHTML = "<a href='#'></a>";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2933 return div.firstChild.getAttribute("href") === "#" ;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2934 }) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2935 addHandle( "type|href|height|width", function( elem, name, isXML ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2936 if ( !isXML ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2937 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2938 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2939 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2940 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2941
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2942 // Support: IE<9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2943 // Use defaultValue in place of getAttribute("value")
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2944 if ( !support.attributes || !assert(function( div ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2945 div.innerHTML = "<input/>";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2946 div.firstChild.setAttribute( "value", "" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2947 return div.firstChild.getAttribute( "value" ) === "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2948 }) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2949 addHandle( "value", function( elem, name, isXML ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2950 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2951 return elem.defaultValue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2952 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2953 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2954 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2955
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2956 // Support: IE<9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2957 // Use getAttributeNode to fetch booleans when getAttribute lies
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2958 if ( !assert(function( div ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2959 return div.getAttribute("disabled") == null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2960 }) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2961 addHandle( booleans, function( elem, name, isXML ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2962 var val;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2963 if ( !isXML ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2964 return (val = elem.getAttributeNode( name )) && val.specified ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2965 val.value :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2966 elem[ name ] === true ? name.toLowerCase() : null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2967 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2968 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2969 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2970
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2971 jQuery.find = Sizzle;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2972 jQuery.expr = Sizzle.selectors;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2973 jQuery.expr[":"] = jQuery.expr.pseudos;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2974 jQuery.unique = Sizzle.uniqueSort;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2975 jQuery.text = Sizzle.getText;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2976 jQuery.isXMLDoc = Sizzle.isXML;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2977 jQuery.contains = Sizzle.contains;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2978
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2979
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2980 })( window );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2981 // String to Object options format cache
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2982 var optionsCache = {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2983
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2984 // Convert String-formatted options into Object-formatted ones and store in cache
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2985 function createOptions( options ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2986 var object = optionsCache[ options ] = {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2987 jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2988 object[ flag ] = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2989 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2990 return object;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2991 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2992
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2993 /*
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2994 * Create a callback list using the following parameters:
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2995 *
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2996 * options: an optional list of space-separated options that will change how
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2997 * the callback list behaves or a more traditional option object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2998 *
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
2999 * By default a callback list will act like an event callback list and can be
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3000 * "fired" multiple times.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3001 *
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3002 * Possible options:
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3003 *
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3004 * once: will ensure the callback list can only be fired once (like a Deferred)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3005 *
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3006 * memory: will keep track of previous values and will call any callback added
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3007 * after the list has been fired right away with the latest "memorized"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3008 * values (like a Deferred)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3009 *
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3010 * unique: will ensure a callback can only be added once (no duplicate in the list)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3011 *
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3012 * stopOnFalse: interrupt callings when a callback returns false
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3013 *
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3014 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3015 jQuery.Callbacks = function( options ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3016
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3017 // Convert options from String-formatted to Object-formatted if needed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3018 // (we check in cache first)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3019 options = typeof options === "string" ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3020 ( optionsCache[ options ] || createOptions( options ) ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3021 jQuery.extend( {}, options );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3022
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3023 var // Flag to know if list is currently firing
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3024 firing,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3025 // Last fire value (for non-forgettable lists)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3026 memory,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3027 // Flag to know if list was already fired
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3028 fired,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3029 // End of the loop when firing
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3030 firingLength,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3031 // Index of currently firing callback (modified by remove if needed)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3032 firingIndex,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3033 // First callback to fire (used internally by add and fireWith)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3034 firingStart,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3035 // Actual callback list
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3036 list = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3037 // Stack of fire calls for repeatable lists
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3038 stack = !options.once && [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3039 // Fire callbacks
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3040 fire = function( data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3041 memory = options.memory && data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3042 fired = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3043 firingIndex = firingStart || 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3044 firingStart = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3045 firingLength = list.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3046 firing = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3047 for ( ; list && firingIndex < firingLength; firingIndex++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3048 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3049 memory = false; // To prevent further calls using add
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3050 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3051 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3052 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3053 firing = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3054 if ( list ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3055 if ( stack ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3056 if ( stack.length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3057 fire( stack.shift() );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3058 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3059 } else if ( memory ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3060 list = [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3061 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3062 self.disable();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3063 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3064 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3065 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3066 // Actual Callbacks object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3067 self = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3068 // Add a callback or a collection of callbacks to the list
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3069 add: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3070 if ( list ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3071 // First, we save the current length
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3072 var start = list.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3073 (function add( args ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3074 jQuery.each( args, function( _, arg ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3075 var type = jQuery.type( arg );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3076 if ( type === "function" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3077 if ( !options.unique || !self.has( arg ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3078 list.push( arg );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3079 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3080 } else if ( arg && arg.length && type !== "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3081 // Inspect recursively
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3082 add( arg );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3083 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3084 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3085 })( arguments );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3086 // Do we need to add the callbacks to the
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3087 // current firing batch?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3088 if ( firing ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3089 firingLength = list.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3090 // With memory, if we're not firing then
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3091 // we should call right away
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3092 } else if ( memory ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3093 firingStart = start;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3094 fire( memory );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3095 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3096 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3097 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3098 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3099 // Remove a callback from the list
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3100 remove: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3101 if ( list ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3102 jQuery.each( arguments, function( _, arg ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3103 var index;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3104 while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3105 list.splice( index, 1 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3106 // Handle firing indexes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3107 if ( firing ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3108 if ( index <= firingLength ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3109 firingLength--;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3110 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3111 if ( index <= firingIndex ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3112 firingIndex--;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3113 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3114 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3115 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3116 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3117 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3118 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3119 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3120 // Check if a given callback is in the list.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3121 // If no argument is given, return whether or not list has callbacks attached.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3122 has: function( fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3123 return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3124 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3125 // Remove all callbacks from the list
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3126 empty: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3127 list = [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3128 firingLength = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3129 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3130 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3131 // Have the list do nothing anymore
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3132 disable: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3133 list = stack = memory = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3134 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3135 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3136 // Is it disabled?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3137 disabled: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3138 return !list;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3139 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3140 // Lock the list in its current state
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3141 lock: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3142 stack = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3143 if ( !memory ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3144 self.disable();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3145 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3146 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3147 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3148 // Is it locked?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3149 locked: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3150 return !stack;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3151 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3152 // Call all callbacks with the given context and arguments
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3153 fireWith: function( context, args ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3154 if ( list && ( !fired || stack ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3155 args = args || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3156 args = [ context, args.slice ? args.slice() : args ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3157 if ( firing ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3158 stack.push( args );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3159 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3160 fire( args );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3161 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3162 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3163 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3164 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3165 // Call all the callbacks with the given arguments
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3166 fire: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3167 self.fireWith( this, arguments );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3168 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3169 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3170 // To know if the callbacks have already been called at least once
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3171 fired: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3172 return !!fired;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3173 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3174 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3175
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3176 return self;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3177 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3178 jQuery.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3179
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3180 Deferred: function( func ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3181 var tuples = [
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3182 // action, add listener, listener list, final state
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3183 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3184 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3185 [ "notify", "progress", jQuery.Callbacks("memory") ]
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3186 ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3187 state = "pending",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3188 promise = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3189 state: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3190 return state;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3191 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3192 always: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3193 deferred.done( arguments ).fail( arguments );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3194 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3195 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3196 then: function( /* fnDone, fnFail, fnProgress */ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3197 var fns = arguments;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3198 return jQuery.Deferred(function( newDefer ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3199 jQuery.each( tuples, function( i, tuple ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3200 var action = tuple[ 0 ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3201 fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3202 // deferred[ done | fail | progress ] for forwarding actions to newDefer
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3203 deferred[ tuple[1] ](function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3204 var returned = fn && fn.apply( this, arguments );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3205 if ( returned && jQuery.isFunction( returned.promise ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3206 returned.promise()
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3207 .done( newDefer.resolve )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3208 .fail( newDefer.reject )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3209 .progress( newDefer.notify );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3210 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3211 newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3212 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3213 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3214 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3215 fns = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3216 }).promise();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3217 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3218 // Get a promise for this deferred
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3219 // If obj is provided, the promise aspect is added to the object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3220 promise: function( obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3221 return obj != null ? jQuery.extend( obj, promise ) : promise;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3222 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3223 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3224 deferred = {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3225
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3226 // Keep pipe for back-compat
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3227 promise.pipe = promise.then;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3228
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3229 // Add list-specific methods
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3230 jQuery.each( tuples, function( i, tuple ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3231 var list = tuple[ 2 ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3232 stateString = tuple[ 3 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3233
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3234 // promise[ done | fail | progress ] = list.add
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3235 promise[ tuple[1] ] = list.add;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3236
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3237 // Handle state
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3238 if ( stateString ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3239 list.add(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3240 // state = [ resolved | rejected ]
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3241 state = stateString;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3242
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3243 // [ reject_list | resolve_list ].disable; progress_list.lock
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3244 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3245 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3246
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3247 // deferred[ resolve | reject | notify ]
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3248 deferred[ tuple[0] ] = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3249 deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3250 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3251 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3252 deferred[ tuple[0] + "With" ] = list.fireWith;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3253 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3254
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3255 // Make the deferred a promise
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3256 promise.promise( deferred );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3257
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3258 // Call given func if any
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3259 if ( func ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3260 func.call( deferred, deferred );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3261 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3262
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3263 // All done!
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3264 return deferred;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3265 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3266
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3267 // Deferred helper
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3268 when: function( subordinate /* , ..., subordinateN */ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3269 var i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3270 resolveValues = core_slice.call( arguments ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3271 length = resolveValues.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3272
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3273 // the count of uncompleted subordinates
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3274 remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3275
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3276 // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3277 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3278
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3279 // Update function for both resolve and progress values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3280 updateFunc = function( i, contexts, values ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3281 return function( value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3282 contexts[ i ] = this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3283 values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3284 if( values === progressValues ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3285 deferred.notifyWith( contexts, values );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3286 } else if ( !( --remaining ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3287 deferred.resolveWith( contexts, values );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3288 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3289 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3290 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3291
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3292 progressValues, progressContexts, resolveContexts;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3293
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3294 // add listeners to Deferred subordinates; treat others as resolved
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3295 if ( length > 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3296 progressValues = new Array( length );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3297 progressContexts = new Array( length );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3298 resolveContexts = new Array( length );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3299 for ( ; i < length; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3300 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3301 resolveValues[ i ].promise()
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3302 .done( updateFunc( i, resolveContexts, resolveValues ) )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3303 .fail( deferred.reject )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3304 .progress( updateFunc( i, progressContexts, progressValues ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3305 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3306 --remaining;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3307 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3308 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3309 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3310
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3311 // if we're not waiting on anything, resolve the master
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3312 if ( !remaining ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3313 deferred.resolveWith( resolveContexts, resolveValues );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3314 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3315
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3316 return deferred.promise();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3317 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3318 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3319 jQuery.support = (function( support ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3320
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3321 var all, a, input, select, fragment, opt, eventName, isSupported, i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3322 div = document.createElement("div");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3323
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3324 // Setup
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3325 div.setAttribute( "className", "t" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3326 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3327
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3328 // Finish early in limited (non-browser) environments
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3329 all = div.getElementsByTagName("*") || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3330 a = div.getElementsByTagName("a")[ 0 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3331 if ( !a || !a.style || !all.length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3332 return support;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3333 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3334
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3335 // First batch of tests
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3336 select = document.createElement("select");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3337 opt = select.appendChild( document.createElement("option") );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3338 input = div.getElementsByTagName("input")[ 0 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3339
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3340 a.style.cssText = "top:1px;float:left;opacity:.5";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3341
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3342 // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3343 support.getSetAttribute = div.className !== "t";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3344
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3345 // IE strips leading whitespace when .innerHTML is used
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3346 support.leadingWhitespace = div.firstChild.nodeType === 3;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3347
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3348 // Make sure that tbody elements aren't automatically inserted
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3349 // IE will insert them into empty tables
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3350 support.tbody = !div.getElementsByTagName("tbody").length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3351
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3352 // Make sure that link elements get serialized correctly by innerHTML
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3353 // This requires a wrapper element in IE
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3354 support.htmlSerialize = !!div.getElementsByTagName("link").length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3355
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3356 // Get the style information from getAttribute
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3357 // (IE uses .cssText instead)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3358 support.style = /top/.test( a.getAttribute("style") );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3359
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3360 // Make sure that URLs aren't manipulated
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3361 // (IE normalizes it by default)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3362 support.hrefNormalized = a.getAttribute("href") === "/a";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3363
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3364 // Make sure that element opacity exists
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3365 // (IE uses filter instead)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3366 // Use a regex to work around a WebKit issue. See #5145
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3367 support.opacity = /^0.5/.test( a.style.opacity );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3368
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3369 // Verify style float existence
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3370 // (IE uses styleFloat instead of cssFloat)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3371 support.cssFloat = !!a.style.cssFloat;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3372
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3373 // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3374 support.checkOn = !!input.value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3375
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3376 // Make sure that a selected-by-default option has a working selected property.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3377 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3378 support.optSelected = opt.selected;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3379
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3380 // Tests for enctype support on a form (#6743)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3381 support.enctype = !!document.createElement("form").enctype;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3382
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3383 // Makes sure cloning an html5 element does not cause problems
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3384 // Where outerHTML is undefined, this still works
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3385 support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3386
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3387 // Will be defined later
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3388 support.inlineBlockNeedsLayout = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3389 support.shrinkWrapBlocks = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3390 support.pixelPosition = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3391 support.deleteExpando = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3392 support.noCloneEvent = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3393 support.reliableMarginRight = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3394 support.boxSizingReliable = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3395
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3396 // Make sure checked status is properly cloned
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3397 input.checked = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3398 support.noCloneChecked = input.cloneNode( true ).checked;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3399
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3400 // Make sure that the options inside disabled selects aren't marked as disabled
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3401 // (WebKit marks them as disabled)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3402 select.disabled = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3403 support.optDisabled = !opt.disabled;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3404
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3405 // Support: IE<9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3406 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3407 delete div.test;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3408 } catch( e ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3409 support.deleteExpando = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3410 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3411
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3412 // Check if we can trust getAttribute("value")
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3413 input = document.createElement("input");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3414 input.setAttribute( "value", "" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3415 support.input = input.getAttribute( "value" ) === "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3416
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3417 // Check if an input maintains its value after becoming a radio
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3418 input.value = "t";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3419 input.setAttribute( "type", "radio" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3420 support.radioValue = input.value === "t";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3421
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3422 // #11217 - WebKit loses check when the name is after the checked attribute
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3423 input.setAttribute( "checked", "t" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3424 input.setAttribute( "name", "t" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3425
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3426 fragment = document.createDocumentFragment();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3427 fragment.appendChild( input );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3428
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3429 // Check if a disconnected checkbox will retain its checked
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3430 // value of true after appended to the DOM (IE6/7)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3431 support.appendChecked = input.checked;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3432
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3433 // WebKit doesn't clone checked state correctly in fragments
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3434 support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3435
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3436 // Support: IE<9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3437 // Opera does not clone events (and typeof div.attachEvent === undefined).
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3438 // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3439 if ( div.attachEvent ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3440 div.attachEvent( "onclick", function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3441 support.noCloneEvent = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3442 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3443
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3444 div.cloneNode( true ).click();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3445 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3446
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3447 // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3448 // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3449 for ( i in { submit: true, change: true, focusin: true }) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3450 div.setAttribute( eventName = "on" + i, "t" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3451
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3452 support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3453 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3454
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3455 div.style.backgroundClip = "content-box";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3456 div.cloneNode( true ).style.backgroundClip = "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3457 support.clearCloneStyle = div.style.backgroundClip === "content-box";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3458
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3459 // Support: IE<9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3460 // Iteration over object's inherited properties before its own.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3461 for ( i in jQuery( support ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3462 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3463 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3464 support.ownLast = i !== "0";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3465
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3466 // Run tests that need a body at doc ready
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3467 jQuery(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3468 var container, marginDiv, tds,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3469 divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3470 body = document.getElementsByTagName("body")[0];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3471
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3472 if ( !body ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3473 // Return for frameset docs that don't have a body
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3474 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3475 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3476
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3477 container = document.createElement("div");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3478 container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3479
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3480 body.appendChild( container ).appendChild( div );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3481
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3482 // Support: IE8
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3483 // Check if table cells still have offsetWidth/Height when they are set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3484 // to display:none and there are still other visible table cells in a
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3485 // table row; if so, offsetWidth/Height are not reliable for use when
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3486 // determining if an element has been hidden directly using
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3487 // display:none (it is still safe to use offsets if a parent element is
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3488 // hidden; don safety goggles and see bug #4512 for more information).
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3489 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3490 tds = div.getElementsByTagName("td");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3491 tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3492 isSupported = ( tds[ 0 ].offsetHeight === 0 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3493
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3494 tds[ 0 ].style.display = "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3495 tds[ 1 ].style.display = "none";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3496
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3497 // Support: IE8
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3498 // Check if empty table cells still have offsetWidth/Height
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3499 support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3500
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3501 // Check box-sizing and margin behavior.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3502 div.innerHTML = "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3503 div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3504
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3505 // Workaround failing boxSizing test due to offsetWidth returning wrong value
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3506 // with some non-1 values of body zoom, ticket #13543
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3507 jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3508 support.boxSizing = div.offsetWidth === 4;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3509 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3510
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3511 // Use window.getComputedStyle because jsdom on node.js will break without it.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3512 if ( window.getComputedStyle ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3513 support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3514 support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3515
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3516 // Check if div with explicit width and no margin-right incorrectly
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3517 // gets computed margin-right based on width of container. (#3333)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3518 // Fails in WebKit before Feb 2011 nightlies
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3519 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3520 marginDiv = div.appendChild( document.createElement("div") );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3521 marginDiv.style.cssText = div.style.cssText = divReset;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3522 marginDiv.style.marginRight = marginDiv.style.width = "0";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3523 div.style.width = "1px";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3524
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3525 support.reliableMarginRight =
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3526 !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3527 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3528
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3529 if ( typeof div.style.zoom !== core_strundefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3530 // Support: IE<8
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3531 // Check if natively block-level elements act like inline-block
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3532 // elements when setting their display to 'inline' and giving
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3533 // them layout
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3534 div.innerHTML = "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3535 div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3536 support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3537
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3538 // Support: IE6
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3539 // Check if elements with layout shrink-wrap their children
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3540 div.style.display = "block";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3541 div.innerHTML = "<div></div>";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3542 div.firstChild.style.width = "5px";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3543 support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3544
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3545 if ( support.inlineBlockNeedsLayout ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3546 // Prevent IE 6 from affecting layout for positioned elements #11048
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3547 // Prevent IE from shrinking the body in IE 7 mode #12869
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3548 // Support: IE<8
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3549 body.style.zoom = 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3550 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3551 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3552
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3553 body.removeChild( container );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3554
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3555 // Null elements to avoid leaks in IE
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3556 container = div = tds = marginDiv = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3557 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3558
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3559 // Null elements to avoid leaks in IE
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3560 all = select = fragment = opt = a = input = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3561
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3562 return support;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3563 })({});
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3564
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3565 var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3566 rmultiDash = /([A-Z])/g;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3567
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3568 function internalData( elem, name, data, pvt /* Internal Use Only */ ){
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3569 if ( !jQuery.acceptData( elem ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3570 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3571 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3572
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3573 var ret, thisCache,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3574 internalKey = jQuery.expando,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3575
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3576 // We have to handle DOM nodes and JS objects differently because IE6-7
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3577 // can't GC object references properly across the DOM-JS boundary
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3578 isNode = elem.nodeType,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3579
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3580 // Only DOM nodes need the global jQuery cache; JS object data is
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3581 // attached directly to the object so GC can occur automatically
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3582 cache = isNode ? jQuery.cache : elem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3583
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3584 // Only defining an ID for JS objects if its cache already exists allows
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3585 // the code to shortcut on the same path as a DOM node with no cache
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3586 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3587
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3588 // Avoid doing any more work than we need to when trying to get data on an
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3589 // object that has no data at all
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3590 if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3591 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3592 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3593
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3594 if ( !id ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3595 // Only DOM nodes need a new unique ID for each element since their data
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3596 // ends up in the global cache
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3597 if ( isNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3598 id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3599 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3600 id = internalKey;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3601 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3602 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3603
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3604 if ( !cache[ id ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3605 // Avoid exposing jQuery metadata on plain JS objects when the object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3606 // is serialized using JSON.stringify
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3607 cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3608 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3609
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3610 // An object can be passed to jQuery.data instead of a key/value pair; this gets
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3611 // shallow copied over onto the existing cache
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3612 if ( typeof name === "object" || typeof name === "function" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3613 if ( pvt ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3614 cache[ id ] = jQuery.extend( cache[ id ], name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3615 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3616 cache[ id ].data = jQuery.extend( cache[ id ].data, name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3617 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3618 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3619
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3620 thisCache = cache[ id ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3621
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3622 // jQuery data() is stored in a separate object inside the object's internal data
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3623 // cache in order to avoid key collisions between internal data and user-defined
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3624 // data.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3625 if ( !pvt ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3626 if ( !thisCache.data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3627 thisCache.data = {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3628 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3629
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3630 thisCache = thisCache.data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3631 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3632
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3633 if ( data !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3634 thisCache[ jQuery.camelCase( name ) ] = data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3635 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3636
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3637 // Check for both converted-to-camel and non-converted data property names
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3638 // If a data property was specified
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3639 if ( typeof name === "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3640
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3641 // First Try to find as-is property data
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3642 ret = thisCache[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3643
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3644 // Test for null|undefined property data
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3645 if ( ret == null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3646
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3647 // Try to find the camelCased property
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3648 ret = thisCache[ jQuery.camelCase( name ) ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3649 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3650 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3651 ret = thisCache;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3652 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3653
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3654 return ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3655 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3656
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3657 function internalRemoveData( elem, name, pvt ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3658 if ( !jQuery.acceptData( elem ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3659 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3660 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3661
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3662 var thisCache, i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3663 isNode = elem.nodeType,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3664
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3665 // See jQuery.data for more information
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3666 cache = isNode ? jQuery.cache : elem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3667 id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3668
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3669 // If there is already no cache entry for this object, there is no
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3670 // purpose in continuing
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3671 if ( !cache[ id ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3672 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3673 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3674
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3675 if ( name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3676
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3677 thisCache = pvt ? cache[ id ] : cache[ id ].data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3678
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3679 if ( thisCache ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3680
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3681 // Support array or space separated string names for data keys
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3682 if ( !jQuery.isArray( name ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3683
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3684 // try the string as a key before any manipulation
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3685 if ( name in thisCache ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3686 name = [ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3687 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3688
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3689 // split the camel cased version by spaces unless a key with the spaces exists
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3690 name = jQuery.camelCase( name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3691 if ( name in thisCache ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3692 name = [ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3693 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3694 name = name.split(" ");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3695 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3696 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3697 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3698 // If "name" is an array of keys...
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3699 // When data is initially created, via ("key", "val") signature,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3700 // keys will be converted to camelCase.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3701 // Since there is no way to tell _how_ a key was added, remove
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3702 // both plain key and camelCase key. #12786
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3703 // This will only penalize the array argument path.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3704 name = name.concat( jQuery.map( name, jQuery.camelCase ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3705 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3706
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3707 i = name.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3708 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3709 delete thisCache[ name[i] ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3710 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3711
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3712 // If there is no data left in the cache, we want to continue
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3713 // and let the cache object itself get destroyed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3714 if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3715 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3716 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3717 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3718 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3719
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3720 // See jQuery.data for more information
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3721 if ( !pvt ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3722 delete cache[ id ].data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3723
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3724 // Don't destroy the parent cache unless the internal data object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3725 // had been the only thing left in it
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3726 if ( !isEmptyDataObject( cache[ id ] ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3727 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3728 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3729 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3730
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3731 // Destroy the cache
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3732 if ( isNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3733 jQuery.cleanData( [ elem ], true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3734
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3735 // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3736 /* jshint eqeqeq: false */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3737 } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3738 /* jshint eqeqeq: true */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3739 delete cache[ id ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3740
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3741 // When all else fails, null
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3742 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3743 cache[ id ] = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3744 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3745 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3746
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3747 jQuery.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3748 cache: {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3749
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3750 // The following elements throw uncatchable exceptions if you
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3751 // attempt to add expando properties to them.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3752 noData: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3753 "applet": true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3754 "embed": true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3755 // Ban all objects except for Flash (which handle expandos)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3756 "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3757 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3758
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3759 hasData: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3760 elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3761 return !!elem && !isEmptyDataObject( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3762 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3763
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3764 data: function( elem, name, data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3765 return internalData( elem, name, data );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3766 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3767
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3768 removeData: function( elem, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3769 return internalRemoveData( elem, name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3770 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3771
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3772 // For internal use only.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3773 _data: function( elem, name, data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3774 return internalData( elem, name, data, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3775 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3776
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3777 _removeData: function( elem, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3778 return internalRemoveData( elem, name, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3779 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3780
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3781 // A method for determining if a DOM node can handle the data expando
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3782 acceptData: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3783 // Do not set data on non-element because it will not be cleared (#8335).
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3784 if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3785 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3786 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3787
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3788 var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3789
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3790 // nodes accept data unless otherwise specified; rejection can be conditional
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3791 return !noData || noData !== true && elem.getAttribute("classid") === noData;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3792 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3793 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3794
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3795 jQuery.fn.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3796 data: function( key, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3797 var attrs, name,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3798 data = null,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3799 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3800 elem = this[0];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3801
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3802 // Special expections of .data basically thwart jQuery.access,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3803 // so implement the relevant behavior ourselves
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3804
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3805 // Gets all values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3806 if ( key === undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3807 if ( this.length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3808 data = jQuery.data( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3809
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3810 if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3811 attrs = elem.attributes;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3812 for ( ; i < attrs.length; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3813 name = attrs[i].name;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3814
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3815 if ( name.indexOf("data-") === 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3816 name = jQuery.camelCase( name.slice(5) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3817
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3818 dataAttr( elem, name, data[ name ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3819 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3820 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3821 jQuery._data( elem, "parsedAttrs", true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3822 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3823 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3824
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3825 return data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3826 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3827
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3828 // Sets multiple values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3829 if ( typeof key === "object" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3830 return this.each(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3831 jQuery.data( this, key );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3832 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3833 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3834
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3835 return arguments.length > 1 ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3836
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3837 // Sets one value
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3838 this.each(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3839 jQuery.data( this, key, value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3840 }) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3841
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3842 // Gets one value
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3843 // Try to fetch any internally stored data first
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3844 elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3845 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3846
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3847 removeData: function( key ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3848 return this.each(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3849 jQuery.removeData( this, key );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3850 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3851 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3852 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3853
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3854 function dataAttr( elem, key, data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3855 // If nothing was found internally, try to fetch any
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3856 // data from the HTML5 data-* attribute
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3857 if ( data === undefined && elem.nodeType === 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3858
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3859 var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3860
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3861 data = elem.getAttribute( name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3862
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3863 if ( typeof data === "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3864 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3865 data = data === "true" ? true :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3866 data === "false" ? false :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3867 data === "null" ? null :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3868 // Only convert to a number if it doesn't change the string
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3869 +data + "" === data ? +data :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3870 rbrace.test( data ) ? jQuery.parseJSON( data ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3871 data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3872 } catch( e ) {}
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3873
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3874 // Make sure we set the data so it isn't changed later
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3875 jQuery.data( elem, key, data );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3876
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3877 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3878 data = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3879 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3880 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3881
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3882 return data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3883 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3884
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3885 // checks a cache object for emptiness
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3886 function isEmptyDataObject( obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3887 var name;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3888 for ( name in obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3889
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3890 // if the public data object is empty, the private is still empty
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3891 if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3892 continue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3893 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3894 if ( name !== "toJSON" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3895 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3896 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3897 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3898
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3899 return true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3900 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3901 jQuery.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3902 queue: function( elem, type, data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3903 var queue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3904
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3905 if ( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3906 type = ( type || "fx" ) + "queue";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3907 queue = jQuery._data( elem, type );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3908
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3909 // Speed up dequeue by getting out quickly if this is just a lookup
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3910 if ( data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3911 if ( !queue || jQuery.isArray(data) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3912 queue = jQuery._data( elem, type, jQuery.makeArray(data) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3913 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3914 queue.push( data );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3915 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3916 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3917 return queue || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3918 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3919 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3920
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3921 dequeue: function( elem, type ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3922 type = type || "fx";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3923
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3924 var queue = jQuery.queue( elem, type ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3925 startLength = queue.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3926 fn = queue.shift(),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3927 hooks = jQuery._queueHooks( elem, type ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3928 next = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3929 jQuery.dequeue( elem, type );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3930 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3931
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3932 // If the fx queue is dequeued, always remove the progress sentinel
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3933 if ( fn === "inprogress" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3934 fn = queue.shift();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3935 startLength--;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3936 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3937
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3938 if ( fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3939
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3940 // Add a progress sentinel to prevent the fx queue from being
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3941 // automatically dequeued
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3942 if ( type === "fx" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3943 queue.unshift( "inprogress" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3944 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3945
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3946 // clear up the last queue stop function
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3947 delete hooks.stop;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3948 fn.call( elem, next, hooks );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3949 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3950
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3951 if ( !startLength && hooks ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3952 hooks.empty.fire();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3953 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3954 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3955
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3956 // not intended for public consumption - generates a queueHooks object, or returns the current one
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3957 _queueHooks: function( elem, type ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3958 var key = type + "queueHooks";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3959 return jQuery._data( elem, key ) || jQuery._data( elem, key, {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3960 empty: jQuery.Callbacks("once memory").add(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3961 jQuery._removeData( elem, type + "queue" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3962 jQuery._removeData( elem, key );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3963 })
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3964 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3965 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3966 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3967
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3968 jQuery.fn.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3969 queue: function( type, data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3970 var setter = 2;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3971
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3972 if ( typeof type !== "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3973 data = type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3974 type = "fx";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3975 setter--;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3976 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3977
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3978 if ( arguments.length < setter ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3979 return jQuery.queue( this[0], type );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3980 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3981
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3982 return data === undefined ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3983 this :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3984 this.each(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3985 var queue = jQuery.queue( this, type, data );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3986
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3987 // ensure a hooks for this queue
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3988 jQuery._queueHooks( this, type );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3989
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3990 if ( type === "fx" && queue[0] !== "inprogress" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3991 jQuery.dequeue( this, type );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3992 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3993 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3994 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3995 dequeue: function( type ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3996 return this.each(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3997 jQuery.dequeue( this, type );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3998 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
3999 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4000 // Based off of the plugin by Clint Helfers, with permission.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4001 // http://blindsignals.com/index.php/2009/07/jquery-delay/
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4002 delay: function( time, type ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4003 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4004 type = type || "fx";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4005
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4006 return this.queue( type, function( next, hooks ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4007 var timeout = setTimeout( next, time );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4008 hooks.stop = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4009 clearTimeout( timeout );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4010 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4011 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4012 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4013 clearQueue: function( type ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4014 return this.queue( type || "fx", [] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4015 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4016 // Get a promise resolved when queues of a certain type
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4017 // are emptied (fx is the type by default)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4018 promise: function( type, obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4019 var tmp,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4020 count = 1,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4021 defer = jQuery.Deferred(),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4022 elements = this,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4023 i = this.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4024 resolve = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4025 if ( !( --count ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4026 defer.resolveWith( elements, [ elements ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4027 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4028 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4029
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4030 if ( typeof type !== "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4031 obj = type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4032 type = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4033 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4034 type = type || "fx";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4035
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4036 while( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4037 tmp = jQuery._data( elements[ i ], type + "queueHooks" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4038 if ( tmp && tmp.empty ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4039 count++;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4040 tmp.empty.add( resolve );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4041 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4042 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4043 resolve();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4044 return defer.promise( obj );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4045 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4046 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4047 var nodeHook, boolHook,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4048 rclass = /[\t\r\n\f]/g,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4049 rreturn = /\r/g,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4050 rfocusable = /^(?:input|select|textarea|button|object)$/i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4051 rclickable = /^(?:a|area)$/i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4052 ruseDefault = /^(?:checked|selected)$/i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4053 getSetAttribute = jQuery.support.getSetAttribute,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4054 getSetInput = jQuery.support.input;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4055
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4056 jQuery.fn.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4057 attr: function( name, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4058 return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4059 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4060
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4061 removeAttr: function( name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4062 return this.each(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4063 jQuery.removeAttr( this, name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4064 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4065 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4066
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4067 prop: function( name, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4068 return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4069 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4070
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4071 removeProp: function( name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4072 name = jQuery.propFix[ name ] || name;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4073 return this.each(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4074 // try/catch handles cases where IE balks (such as removing a property on window)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4075 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4076 this[ name ] = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4077 delete this[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4078 } catch( e ) {}
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4079 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4080 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4081
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4082 addClass: function( value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4083 var classes, elem, cur, clazz, j,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4084 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4085 len = this.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4086 proceed = typeof value === "string" && value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4087
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4088 if ( jQuery.isFunction( value ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4089 return this.each(function( j ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4090 jQuery( this ).addClass( value.call( this, j, this.className ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4091 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4092 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4093
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4094 if ( proceed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4095 // The disjunction here is for better compressibility (see removeClass)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4096 classes = ( value || "" ).match( core_rnotwhite ) || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4097
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4098 for ( ; i < len; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4099 elem = this[ i ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4100 cur = elem.nodeType === 1 && ( elem.className ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4101 ( " " + elem.className + " " ).replace( rclass, " " ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4102 " "
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4103 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4104
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4105 if ( cur ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4106 j = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4107 while ( (clazz = classes[j++]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4108 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4109 cur += clazz + " ";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4110 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4111 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4112 elem.className = jQuery.trim( cur );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4113
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4114 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4115 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4116 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4117
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4118 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4119 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4120
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4121 removeClass: function( value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4122 var classes, elem, cur, clazz, j,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4123 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4124 len = this.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4125 proceed = arguments.length === 0 || typeof value === "string" && value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4126
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4127 if ( jQuery.isFunction( value ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4128 return this.each(function( j ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4129 jQuery( this ).removeClass( value.call( this, j, this.className ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4130 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4131 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4132 if ( proceed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4133 classes = ( value || "" ).match( core_rnotwhite ) || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4134
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4135 for ( ; i < len; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4136 elem = this[ i ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4137 // This expression is here for better compressibility (see addClass)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4138 cur = elem.nodeType === 1 && ( elem.className ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4139 ( " " + elem.className + " " ).replace( rclass, " " ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4140 ""
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4141 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4142
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4143 if ( cur ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4144 j = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4145 while ( (clazz = classes[j++]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4146 // Remove *all* instances
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4147 while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4148 cur = cur.replace( " " + clazz + " ", " " );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4149 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4150 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4151 elem.className = value ? jQuery.trim( cur ) : "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4152 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4153 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4154 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4155
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4156 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4157 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4158
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4159 toggleClass: function( value, stateVal ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4160 var type = typeof value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4161
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4162 if ( typeof stateVal === "boolean" && type === "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4163 return stateVal ? this.addClass( value ) : this.removeClass( value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4164 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4165
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4166 if ( jQuery.isFunction( value ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4167 return this.each(function( i ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4168 jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4169 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4170 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4171
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4172 return this.each(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4173 if ( type === "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4174 // toggle individual class names
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4175 var className,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4176 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4177 self = jQuery( this ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4178 classNames = value.match( core_rnotwhite ) || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4179
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4180 while ( (className = classNames[ i++ ]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4181 // check each className given, space separated list
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4182 if ( self.hasClass( className ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4183 self.removeClass( className );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4184 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4185 self.addClass( className );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4186 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4187 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4188
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4189 // Toggle whole class name
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4190 } else if ( type === core_strundefined || type === "boolean" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4191 if ( this.className ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4192 // store className if set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4193 jQuery._data( this, "__className__", this.className );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4194 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4195
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4196 // If the element has a class name or if we're passed "false",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4197 // then remove the whole classname (if there was one, the above saved it).
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4198 // Otherwise bring back whatever was previously saved (if anything),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4199 // falling back to the empty string if nothing was stored.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4200 this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4201 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4202 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4203 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4204
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4205 hasClass: function( selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4206 var className = " " + selector + " ",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4207 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4208 l = this.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4209 for ( ; i < l; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4210 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4211 return true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4212 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4213 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4214
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4215 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4216 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4217
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4218 val: function( value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4219 var ret, hooks, isFunction,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4220 elem = this[0];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4221
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4222 if ( !arguments.length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4223 if ( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4224 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4225
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4226 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4227 return ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4228 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4229
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4230 ret = elem.value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4231
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4232 return typeof ret === "string" ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4233 // handle most common string cases
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4234 ret.replace(rreturn, "") :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4235 // handle cases where value is null/undef or number
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4236 ret == null ? "" : ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4237 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4238
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4239 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4240 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4241
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4242 isFunction = jQuery.isFunction( value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4243
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4244 return this.each(function( i ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4245 var val;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4246
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4247 if ( this.nodeType !== 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4248 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4249 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4250
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4251 if ( isFunction ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4252 val = value.call( this, i, jQuery( this ).val() );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4253 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4254 val = value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4255 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4256
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4257 // Treat null/undefined as ""; convert numbers to string
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4258 if ( val == null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4259 val = "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4260 } else if ( typeof val === "number" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4261 val += "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4262 } else if ( jQuery.isArray( val ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4263 val = jQuery.map(val, function ( value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4264 return value == null ? "" : value + "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4265 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4266 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4267
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4268 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4269
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4270 // If set returns undefined, fall back to normal setting
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4271 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4272 this.value = val;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4273 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4274 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4275 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4276 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4277
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4278 jQuery.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4279 valHooks: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4280 option: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4281 get: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4282 // Use proper attribute retrieval(#6932, #12072)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4283 var val = jQuery.find.attr( elem, "value" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4284 return val != null ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4285 val :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4286 elem.text;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4287 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4288 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4289 select: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4290 get: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4291 var value, option,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4292 options = elem.options,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4293 index = elem.selectedIndex,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4294 one = elem.type === "select-one" || index < 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4295 values = one ? null : [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4296 max = one ? index + 1 : options.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4297 i = index < 0 ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4298 max :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4299 one ? index : 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4300
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4301 // Loop through all the selected options
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4302 for ( ; i < max; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4303 option = options[ i ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4304
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4305 // oldIE doesn't update selected after form reset (#2551)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4306 if ( ( option.selected || i === index ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4307 // Don't return options that are disabled or in a disabled optgroup
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4308 ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4309 ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4310
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4311 // Get the specific value for the option
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4312 value = jQuery( option ).val();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4313
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4314 // We don't need an array for one selects
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4315 if ( one ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4316 return value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4317 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4318
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4319 // Multi-Selects return an array
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4320 values.push( value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4321 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4322 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4323
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4324 return values;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4325 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4326
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4327 set: function( elem, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4328 var optionSet, option,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4329 options = elem.options,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4330 values = jQuery.makeArray( value ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4331 i = options.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4332
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4333 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4334 option = options[ i ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4335 if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4336 optionSet = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4337 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4338 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4339
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4340 // force browsers to behave consistently when non-matching value is set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4341 if ( !optionSet ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4342 elem.selectedIndex = -1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4343 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4344 return values;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4345 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4346 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4347 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4348
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4349 attr: function( elem, name, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4350 var hooks, ret,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4351 nType = elem.nodeType;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4352
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4353 // don't get/set attributes on text, comment and attribute nodes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4354 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4355 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4356 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4357
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4358 // Fallback to prop when attributes are not supported
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4359 if ( typeof elem.getAttribute === core_strundefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4360 return jQuery.prop( elem, name, value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4361 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4362
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4363 // All attributes are lowercase
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4364 // Grab necessary hook if one is defined
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4365 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4366 name = name.toLowerCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4367 hooks = jQuery.attrHooks[ name ] ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4368 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4369 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4370
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4371 if ( value !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4372
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4373 if ( value === null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4374 jQuery.removeAttr( elem, name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4375
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4376 } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4377 return ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4378
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4379 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4380 elem.setAttribute( name, value + "" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4381 return value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4382 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4383
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4384 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4385 return ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4386
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4387 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4388 ret = jQuery.find.attr( elem, name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4389
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4390 // Non-existent attributes return null, we normalize to undefined
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4391 return ret == null ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4392 undefined :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4393 ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4394 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4395 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4396
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4397 removeAttr: function( elem, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4398 var name, propName,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4399 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4400 attrNames = value && value.match( core_rnotwhite );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4401
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4402 if ( attrNames && elem.nodeType === 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4403 while ( (name = attrNames[i++]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4404 propName = jQuery.propFix[ name ] || name;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4405
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4406 // Boolean attributes get special treatment (#10870)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4407 if ( jQuery.expr.match.bool.test( name ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4408 // Set corresponding property to false
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4409 if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4410 elem[ propName ] = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4411 // Support: IE<9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4412 // Also clear defaultChecked/defaultSelected (if appropriate)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4413 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4414 elem[ jQuery.camelCase( "default-" + name ) ] =
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4415 elem[ propName ] = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4416 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4417
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4418 // See #9699 for explanation of this approach (setting first, then removal)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4419 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4420 jQuery.attr( elem, name, "" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4421 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4422
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4423 elem.removeAttribute( getSetAttribute ? name : propName );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4424 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4425 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4426 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4427
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4428 attrHooks: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4429 type: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4430 set: function( elem, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4431 if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4432 // Setting the type on a radio button after the value resets the value in IE6-9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4433 // Reset value to default in case type is set after value during creation
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4434 var val = elem.value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4435 elem.setAttribute( "type", value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4436 if ( val ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4437 elem.value = val;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4438 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4439 return value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4440 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4441 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4442 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4443 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4444
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4445 propFix: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4446 "for": "htmlFor",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4447 "class": "className"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4448 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4449
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4450 prop: function( elem, name, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4451 var ret, hooks, notxml,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4452 nType = elem.nodeType;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4453
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4454 // don't get/set properties on text, comment and attribute nodes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4455 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4456 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4457 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4458
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4459 notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4460
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4461 if ( notxml ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4462 // Fix name and attach hooks
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4463 name = jQuery.propFix[ name ] || name;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4464 hooks = jQuery.propHooks[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4465 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4466
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4467 if ( value !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4468 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4469 ret :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4470 ( elem[ name ] = value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4471
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4472 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4473 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4474 ret :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4475 elem[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4476 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4477 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4478
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4479 propHooks: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4480 tabIndex: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4481 get: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4482 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4483 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4484 // Use proper attribute retrieval(#12072)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4485 var tabindex = jQuery.find.attr( elem, "tabindex" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4486
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4487 return tabindex ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4488 parseInt( tabindex, 10 ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4489 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4490 0 :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4491 -1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4492 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4493 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4494 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4495 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4496
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4497 // Hooks for boolean attributes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4498 boolHook = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4499 set: function( elem, value, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4500 if ( value === false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4501 // Remove boolean attributes when set to false
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4502 jQuery.removeAttr( elem, name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4503 } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4504 // IE<8 needs the *property* name
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4505 elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4506
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4507 // Use defaultChecked and defaultSelected for oldIE
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4508 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4509 elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4510 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4511
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4512 return name;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4513 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4514 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4515 jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4516 var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4517
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4518 jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4519 function( elem, name, isXML ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4520 var fn = jQuery.expr.attrHandle[ name ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4521 ret = isXML ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4522 undefined :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4523 /* jshint eqeqeq: false */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4524 (jQuery.expr.attrHandle[ name ] = undefined) !=
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4525 getter( elem, name, isXML ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4526
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4527 name.toLowerCase() :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4528 null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4529 jQuery.expr.attrHandle[ name ] = fn;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4530 return ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4531 } :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4532 function( elem, name, isXML ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4533 return isXML ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4534 undefined :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4535 elem[ jQuery.camelCase( "default-" + name ) ] ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4536 name.toLowerCase() :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4537 null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4538 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4539 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4540
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4541 // fix oldIE attroperties
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4542 if ( !getSetInput || !getSetAttribute ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4543 jQuery.attrHooks.value = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4544 set: function( elem, value, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4545 if ( jQuery.nodeName( elem, "input" ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4546 // Does not return so that setAttribute is also used
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4547 elem.defaultValue = value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4548 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4549 // Use nodeHook if defined (#1954); otherwise setAttribute is fine
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4550 return nodeHook && nodeHook.set( elem, value, name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4551 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4552 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4553 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4554 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4555
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4556 // IE6/7 do not support getting/setting some attributes with get/setAttribute
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4557 if ( !getSetAttribute ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4558
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4559 // Use this for any attribute in IE6/7
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4560 // This fixes almost every IE6/7 issue
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4561 nodeHook = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4562 set: function( elem, value, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4563 // Set the existing or create a new attribute node
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4564 var ret = elem.getAttributeNode( name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4565 if ( !ret ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4566 elem.setAttributeNode(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4567 (ret = elem.ownerDocument.createAttribute( name ))
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4568 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4569 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4570
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4571 ret.value = value += "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4572
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4573 // Break association with cloned elements by also using setAttribute (#9646)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4574 return name === "value" || value === elem.getAttribute( name ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4575 value :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4576 undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4577 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4578 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4579 jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords =
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4580 // Some attributes are constructed with empty-string values when not defined
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4581 function( elem, name, isXML ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4582 var ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4583 return isXML ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4584 undefined :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4585 (ret = elem.getAttributeNode( name )) && ret.value !== "" ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4586 ret.value :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4587 null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4588 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4589 jQuery.valHooks.button = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4590 get: function( elem, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4591 var ret = elem.getAttributeNode( name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4592 return ret && ret.specified ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4593 ret.value :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4594 undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4595 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4596 set: nodeHook.set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4597 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4598
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4599 // Set contenteditable to false on removals(#10429)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4600 // Setting to empty string throws an error as an invalid value
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4601 jQuery.attrHooks.contenteditable = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4602 set: function( elem, value, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4603 nodeHook.set( elem, value === "" ? false : value, name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4604 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4605 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4606
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4607 // Set width and height to auto instead of 0 on empty string( Bug #8150 )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4608 // This is for removals
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4609 jQuery.each([ "width", "height" ], function( i, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4610 jQuery.attrHooks[ name ] = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4611 set: function( elem, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4612 if ( value === "" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4613 elem.setAttribute( name, "auto" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4614 return value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4615 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4616 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4617 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4618 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4619 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4620
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4621
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4622 // Some attributes require a special call on IE
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4623 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4624 if ( !jQuery.support.hrefNormalized ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4625 // href/src property should get the full normalized URL (#10299/#12915)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4626 jQuery.each([ "href", "src" ], function( i, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4627 jQuery.propHooks[ name ] = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4628 get: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4629 return elem.getAttribute( name, 4 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4630 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4631 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4632 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4633 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4634
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4635 if ( !jQuery.support.style ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4636 jQuery.attrHooks.style = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4637 get: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4638 // Return undefined in the case of empty string
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4639 // Note: IE uppercases css property names, but if we were to .toLowerCase()
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4640 // .cssText, that would destroy case senstitivity in URL's, like in "background"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4641 return elem.style.cssText || undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4642 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4643 set: function( elem, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4644 return ( elem.style.cssText = value + "" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4645 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4646 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4647 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4648
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4649 // Safari mis-reports the default selected property of an option
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4650 // Accessing the parent's selectedIndex property fixes it
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4651 if ( !jQuery.support.optSelected ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4652 jQuery.propHooks.selected = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4653 get: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4654 var parent = elem.parentNode;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4655
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4656 if ( parent ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4657 parent.selectedIndex;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4658
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4659 // Make sure that it also works with optgroups, see #5701
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4660 if ( parent.parentNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4661 parent.parentNode.selectedIndex;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4662 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4663 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4664 return null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4665 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4666 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4667 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4668
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4669 jQuery.each([
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4670 "tabIndex",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4671 "readOnly",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4672 "maxLength",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4673 "cellSpacing",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4674 "cellPadding",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4675 "rowSpan",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4676 "colSpan",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4677 "useMap",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4678 "frameBorder",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4679 "contentEditable"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4680 ], function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4681 jQuery.propFix[ this.toLowerCase() ] = this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4682 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4683
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4684 // IE6/7 call enctype encoding
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4685 if ( !jQuery.support.enctype ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4686 jQuery.propFix.enctype = "encoding";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4687 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4688
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4689 // Radios and checkboxes getter/setter
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4690 jQuery.each([ "radio", "checkbox" ], function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4691 jQuery.valHooks[ this ] = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4692 set: function( elem, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4693 if ( jQuery.isArray( value ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4694 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4695 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4696 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4697 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4698 if ( !jQuery.support.checkOn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4699 jQuery.valHooks[ this ].get = function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4700 // Support: Webkit
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4701 // "" is returned instead of "on" if a value isn't specified
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4702 return elem.getAttribute("value") === null ? "on" : elem.value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4703 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4704 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4705 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4706 var rformElems = /^(?:input|select|textarea)$/i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4707 rkeyEvent = /^key/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4708 rmouseEvent = /^(?:mouse|contextmenu)|click/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4709 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4710 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4711
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4712 function returnTrue() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4713 return true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4714 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4715
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4716 function returnFalse() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4717 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4718 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4719
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4720 function safeActiveElement() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4721 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4722 return document.activeElement;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4723 } catch ( err ) { }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4724 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4725
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4726 /*
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4727 * Helper functions for managing events -- not part of the public interface.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4728 * Props to Dean Edwards' addEvent library for many of the ideas.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4729 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4730 jQuery.event = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4731
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4732 global: {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4733
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4734 add: function( elem, types, handler, data, selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4735 var tmp, events, t, handleObjIn,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4736 special, eventHandle, handleObj,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4737 handlers, type, namespaces, origType,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4738 elemData = jQuery._data( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4739
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4740 // Don't attach events to noData or text/comment nodes (but allow plain objects)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4741 if ( !elemData ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4742 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4743 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4744
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4745 // Caller can pass in an object of custom data in lieu of the handler
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4746 if ( handler.handler ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4747 handleObjIn = handler;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4748 handler = handleObjIn.handler;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4749 selector = handleObjIn.selector;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4750 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4751
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4752 // Make sure that the handler has a unique ID, used to find/remove it later
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4753 if ( !handler.guid ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4754 handler.guid = jQuery.guid++;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4755 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4756
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4757 // Init the element's event structure and main handler, if this is the first
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4758 if ( !(events = elemData.events) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4759 events = elemData.events = {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4760 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4761 if ( !(eventHandle = elemData.handle) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4762 eventHandle = elemData.handle = function( e ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4763 // Discard the second event of a jQuery.event.trigger() and
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4764 // when an event is called after a page has unloaded
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4765 return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4766 jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4767 undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4768 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4769 // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4770 eventHandle.elem = elem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4771 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4772
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4773 // Handle multiple events separated by a space
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4774 types = ( types || "" ).match( core_rnotwhite ) || [""];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4775 t = types.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4776 while ( t-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4777 tmp = rtypenamespace.exec( types[t] ) || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4778 type = origType = tmp[1];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4779 namespaces = ( tmp[2] || "" ).split( "." ).sort();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4780
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4781 // There *must* be a type, no attaching namespace-only handlers
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4782 if ( !type ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4783 continue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4784 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4785
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4786 // If event changes its type, use the special event handlers for the changed type
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4787 special = jQuery.event.special[ type ] || {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4788
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4789 // If selector defined, determine special event api type, otherwise given type
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4790 type = ( selector ? special.delegateType : special.bindType ) || type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4791
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4792 // Update special based on newly reset type
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4793 special = jQuery.event.special[ type ] || {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4794
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4795 // handleObj is passed to all event handlers
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4796 handleObj = jQuery.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4797 type: type,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4798 origType: origType,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4799 data: data,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4800 handler: handler,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4801 guid: handler.guid,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4802 selector: selector,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4803 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4804 namespace: namespaces.join(".")
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4805 }, handleObjIn );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4806
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4807 // Init the event handler queue if we're the first
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4808 if ( !(handlers = events[ type ]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4809 handlers = events[ type ] = [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4810 handlers.delegateCount = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4811
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4812 // Only use addEventListener/attachEvent if the special events handler returns false
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4813 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4814 // Bind the global event handler to the element
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4815 if ( elem.addEventListener ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4816 elem.addEventListener( type, eventHandle, false );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4817
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4818 } else if ( elem.attachEvent ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4819 elem.attachEvent( "on" + type, eventHandle );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4820 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4821 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4822 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4823
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4824 if ( special.add ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4825 special.add.call( elem, handleObj );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4826
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4827 if ( !handleObj.handler.guid ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4828 handleObj.handler.guid = handler.guid;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4829 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4830 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4831
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4832 // Add to the element's handler list, delegates in front
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4833 if ( selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4834 handlers.splice( handlers.delegateCount++, 0, handleObj );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4835 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4836 handlers.push( handleObj );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4837 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4838
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4839 // Keep track of which events have ever been used, for event optimization
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4840 jQuery.event.global[ type ] = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4841 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4842
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4843 // Nullify elem to prevent memory leaks in IE
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4844 elem = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4845 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4846
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4847 // Detach an event or set of events from an element
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4848 remove: function( elem, types, handler, selector, mappedTypes ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4849 var j, handleObj, tmp,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4850 origCount, t, events,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4851 special, handlers, type,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4852 namespaces, origType,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4853 elemData = jQuery.hasData( elem ) && jQuery._data( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4854
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4855 if ( !elemData || !(events = elemData.events) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4856 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4857 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4858
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4859 // Once for each type.namespace in types; type may be omitted
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4860 types = ( types || "" ).match( core_rnotwhite ) || [""];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4861 t = types.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4862 while ( t-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4863 tmp = rtypenamespace.exec( types[t] ) || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4864 type = origType = tmp[1];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4865 namespaces = ( tmp[2] || "" ).split( "." ).sort();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4866
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4867 // Unbind all events (on this namespace, if provided) for the element
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4868 if ( !type ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4869 for ( type in events ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4870 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4871 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4872 continue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4873 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4874
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4875 special = jQuery.event.special[ type ] || {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4876 type = ( selector ? special.delegateType : special.bindType ) || type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4877 handlers = events[ type ] || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4878 tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4879
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4880 // Remove matching events
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4881 origCount = j = handlers.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4882 while ( j-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4883 handleObj = handlers[ j ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4884
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4885 if ( ( mappedTypes || origType === handleObj.origType ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4886 ( !handler || handler.guid === handleObj.guid ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4887 ( !tmp || tmp.test( handleObj.namespace ) ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4888 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4889 handlers.splice( j, 1 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4890
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4891 if ( handleObj.selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4892 handlers.delegateCount--;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4893 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4894 if ( special.remove ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4895 special.remove.call( elem, handleObj );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4896 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4897 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4898 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4899
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4900 // Remove generic event handler if we removed something and no more handlers exist
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4901 // (avoids potential for endless recursion during removal of special event handlers)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4902 if ( origCount && !handlers.length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4903 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4904 jQuery.removeEvent( elem, type, elemData.handle );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4905 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4906
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4907 delete events[ type ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4908 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4909 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4910
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4911 // Remove the expando if it's no longer used
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4912 if ( jQuery.isEmptyObject( events ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4913 delete elemData.handle;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4914
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4915 // removeData also checks for emptiness and clears the expando if empty
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4916 // so use it instead of delete
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4917 jQuery._removeData( elem, "events" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4918 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4919 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4920
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4921 trigger: function( event, data, elem, onlyHandlers ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4922 var handle, ontype, cur,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4923 bubbleType, special, tmp, i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4924 eventPath = [ elem || document ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4925 type = core_hasOwn.call( event, "type" ) ? event.type : event,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4926 namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4927
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4928 cur = tmp = elem = elem || document;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4929
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4930 // Don't do events on text and comment nodes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4931 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4932 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4933 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4934
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4935 // focus/blur morphs to focusin/out; ensure we're not firing them right now
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4936 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4937 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4938 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4939
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4940 if ( type.indexOf(".") >= 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4941 // Namespaced trigger; create a regexp to match event type in handle()
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4942 namespaces = type.split(".");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4943 type = namespaces.shift();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4944 namespaces.sort();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4945 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4946 ontype = type.indexOf(":") < 0 && "on" + type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4947
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4948 // Caller can pass in a jQuery.Event object, Object, or just an event type string
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4949 event = event[ jQuery.expando ] ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4950 event :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4951 new jQuery.Event( type, typeof event === "object" && event );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4952
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4953 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4954 event.isTrigger = onlyHandlers ? 2 : 3;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4955 event.namespace = namespaces.join(".");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4956 event.namespace_re = event.namespace ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4957 new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4958 null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4959
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4960 // Clean up the event in case it is being reused
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4961 event.result = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4962 if ( !event.target ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4963 event.target = elem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4964 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4965
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4966 // Clone any incoming data and prepend the event, creating the handler arg list
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4967 data = data == null ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4968 [ event ] :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4969 jQuery.makeArray( data, [ event ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4970
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4971 // Allow special events to draw outside the lines
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4972 special = jQuery.event.special[ type ] || {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4973 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4974 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4975 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4976
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4977 // Determine event propagation path in advance, per W3C events spec (#9951)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4978 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4979 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4980
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4981 bubbleType = special.delegateType || type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4982 if ( !rfocusMorph.test( bubbleType + type ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4983 cur = cur.parentNode;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4984 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4985 for ( ; cur; cur = cur.parentNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4986 eventPath.push( cur );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4987 tmp = cur;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4988 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4989
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4990 // Only add window if we got to document (e.g., not plain obj or detached DOM)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4991 if ( tmp === (elem.ownerDocument || document) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4992 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4993 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4994 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4995
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4996 // Fire handlers on the event path
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4997 i = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4998 while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
4999
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5000 event.type = i > 1 ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5001 bubbleType :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5002 special.bindType || type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5003
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5004 // jQuery handler
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5005 handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5006 if ( handle ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5007 handle.apply( cur, data );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5008 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5009
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5010 // Native handler
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5011 handle = ontype && cur[ ontype ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5012 if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5013 event.preventDefault();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5014 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5015 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5016 event.type = type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5017
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5018 // If nobody prevented the default action, do it now
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5019 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5020
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5021 if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5022 jQuery.acceptData( elem ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5023
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5024 // Call a native DOM method on the target with the same name name as the event.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5025 // Can't use an .isFunction() check here because IE6/7 fails that test.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5026 // Don't do default actions on window, that's where global variables be (#6170)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5027 if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5028
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5029 // Don't re-trigger an onFOO event when we call its FOO() method
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5030 tmp = elem[ ontype ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5031
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5032 if ( tmp ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5033 elem[ ontype ] = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5034 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5035
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5036 // Prevent re-triggering of the same event, since we already bubbled it above
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5037 jQuery.event.triggered = type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5038 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5039 elem[ type ]();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5040 } catch ( e ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5041 // IE<9 dies on focus/blur to hidden element (#1486,#12518)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5042 // only reproducible on winXP IE8 native, not IE9 in IE8 mode
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5043 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5044 jQuery.event.triggered = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5045
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5046 if ( tmp ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5047 elem[ ontype ] = tmp;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5048 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5049 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5050 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5051 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5052
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5053 return event.result;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5054 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5055
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5056 dispatch: function( event ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5057
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5058 // Make a writable jQuery.Event from the native event object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5059 event = jQuery.event.fix( event );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5060
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5061 var i, ret, handleObj, matched, j,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5062 handlerQueue = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5063 args = core_slice.call( arguments ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5064 handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5065 special = jQuery.event.special[ event.type ] || {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5066
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5067 // Use the fix-ed jQuery.Event rather than the (read-only) native event
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5068 args[0] = event;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5069 event.delegateTarget = this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5070
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5071 // Call the preDispatch hook for the mapped type, and let it bail if desired
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5072 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5073 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5074 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5075
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5076 // Determine handlers
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5077 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5078
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5079 // Run delegates first; they may want to stop propagation beneath us
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5080 i = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5081 while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5082 event.currentTarget = matched.elem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5083
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5084 j = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5085 while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5086
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5087 // Triggered event must either 1) have no namespace, or
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5088 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5089 if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5090
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5091 event.handleObj = handleObj;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5092 event.data = handleObj.data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5093
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5094 ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5095 .apply( matched.elem, args );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5096
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5097 if ( ret !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5098 if ( (event.result = ret) === false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5099 event.preventDefault();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5100 event.stopPropagation();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5101 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5102 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5103 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5104 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5105 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5106
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5107 // Call the postDispatch hook for the mapped type
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5108 if ( special.postDispatch ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5109 special.postDispatch.call( this, event );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5110 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5111
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5112 return event.result;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5113 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5114
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5115 handlers: function( event, handlers ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5116 var sel, handleObj, matches, i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5117 handlerQueue = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5118 delegateCount = handlers.delegateCount,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5119 cur = event.target;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5120
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5121 // Find delegate handlers
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5122 // Black-hole SVG <use> instance trees (#13180)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5123 // Avoid non-left-click bubbling in Firefox (#3861)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5124 if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5125
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5126 /* jshint eqeqeq: false */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5127 for ( ; cur != this; cur = cur.parentNode || this ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5128 /* jshint eqeqeq: true */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5129
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5130 // Don't check non-elements (#13208)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5131 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5132 if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5133 matches = [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5134 for ( i = 0; i < delegateCount; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5135 handleObj = handlers[ i ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5136
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5137 // Don't conflict with Object.prototype properties (#13203)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5138 sel = handleObj.selector + " ";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5139
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5140 if ( matches[ sel ] === undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5141 matches[ sel ] = handleObj.needsContext ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5142 jQuery( sel, this ).index( cur ) >= 0 :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5143 jQuery.find( sel, this, null, [ cur ] ).length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5144 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5145 if ( matches[ sel ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5146 matches.push( handleObj );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5147 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5148 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5149 if ( matches.length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5150 handlerQueue.push({ elem: cur, handlers: matches });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5151 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5152 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5153 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5154 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5155
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5156 // Add the remaining (directly-bound) handlers
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5157 if ( delegateCount < handlers.length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5158 handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5159 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5160
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5161 return handlerQueue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5162 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5163
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5164 fix: function( event ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5165 if ( event[ jQuery.expando ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5166 return event;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5167 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5168
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5169 // Create a writable copy of the event object and normalize some properties
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5170 var i, prop, copy,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5171 type = event.type,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5172 originalEvent = event,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5173 fixHook = this.fixHooks[ type ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5174
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5175 if ( !fixHook ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5176 this.fixHooks[ type ] = fixHook =
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5177 rmouseEvent.test( type ) ? this.mouseHooks :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5178 rkeyEvent.test( type ) ? this.keyHooks :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5179 {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5180 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5181 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5182
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5183 event = new jQuery.Event( originalEvent );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5184
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5185 i = copy.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5186 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5187 prop = copy[ i ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5188 event[ prop ] = originalEvent[ prop ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5189 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5190
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5191 // Support: IE<9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5192 // Fix target property (#1925)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5193 if ( !event.target ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5194 event.target = originalEvent.srcElement || document;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5195 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5196
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5197 // Support: Chrome 23+, Safari?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5198 // Target should not be a text node (#504, #13143)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5199 if ( event.target.nodeType === 3 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5200 event.target = event.target.parentNode;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5201 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5202
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5203 // Support: IE<9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5204 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5205 event.metaKey = !!event.metaKey;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5206
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5207 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5208 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5209
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5210 // Includes some event props shared by KeyEvent and MouseEvent
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5211 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5212
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5213 fixHooks: {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5214
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5215 keyHooks: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5216 props: "char charCode key keyCode".split(" "),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5217 filter: function( event, original ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5218
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5219 // Add which for key events
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5220 if ( event.which == null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5221 event.which = original.charCode != null ? original.charCode : original.keyCode;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5222 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5223
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5224 return event;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5225 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5226 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5227
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5228 mouseHooks: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5229 props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5230 filter: function( event, original ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5231 var body, eventDoc, doc,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5232 button = original.button,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5233 fromElement = original.fromElement;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5234
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5235 // Calculate pageX/Y if missing and clientX/Y available
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5236 if ( event.pageX == null && original.clientX != null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5237 eventDoc = event.target.ownerDocument || document;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5238 doc = eventDoc.documentElement;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5239 body = eventDoc.body;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5240
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5241 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5242 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5243 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5244
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5245 // Add relatedTarget, if necessary
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5246 if ( !event.relatedTarget && fromElement ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5247 event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5248 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5249
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5250 // Add which for click: 1 === left; 2 === middle; 3 === right
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5251 // Note: button is not normalized, so don't use it
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5252 if ( !event.which && button !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5253 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5254 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5255
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5256 return event;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5257 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5258 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5259
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5260 special: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5261 load: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5262 // Prevent triggered image.load events from bubbling to window.load
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5263 noBubble: true
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5264 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5265 focus: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5266 // Fire native event if possible so blur/focus sequence is correct
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5267 trigger: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5268 if ( this !== safeActiveElement() && this.focus ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5269 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5270 this.focus();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5271 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5272 } catch ( e ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5273 // Support: IE<9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5274 // If we error on focus to hidden element (#1486, #12518),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5275 // let .trigger() run the handlers
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5276 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5277 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5278 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5279 delegateType: "focusin"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5280 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5281 blur: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5282 trigger: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5283 if ( this === safeActiveElement() && this.blur ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5284 this.blur();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5285 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5286 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5287 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5288 delegateType: "focusout"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5289 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5290 click: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5291 // For checkbox, fire native event so checked state will be right
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5292 trigger: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5293 if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5294 this.click();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5295 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5296 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5297 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5298
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5299 // For cross-browser consistency, don't fire native .click() on links
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5300 _default: function( event ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5301 return jQuery.nodeName( event.target, "a" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5302 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5303 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5304
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5305 beforeunload: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5306 postDispatch: function( event ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5307
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5308 // Even when returnValue equals to undefined Firefox will still show alert
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5309 if ( event.result !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5310 event.originalEvent.returnValue = event.result;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5311 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5312 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5313 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5314 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5315
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5316 simulate: function( type, elem, event, bubble ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5317 // Piggyback on a donor event to simulate a different one.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5318 // Fake originalEvent to avoid donor's stopPropagation, but if the
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5319 // simulated event prevents default then we do the same on the donor.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5320 var e = jQuery.extend(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5321 new jQuery.Event(),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5322 event,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5323 {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5324 type: type,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5325 isSimulated: true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5326 originalEvent: {}
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5327 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5328 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5329 if ( bubble ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5330 jQuery.event.trigger( e, null, elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5331 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5332 jQuery.event.dispatch.call( elem, e );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5333 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5334 if ( e.isDefaultPrevented() ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5335 event.preventDefault();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5336 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5337 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5338 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5339
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5340 jQuery.removeEvent = document.removeEventListener ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5341 function( elem, type, handle ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5342 if ( elem.removeEventListener ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5343 elem.removeEventListener( type, handle, false );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5344 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5345 } :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5346 function( elem, type, handle ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5347 var name = "on" + type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5348
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5349 if ( elem.detachEvent ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5350
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5351 // #8545, #7054, preventing memory leaks for custom events in IE6-8
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5352 // detachEvent needed property on element, by name of that event, to properly expose it to GC
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5353 if ( typeof elem[ name ] === core_strundefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5354 elem[ name ] = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5355 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5356
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5357 elem.detachEvent( name, handle );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5358 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5359 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5360
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5361 jQuery.Event = function( src, props ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5362 // Allow instantiation without the 'new' keyword
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5363 if ( !(this instanceof jQuery.Event) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5364 return new jQuery.Event( src, props );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5365 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5366
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5367 // Event object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5368 if ( src && src.type ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5369 this.originalEvent = src;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5370 this.type = src.type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5371
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5372 // Events bubbling up the document may have been marked as prevented
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5373 // by a handler lower down the tree; reflect the correct value.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5374 this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5375 src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5376
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5377 // Event type
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5378 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5379 this.type = src;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5380 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5381
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5382 // Put explicitly provided properties onto the event object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5383 if ( props ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5384 jQuery.extend( this, props );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5385 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5386
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5387 // Create a timestamp if incoming event doesn't have one
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5388 this.timeStamp = src && src.timeStamp || jQuery.now();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5389
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5390 // Mark it as fixed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5391 this[ jQuery.expando ] = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5392 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5393
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5394 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5395 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5396 jQuery.Event.prototype = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5397 isDefaultPrevented: returnFalse,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5398 isPropagationStopped: returnFalse,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5399 isImmediatePropagationStopped: returnFalse,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5400
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5401 preventDefault: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5402 var e = this.originalEvent;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5403
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5404 this.isDefaultPrevented = returnTrue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5405 if ( !e ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5406 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5407 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5408
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5409 // If preventDefault exists, run it on the original event
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5410 if ( e.preventDefault ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5411 e.preventDefault();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5412
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5413 // Support: IE
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5414 // Otherwise set the returnValue property of the original event to false
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5415 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5416 e.returnValue = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5417 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5418 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5419 stopPropagation: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5420 var e = this.originalEvent;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5421
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5422 this.isPropagationStopped = returnTrue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5423 if ( !e ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5424 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5425 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5426 // If stopPropagation exists, run it on the original event
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5427 if ( e.stopPropagation ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5428 e.stopPropagation();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5429 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5430
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5431 // Support: IE
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5432 // Set the cancelBubble property of the original event to true
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5433 e.cancelBubble = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5434 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5435 stopImmediatePropagation: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5436 this.isImmediatePropagationStopped = returnTrue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5437 this.stopPropagation();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5438 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5439 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5440
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5441 // Create mouseenter/leave events using mouseover/out and event-time checks
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5442 jQuery.each({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5443 mouseenter: "mouseover",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5444 mouseleave: "mouseout"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5445 }, function( orig, fix ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5446 jQuery.event.special[ orig ] = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5447 delegateType: fix,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5448 bindType: fix,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5449
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5450 handle: function( event ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5451 var ret,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5452 target = this,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5453 related = event.relatedTarget,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5454 handleObj = event.handleObj;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5455
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5456 // For mousenter/leave call the handler if related is outside the target.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5457 // NB: No relatedTarget if the mouse left/entered the browser window
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5458 if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5459 event.type = handleObj.origType;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5460 ret = handleObj.handler.apply( this, arguments );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5461 event.type = fix;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5462 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5463 return ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5464 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5465 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5466 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5467
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5468 // IE submit delegation
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5469 if ( !jQuery.support.submitBubbles ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5470
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5471 jQuery.event.special.submit = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5472 setup: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5473 // Only need this for delegated form submit events
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5474 if ( jQuery.nodeName( this, "form" ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5475 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5476 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5477
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5478 // Lazy-add a submit handler when a descendant form may potentially be submitted
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5479 jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5480 // Node name check avoids a VML-related crash in IE (#9807)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5481 var elem = e.target,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5482 form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5483 if ( form && !jQuery._data( form, "submitBubbles" ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5484 jQuery.event.add( form, "submit._submit", function( event ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5485 event._submit_bubble = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5486 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5487 jQuery._data( form, "submitBubbles", true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5488 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5489 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5490 // return undefined since we don't need an event listener
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5491 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5492
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5493 postDispatch: function( event ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5494 // If form was submitted by the user, bubble the event up the tree
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5495 if ( event._submit_bubble ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5496 delete event._submit_bubble;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5497 if ( this.parentNode && !event.isTrigger ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5498 jQuery.event.simulate( "submit", this.parentNode, event, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5499 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5500 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5501 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5502
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5503 teardown: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5504 // Only need this for delegated form submit events
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5505 if ( jQuery.nodeName( this, "form" ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5506 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5507 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5508
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5509 // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5510 jQuery.event.remove( this, "._submit" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5511 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5512 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5513 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5514
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5515 // IE change delegation and checkbox/radio fix
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5516 if ( !jQuery.support.changeBubbles ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5517
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5518 jQuery.event.special.change = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5519
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5520 setup: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5521
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5522 if ( rformElems.test( this.nodeName ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5523 // IE doesn't fire change on a check/radio until blur; trigger it on click
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5524 // after a propertychange. Eat the blur-change in special.change.handle.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5525 // This still fires onchange a second time for check/radio after blur.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5526 if ( this.type === "checkbox" || this.type === "radio" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5527 jQuery.event.add( this, "propertychange._change", function( event ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5528 if ( event.originalEvent.propertyName === "checked" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5529 this._just_changed = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5530 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5531 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5532 jQuery.event.add( this, "click._change", function( event ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5533 if ( this._just_changed && !event.isTrigger ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5534 this._just_changed = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5535 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5536 // Allow triggered, simulated change events (#11500)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5537 jQuery.event.simulate( "change", this, event, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5538 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5539 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5540 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5541 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5542 // Delegated event; lazy-add a change handler on descendant inputs
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5543 jQuery.event.add( this, "beforeactivate._change", function( e ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5544 var elem = e.target;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5545
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5546 if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5547 jQuery.event.add( elem, "change._change", function( event ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5548 if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5549 jQuery.event.simulate( "change", this.parentNode, event, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5550 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5551 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5552 jQuery._data( elem, "changeBubbles", true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5553 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5554 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5555 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5556
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5557 handle: function( event ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5558 var elem = event.target;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5559
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5560 // Swallow native change events from checkbox/radio, we already triggered them above
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5561 if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5562 return event.handleObj.handler.apply( this, arguments );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5563 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5564 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5565
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5566 teardown: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5567 jQuery.event.remove( this, "._change" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5568
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5569 return !rformElems.test( this.nodeName );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5570 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5571 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5572 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5573
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5574 // Create "bubbling" focus and blur events
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5575 if ( !jQuery.support.focusinBubbles ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5576 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5577
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5578 // Attach a single capturing handler while someone wants focusin/focusout
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5579 var attaches = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5580 handler = function( event ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5581 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5582 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5583
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5584 jQuery.event.special[ fix ] = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5585 setup: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5586 if ( attaches++ === 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5587 document.addEventListener( orig, handler, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5588 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5589 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5590 teardown: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5591 if ( --attaches === 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5592 document.removeEventListener( orig, handler, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5593 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5594 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5595 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5596 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5597 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5598
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5599 jQuery.fn.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5600
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5601 on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5602 var type, origFn;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5603
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5604 // Types can be a map of types/handlers
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5605 if ( typeof types === "object" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5606 // ( types-Object, selector, data )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5607 if ( typeof selector !== "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5608 // ( types-Object, data )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5609 data = data || selector;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5610 selector = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5611 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5612 for ( type in types ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5613 this.on( type, selector, data, types[ type ], one );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5614 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5615 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5616 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5617
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5618 if ( data == null && fn == null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5619 // ( types, fn )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5620 fn = selector;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5621 data = selector = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5622 } else if ( fn == null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5623 if ( typeof selector === "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5624 // ( types, selector, fn )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5625 fn = data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5626 data = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5627 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5628 // ( types, data, fn )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5629 fn = data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5630 data = selector;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5631 selector = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5632 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5633 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5634 if ( fn === false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5635 fn = returnFalse;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5636 } else if ( !fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5637 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5638 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5639
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5640 if ( one === 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5641 origFn = fn;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5642 fn = function( event ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5643 // Can use an empty set, since event contains the info
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5644 jQuery().off( event );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5645 return origFn.apply( this, arguments );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5646 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5647 // Use same guid so caller can remove using origFn
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5648 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5649 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5650 return this.each( function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5651 jQuery.event.add( this, types, fn, data, selector );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5652 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5653 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5654 one: function( types, selector, data, fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5655 return this.on( types, selector, data, fn, 1 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5656 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5657 off: function( types, selector, fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5658 var handleObj, type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5659 if ( types && types.preventDefault && types.handleObj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5660 // ( event ) dispatched jQuery.Event
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5661 handleObj = types.handleObj;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5662 jQuery( types.delegateTarget ).off(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5663 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5664 handleObj.selector,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5665 handleObj.handler
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5666 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5667 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5668 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5669 if ( typeof types === "object" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5670 // ( types-object [, selector] )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5671 for ( type in types ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5672 this.off( type, selector, types[ type ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5673 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5674 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5675 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5676 if ( selector === false || typeof selector === "function" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5677 // ( types [, fn] )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5678 fn = selector;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5679 selector = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5680 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5681 if ( fn === false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5682 fn = returnFalse;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5683 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5684 return this.each(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5685 jQuery.event.remove( this, types, fn, selector );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5686 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5687 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5688
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5689 trigger: function( type, data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5690 return this.each(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5691 jQuery.event.trigger( type, data, this );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5692 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5693 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5694 triggerHandler: function( type, data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5695 var elem = this[0];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5696 if ( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5697 return jQuery.event.trigger( type, data, elem, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5698 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5699 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5700 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5701 var isSimple = /^.[^:#\[\.,]*$/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5702 rparentsprev = /^(?:parents|prev(?:Until|All))/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5703 rneedsContext = jQuery.expr.match.needsContext,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5704 // methods guaranteed to produce a unique set when starting from a unique set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5705 guaranteedUnique = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5706 children: true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5707 contents: true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5708 next: true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5709 prev: true
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5710 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5711
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5712 jQuery.fn.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5713 find: function( selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5714 var i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5715 ret = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5716 self = this,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5717 len = self.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5718
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5719 if ( typeof selector !== "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5720 return this.pushStack( jQuery( selector ).filter(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5721 for ( i = 0; i < len; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5722 if ( jQuery.contains( self[ i ], this ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5723 return true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5724 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5725 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5726 }) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5727 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5728
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5729 for ( i = 0; i < len; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5730 jQuery.find( selector, self[ i ], ret );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5731 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5732
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5733 // Needed because $( selector, context ) becomes $( context ).find( selector )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5734 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5735 ret.selector = this.selector ? this.selector + " " + selector : selector;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5736 return ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5737 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5738
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5739 has: function( target ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5740 var i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5741 targets = jQuery( target, this ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5742 len = targets.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5743
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5744 return this.filter(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5745 for ( i = 0; i < len; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5746 if ( jQuery.contains( this, targets[i] ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5747 return true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5748 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5749 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5750 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5751 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5752
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5753 not: function( selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5754 return this.pushStack( winnow(this, selector || [], true) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5755 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5756
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5757 filter: function( selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5758 return this.pushStack( winnow(this, selector || [], false) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5759 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5760
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5761 is: function( selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5762 return !!winnow(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5763 this,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5764
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5765 // If this is a positional/relative selector, check membership in the returned set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5766 // so $("p:first").is("p:last") won't return true for a doc with two "p".
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5767 typeof selector === "string" && rneedsContext.test( selector ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5768 jQuery( selector ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5769 selector || [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5770 false
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5771 ).length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5772 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5773
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5774 closest: function( selectors, context ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5775 var cur,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5776 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5777 l = this.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5778 ret = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5779 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5780 jQuery( selectors, context || this.context ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5781 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5782
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5783 for ( ; i < l; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5784 for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5785 // Always skip document fragments
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5786 if ( cur.nodeType < 11 && (pos ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5787 pos.index(cur) > -1 :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5788
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5789 // Don't pass non-elements to Sizzle
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5790 cur.nodeType === 1 &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5791 jQuery.find.matchesSelector(cur, selectors)) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5792
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5793 cur = ret.push( cur );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5794 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5795 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5796 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5797 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5798
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5799 return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5800 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5801
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5802 // Determine the position of an element within
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5803 // the matched set of elements
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5804 index: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5805
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5806 // No argument, return index in parent
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5807 if ( !elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5808 return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5809 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5810
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5811 // index in selector
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5812 if ( typeof elem === "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5813 return jQuery.inArray( this[0], jQuery( elem ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5814 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5815
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5816 // Locate the position of the desired element
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5817 return jQuery.inArray(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5818 // If it receives a jQuery object, the first element is used
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5819 elem.jquery ? elem[0] : elem, this );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5820 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5821
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5822 add: function( selector, context ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5823 var set = typeof selector === "string" ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5824 jQuery( selector, context ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5825 jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5826 all = jQuery.merge( this.get(), set );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5827
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5828 return this.pushStack( jQuery.unique(all) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5829 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5830
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5831 addBack: function( selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5832 return this.add( selector == null ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5833 this.prevObject : this.prevObject.filter(selector)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5834 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5835 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5836 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5837
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5838 function sibling( cur, dir ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5839 do {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5840 cur = cur[ dir ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5841 } while ( cur && cur.nodeType !== 1 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5842
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5843 return cur;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5844 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5845
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5846 jQuery.each({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5847 parent: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5848 var parent = elem.parentNode;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5849 return parent && parent.nodeType !== 11 ? parent : null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5850 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5851 parents: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5852 return jQuery.dir( elem, "parentNode" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5853 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5854 parentsUntil: function( elem, i, until ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5855 return jQuery.dir( elem, "parentNode", until );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5856 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5857 next: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5858 return sibling( elem, "nextSibling" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5859 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5860 prev: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5861 return sibling( elem, "previousSibling" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5862 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5863 nextAll: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5864 return jQuery.dir( elem, "nextSibling" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5865 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5866 prevAll: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5867 return jQuery.dir( elem, "previousSibling" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5868 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5869 nextUntil: function( elem, i, until ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5870 return jQuery.dir( elem, "nextSibling", until );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5871 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5872 prevUntil: function( elem, i, until ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5873 return jQuery.dir( elem, "previousSibling", until );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5874 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5875 siblings: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5876 return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5877 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5878 children: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5879 return jQuery.sibling( elem.firstChild );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5880 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5881 contents: function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5882 return jQuery.nodeName( elem, "iframe" ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5883 elem.contentDocument || elem.contentWindow.document :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5884 jQuery.merge( [], elem.childNodes );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5885 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5886 }, function( name, fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5887 jQuery.fn[ name ] = function( until, selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5888 var ret = jQuery.map( this, fn, until );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5889
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5890 if ( name.slice( -5 ) !== "Until" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5891 selector = until;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5892 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5893
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5894 if ( selector && typeof selector === "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5895 ret = jQuery.filter( selector, ret );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5896 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5897
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5898 if ( this.length > 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5899 // Remove duplicates
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5900 if ( !guaranteedUnique[ name ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5901 ret = jQuery.unique( ret );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5902 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5903
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5904 // Reverse order for parents* and prev-derivatives
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5905 if ( rparentsprev.test( name ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5906 ret = ret.reverse();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5907 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5908 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5909
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5910 return this.pushStack( ret );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5911 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5912 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5913
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5914 jQuery.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5915 filter: function( expr, elems, not ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5916 var elem = elems[ 0 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5917
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5918 if ( not ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5919 expr = ":not(" + expr + ")";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5920 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5921
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5922 return elems.length === 1 && elem.nodeType === 1 ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5923 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5924 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5925 return elem.nodeType === 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5926 }));
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5927 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5928
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5929 dir: function( elem, dir, until ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5930 var matched = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5931 cur = elem[ dir ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5932
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5933 while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5934 if ( cur.nodeType === 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5935 matched.push( cur );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5936 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5937 cur = cur[dir];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5938 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5939 return matched;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5940 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5941
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5942 sibling: function( n, elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5943 var r = [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5944
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5945 for ( ; n; n = n.nextSibling ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5946 if ( n.nodeType === 1 && n !== elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5947 r.push( n );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5948 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5949 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5950
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5951 return r;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5952 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5953 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5954
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5955 // Implement the identical functionality for filter and not
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5956 function winnow( elements, qualifier, not ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5957 if ( jQuery.isFunction( qualifier ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5958 return jQuery.grep( elements, function( elem, i ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5959 /* jshint -W018 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5960 return !!qualifier.call( elem, i, elem ) !== not;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5961 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5962
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5963 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5964
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5965 if ( qualifier.nodeType ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5966 return jQuery.grep( elements, function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5967 return ( elem === qualifier ) !== not;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5968 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5969
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5970 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5971
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5972 if ( typeof qualifier === "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5973 if ( isSimple.test( qualifier ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5974 return jQuery.filter( qualifier, elements, not );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5975 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5976
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5977 qualifier = jQuery.filter( qualifier, elements );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5978 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5979
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5980 return jQuery.grep( elements, function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5981 return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5982 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5983 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5984 function createSafeFragment( document ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5985 var list = nodeNames.split( "|" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5986 safeFrag = document.createDocumentFragment();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5987
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5988 if ( safeFrag.createElement ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5989 while ( list.length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5990 safeFrag.createElement(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5991 list.pop()
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5992 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5993 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5994 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5995 return safeFrag;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5996 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5997
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5998 var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
5999 "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6000 rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6001 rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6002 rleadingWhitespace = /^\s+/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6003 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6004 rtagName = /<([\w:]+)/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6005 rtbody = /<tbody/i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6006 rhtml = /<|&#?\w+;/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6007 rnoInnerhtml = /<(?:script|style|link)/i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6008 manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6009 // checked="checked" or checked
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6010 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6011 rscriptType = /^$|\/(?:java|ecma)script/i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6012 rscriptTypeMasked = /^true\/(.*)/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6013 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6014
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6015 // We have to close these tags to support XHTML (#13200)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6016 wrapMap = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6017 option: [ 1, "<select multiple='multiple'>", "</select>" ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6018 legend: [ 1, "<fieldset>", "</fieldset>" ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6019 area: [ 1, "<map>", "</map>" ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6020 param: [ 1, "<object>", "</object>" ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6021 thead: [ 1, "<table>", "</table>" ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6022 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6023 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6024 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6025
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6026 // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6027 // unless wrapped in a div with non-breaking characters in front of it.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6028 _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6029 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6030 safeFragment = createSafeFragment( document ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6031 fragmentDiv = safeFragment.appendChild( document.createElement("div") );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6032
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6033 wrapMap.optgroup = wrapMap.option;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6034 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6035 wrapMap.th = wrapMap.td;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6036
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6037 jQuery.fn.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6038 text: function( value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6039 return jQuery.access( this, function( value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6040 return value === undefined ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6041 jQuery.text( this ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6042 this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6043 }, null, value, arguments.length );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6044 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6045
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6046 append: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6047 return this.domManip( arguments, function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6048 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6049 var target = manipulationTarget( this, elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6050 target.appendChild( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6051 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6052 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6053 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6054
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6055 prepend: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6056 return this.domManip( arguments, function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6057 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6058 var target = manipulationTarget( this, elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6059 target.insertBefore( elem, target.firstChild );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6060 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6061 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6062 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6063
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6064 before: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6065 return this.domManip( arguments, function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6066 if ( this.parentNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6067 this.parentNode.insertBefore( elem, this );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6068 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6069 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6070 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6071
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6072 after: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6073 return this.domManip( arguments, function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6074 if ( this.parentNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6075 this.parentNode.insertBefore( elem, this.nextSibling );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6076 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6077 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6078 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6079
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6080 // keepData is for internal use only--do not document
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6081 remove: function( selector, keepData ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6082 var elem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6083 elems = selector ? jQuery.filter( selector, this ) : this,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6084 i = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6085
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6086 for ( ; (elem = elems[i]) != null; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6087
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6088 if ( !keepData && elem.nodeType === 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6089 jQuery.cleanData( getAll( elem ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6090 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6091
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6092 if ( elem.parentNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6093 if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6094 setGlobalEval( getAll( elem, "script" ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6095 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6096 elem.parentNode.removeChild( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6097 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6098 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6099
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6100 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6101 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6102
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6103 empty: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6104 var elem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6105 i = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6106
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6107 for ( ; (elem = this[i]) != null; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6108 // Remove element nodes and prevent memory leaks
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6109 if ( elem.nodeType === 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6110 jQuery.cleanData( getAll( elem, false ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6111 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6112
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6113 // Remove any remaining nodes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6114 while ( elem.firstChild ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6115 elem.removeChild( elem.firstChild );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6116 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6117
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6118 // If this is a select, ensure that it displays empty (#12336)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6119 // Support: IE<9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6120 if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6121 elem.options.length = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6122 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6123 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6124
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6125 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6126 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6127
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6128 clone: function( dataAndEvents, deepDataAndEvents ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6129 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6130 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6131
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6132 return this.map( function () {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6133 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6134 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6135 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6136
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6137 html: function( value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6138 return jQuery.access( this, function( value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6139 var elem = this[0] || {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6140 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6141 l = this.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6142
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6143 if ( value === undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6144 return elem.nodeType === 1 ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6145 elem.innerHTML.replace( rinlinejQuery, "" ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6146 undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6147 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6148
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6149 // See if we can take a shortcut and just use innerHTML
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6150 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6151 ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6152 ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6153 !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6154
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6155 value = value.replace( rxhtmlTag, "<$1></$2>" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6156
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6157 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6158 for (; i < l; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6159 // Remove element nodes and prevent memory leaks
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6160 elem = this[i] || {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6161 if ( elem.nodeType === 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6162 jQuery.cleanData( getAll( elem, false ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6163 elem.innerHTML = value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6164 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6165 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6166
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6167 elem = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6168
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6169 // If using innerHTML throws an exception, use the fallback method
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6170 } catch(e) {}
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6171 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6172
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6173 if ( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6174 this.empty().append( value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6175 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6176 }, null, value, arguments.length );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6177 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6178
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6179 replaceWith: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6180 var
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6181 // Snapshot the DOM in case .domManip sweeps something relevant into its fragment
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6182 args = jQuery.map( this, function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6183 return [ elem.nextSibling, elem.parentNode ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6184 }),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6185 i = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6186
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6187 // Make the changes, replacing each context element with the new content
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6188 this.domManip( arguments, function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6189 var next = args[ i++ ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6190 parent = args[ i++ ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6191
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6192 if ( parent ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6193 // Don't use the snapshot next if it has moved (#13810)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6194 if ( next && next.parentNode !== parent ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6195 next = this.nextSibling;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6196 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6197 jQuery( this ).remove();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6198 parent.insertBefore( elem, next );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6199 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6200 // Allow new content to include elements from the context set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6201 }, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6202
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6203 // Force removal if there was no new content (e.g., from empty arguments)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6204 return i ? this : this.remove();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6205 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6206
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6207 detach: function( selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6208 return this.remove( selector, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6209 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6210
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6211 domManip: function( args, callback, allowIntersection ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6212
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6213 // Flatten any nested arrays
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6214 args = core_concat.apply( [], args );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6215
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6216 var first, node, hasScripts,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6217 scripts, doc, fragment,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6218 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6219 l = this.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6220 set = this,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6221 iNoClone = l - 1,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6222 value = args[0],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6223 isFunction = jQuery.isFunction( value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6224
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6225 // We can't cloneNode fragments that contain checked, in WebKit
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6226 if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6227 return this.each(function( index ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6228 var self = set.eq( index );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6229 if ( isFunction ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6230 args[0] = value.call( this, index, self.html() );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6231 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6232 self.domManip( args, callback, allowIntersection );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6233 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6234 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6235
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6236 if ( l ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6237 fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6238 first = fragment.firstChild;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6239
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6240 if ( fragment.childNodes.length === 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6241 fragment = first;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6242 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6243
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6244 if ( first ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6245 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6246 hasScripts = scripts.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6247
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6248 // Use the original fragment for the last item instead of the first because it can end up
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6249 // being emptied incorrectly in certain situations (#8070).
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6250 for ( ; i < l; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6251 node = fragment;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6252
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6253 if ( i !== iNoClone ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6254 node = jQuery.clone( node, true, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6255
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6256 // Keep references to cloned scripts for later restoration
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6257 if ( hasScripts ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6258 jQuery.merge( scripts, getAll( node, "script" ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6259 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6260 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6261
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6262 callback.call( this[i], node, i );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6263 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6264
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6265 if ( hasScripts ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6266 doc = scripts[ scripts.length - 1 ].ownerDocument;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6267
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6268 // Reenable scripts
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6269 jQuery.map( scripts, restoreScript );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6270
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6271 // Evaluate executable scripts on first document insertion
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6272 for ( i = 0; i < hasScripts; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6273 node = scripts[ i ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6274 if ( rscriptType.test( node.type || "" ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6275 !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6276
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6277 if ( node.src ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6278 // Hope ajax is available...
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6279 jQuery._evalUrl( node.src );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6280 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6281 jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6282 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6283 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6284 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6285 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6286
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6287 // Fix #11809: Avoid leaking memory
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6288 fragment = first = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6289 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6290 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6291
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6292 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6293 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6294 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6295
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6296 // Support: IE<8
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6297 // Manipulating tables requires a tbody
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6298 function manipulationTarget( elem, content ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6299 return jQuery.nodeName( elem, "table" ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6300 jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6301
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6302 elem.getElementsByTagName("tbody")[0] ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6303 elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6304 elem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6305 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6306
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6307 // Replace/restore the type attribute of script elements for safe DOM manipulation
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6308 function disableScript( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6309 elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6310 return elem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6311 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6312 function restoreScript( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6313 var match = rscriptTypeMasked.exec( elem.type );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6314 if ( match ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6315 elem.type = match[1];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6316 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6317 elem.removeAttribute("type");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6318 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6319 return elem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6320 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6321
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6322 // Mark scripts as having already been evaluated
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6323 function setGlobalEval( elems, refElements ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6324 var elem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6325 i = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6326 for ( ; (elem = elems[i]) != null; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6327 jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6328 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6329 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6330
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6331 function cloneCopyEvent( src, dest ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6332
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6333 if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6334 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6335 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6336
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6337 var type, i, l,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6338 oldData = jQuery._data( src ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6339 curData = jQuery._data( dest, oldData ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6340 events = oldData.events;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6341
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6342 if ( events ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6343 delete curData.handle;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6344 curData.events = {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6345
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6346 for ( type in events ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6347 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6348 jQuery.event.add( dest, type, events[ type ][ i ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6349 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6350 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6351 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6352
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6353 // make the cloned public data object a copy from the original
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6354 if ( curData.data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6355 curData.data = jQuery.extend( {}, curData.data );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6356 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6357 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6358
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6359 function fixCloneNodeIssues( src, dest ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6360 var nodeName, e, data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6361
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6362 // We do not need to do anything for non-Elements
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6363 if ( dest.nodeType !== 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6364 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6365 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6366
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6367 nodeName = dest.nodeName.toLowerCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6368
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6369 // IE6-8 copies events bound via attachEvent when using cloneNode.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6370 if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6371 data = jQuery._data( dest );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6372
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6373 for ( e in data.events ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6374 jQuery.removeEvent( dest, e, data.handle );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6375 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6376
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6377 // Event data gets referenced instead of copied if the expando gets copied too
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6378 dest.removeAttribute( jQuery.expando );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6379 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6380
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6381 // IE blanks contents when cloning scripts, and tries to evaluate newly-set text
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6382 if ( nodeName === "script" && dest.text !== src.text ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6383 disableScript( dest ).text = src.text;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6384 restoreScript( dest );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6385
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6386 // IE6-10 improperly clones children of object elements using classid.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6387 // IE10 throws NoModificationAllowedError if parent is null, #12132.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6388 } else if ( nodeName === "object" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6389 if ( dest.parentNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6390 dest.outerHTML = src.outerHTML;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6391 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6392
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6393 // This path appears unavoidable for IE9. When cloning an object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6394 // element in IE9, the outerHTML strategy above is not sufficient.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6395 // If the src has innerHTML and the destination does not,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6396 // copy the src.innerHTML into the dest.innerHTML. #10324
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6397 if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6398 dest.innerHTML = src.innerHTML;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6399 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6400
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6401 } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6402 // IE6-8 fails to persist the checked state of a cloned checkbox
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6403 // or radio button. Worse, IE6-7 fail to give the cloned element
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6404 // a checked appearance if the defaultChecked value isn't also set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6405
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6406 dest.defaultChecked = dest.checked = src.checked;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6407
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6408 // IE6-7 get confused and end up setting the value of a cloned
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6409 // checkbox/radio button to an empty string instead of "on"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6410 if ( dest.value !== src.value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6411 dest.value = src.value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6412 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6413
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6414 // IE6-8 fails to return the selected option to the default selected
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6415 // state when cloning options
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6416 } else if ( nodeName === "option" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6417 dest.defaultSelected = dest.selected = src.defaultSelected;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6418
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6419 // IE6-8 fails to set the defaultValue to the correct value when
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6420 // cloning other types of input fields
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6421 } else if ( nodeName === "input" || nodeName === "textarea" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6422 dest.defaultValue = src.defaultValue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6423 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6424 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6425
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6426 jQuery.each({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6427 appendTo: "append",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6428 prependTo: "prepend",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6429 insertBefore: "before",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6430 insertAfter: "after",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6431 replaceAll: "replaceWith"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6432 }, function( name, original ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6433 jQuery.fn[ name ] = function( selector ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6434 var elems,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6435 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6436 ret = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6437 insert = jQuery( selector ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6438 last = insert.length - 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6439
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6440 for ( ; i <= last; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6441 elems = i === last ? this : this.clone(true);
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6442 jQuery( insert[i] )[ original ]( elems );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6443
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6444 // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6445 core_push.apply( ret, elems.get() );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6446 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6447
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6448 return this.pushStack( ret );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6449 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6450 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6451
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6452 function getAll( context, tag ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6453 var elems, elem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6454 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6455 found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6456 typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6457 undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6458
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6459 if ( !found ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6460 for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6461 if ( !tag || jQuery.nodeName( elem, tag ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6462 found.push( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6463 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6464 jQuery.merge( found, getAll( elem, tag ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6465 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6466 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6467 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6468
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6469 return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6470 jQuery.merge( [ context ], found ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6471 found;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6472 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6473
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6474 // Used in buildFragment, fixes the defaultChecked property
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6475 function fixDefaultChecked( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6476 if ( manipulation_rcheckableType.test( elem.type ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6477 elem.defaultChecked = elem.checked;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6478 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6479 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6480
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6481 jQuery.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6482 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6483 var destElements, node, clone, i, srcElements,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6484 inPage = jQuery.contains( elem.ownerDocument, elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6485
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6486 if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6487 clone = elem.cloneNode( true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6488
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6489 // IE<=8 does not properly clone detached, unknown element nodes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6490 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6491 fragmentDiv.innerHTML = elem.outerHTML;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6492 fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6493 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6494
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6495 if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6496 (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6497
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6498 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6499 destElements = getAll( clone );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6500 srcElements = getAll( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6501
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6502 // Fix all IE cloning issues
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6503 for ( i = 0; (node = srcElements[i]) != null; ++i ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6504 // Ensure that the destination node is not null; Fixes #9587
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6505 if ( destElements[i] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6506 fixCloneNodeIssues( node, destElements[i] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6507 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6508 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6509 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6510
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6511 // Copy the events from the original to the clone
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6512 if ( dataAndEvents ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6513 if ( deepDataAndEvents ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6514 srcElements = srcElements || getAll( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6515 destElements = destElements || getAll( clone );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6516
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6517 for ( i = 0; (node = srcElements[i]) != null; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6518 cloneCopyEvent( node, destElements[i] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6519 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6520 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6521 cloneCopyEvent( elem, clone );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6522 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6523 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6524
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6525 // Preserve script evaluation history
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6526 destElements = getAll( clone, "script" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6527 if ( destElements.length > 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6528 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6529 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6530
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6531 destElements = srcElements = node = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6532
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6533 // Return the cloned set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6534 return clone;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6535 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6536
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6537 buildFragment: function( elems, context, scripts, selection ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6538 var j, elem, contains,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6539 tmp, tag, tbody, wrap,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6540 l = elems.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6541
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6542 // Ensure a safe fragment
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6543 safe = createSafeFragment( context ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6544
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6545 nodes = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6546 i = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6547
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6548 for ( ; i < l; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6549 elem = elems[ i ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6550
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6551 if ( elem || elem === 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6552
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6553 // Add nodes directly
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6554 if ( jQuery.type( elem ) === "object" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6555 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6556
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6557 // Convert non-html into a text node
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6558 } else if ( !rhtml.test( elem ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6559 nodes.push( context.createTextNode( elem ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6560
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6561 // Convert html into DOM nodes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6562 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6563 tmp = tmp || safe.appendChild( context.createElement("div") );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6564
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6565 // Deserialize a standard representation
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6566 tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6567 wrap = wrapMap[ tag ] || wrapMap._default;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6568
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6569 tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6570
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6571 // Descend through wrappers to the right content
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6572 j = wrap[0];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6573 while ( j-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6574 tmp = tmp.lastChild;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6575 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6576
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6577 // Manually add leading whitespace removed by IE
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6578 if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6579 nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6580 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6581
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6582 // Remove IE's autoinserted <tbody> from table fragments
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6583 if ( !jQuery.support.tbody ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6584
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6585 // String was a <table>, *may* have spurious <tbody>
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6586 elem = tag === "table" && !rtbody.test( elem ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6587 tmp.firstChild :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6588
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6589 // String was a bare <thead> or <tfoot>
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6590 wrap[1] === "<table>" && !rtbody.test( elem ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6591 tmp :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6592 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6593
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6594 j = elem && elem.childNodes.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6595 while ( j-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6596 if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6597 elem.removeChild( tbody );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6598 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6599 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6600 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6601
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6602 jQuery.merge( nodes, tmp.childNodes );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6603
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6604 // Fix #12392 for WebKit and IE > 9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6605 tmp.textContent = "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6606
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6607 // Fix #12392 for oldIE
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6608 while ( tmp.firstChild ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6609 tmp.removeChild( tmp.firstChild );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6610 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6611
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6612 // Remember the top-level container for proper cleanup
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6613 tmp = safe.lastChild;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6614 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6615 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6616 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6617
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6618 // Fix #11356: Clear elements from fragment
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6619 if ( tmp ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6620 safe.removeChild( tmp );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6621 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6622
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6623 // Reset defaultChecked for any radios and checkboxes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6624 // about to be appended to the DOM in IE 6/7 (#8060)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6625 if ( !jQuery.support.appendChecked ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6626 jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6627 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6628
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6629 i = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6630 while ( (elem = nodes[ i++ ]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6631
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6632 // #4087 - If origin and destination elements are the same, and this is
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6633 // that element, do not do anything
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6634 if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6635 continue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6636 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6637
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6638 contains = jQuery.contains( elem.ownerDocument, elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6639
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6640 // Append to fragment
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6641 tmp = getAll( safe.appendChild( elem ), "script" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6642
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6643 // Preserve script evaluation history
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6644 if ( contains ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6645 setGlobalEval( tmp );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6646 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6647
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6648 // Capture executables
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6649 if ( scripts ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6650 j = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6651 while ( (elem = tmp[ j++ ]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6652 if ( rscriptType.test( elem.type || "" ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6653 scripts.push( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6654 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6655 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6656 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6657 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6658
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6659 tmp = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6660
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6661 return safe;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6662 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6663
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6664 cleanData: function( elems, /* internal */ acceptData ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6665 var elem, type, id, data,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6666 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6667 internalKey = jQuery.expando,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6668 cache = jQuery.cache,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6669 deleteExpando = jQuery.support.deleteExpando,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6670 special = jQuery.event.special;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6671
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6672 for ( ; (elem = elems[i]) != null; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6673
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6674 if ( acceptData || jQuery.acceptData( elem ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6675
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6676 id = elem[ internalKey ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6677 data = id && cache[ id ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6678
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6679 if ( data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6680 if ( data.events ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6681 for ( type in data.events ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6682 if ( special[ type ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6683 jQuery.event.remove( elem, type );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6684
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6685 // This is a shortcut to avoid jQuery.event.remove's overhead
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6686 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6687 jQuery.removeEvent( elem, type, data.handle );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6688 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6689 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6690 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6691
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6692 // Remove cache only if it was not already removed by jQuery.event.remove
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6693 if ( cache[ id ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6694
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6695 delete cache[ id ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6696
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6697 // IE does not allow us to delete expando properties from nodes,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6698 // nor does it have a removeAttribute function on Document nodes;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6699 // we must handle all of these cases
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6700 if ( deleteExpando ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6701 delete elem[ internalKey ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6702
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6703 } else if ( typeof elem.removeAttribute !== core_strundefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6704 elem.removeAttribute( internalKey );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6705
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6706 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6707 elem[ internalKey ] = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6708 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6709
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6710 core_deletedIds.push( id );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6711 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6712 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6713 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6714 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6715 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6716
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6717 _evalUrl: function( url ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6718 return jQuery.ajax({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6719 url: url,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6720 type: "GET",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6721 dataType: "script",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6722 async: false,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6723 global: false,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6724 "throws": true
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6725 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6726 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6727 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6728 jQuery.fn.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6729 wrapAll: function( html ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6730 if ( jQuery.isFunction( html ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6731 return this.each(function(i) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6732 jQuery(this).wrapAll( html.call(this, i) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6733 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6734 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6735
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6736 if ( this[0] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6737 // The elements to wrap the target around
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6738 var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6739
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6740 if ( this[0].parentNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6741 wrap.insertBefore( this[0] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6742 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6743
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6744 wrap.map(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6745 var elem = this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6746
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6747 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6748 elem = elem.firstChild;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6749 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6750
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6751 return elem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6752 }).append( this );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6753 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6754
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6755 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6756 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6757
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6758 wrapInner: function( html ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6759 if ( jQuery.isFunction( html ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6760 return this.each(function(i) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6761 jQuery(this).wrapInner( html.call(this, i) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6762 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6763 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6764
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6765 return this.each(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6766 var self = jQuery( this ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6767 contents = self.contents();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6768
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6769 if ( contents.length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6770 contents.wrapAll( html );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6771
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6772 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6773 self.append( html );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6774 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6775 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6776 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6777
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6778 wrap: function( html ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6779 var isFunction = jQuery.isFunction( html );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6780
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6781 return this.each(function(i) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6782 jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6783 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6784 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6785
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6786 unwrap: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6787 return this.parent().each(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6788 if ( !jQuery.nodeName( this, "body" ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6789 jQuery( this ).replaceWith( this.childNodes );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6790 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6791 }).end();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6792 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6793 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6794 var iframe, getStyles, curCSS,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6795 ralpha = /alpha\([^)]*\)/i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6796 ropacity = /opacity\s*=\s*([^)]*)/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6797 rposition = /^(top|right|bottom|left)$/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6798 // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6799 // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6800 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6801 rmargin = /^margin/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6802 rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6803 rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6804 rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6805 elemdisplay = { BODY: "block" },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6806
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6807 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6808 cssNormalTransform = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6809 letterSpacing: 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6810 fontWeight: 400
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6811 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6812
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6813 cssExpand = [ "Top", "Right", "Bottom", "Left" ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6814 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6815
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6816 // return a css property mapped to a potentially vendor prefixed property
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6817 function vendorPropName( style, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6818
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6819 // shortcut for names that are not vendor prefixed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6820 if ( name in style ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6821 return name;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6822 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6823
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6824 // check for vendor prefixed names
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6825 var capName = name.charAt(0).toUpperCase() + name.slice(1),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6826 origName = name,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6827 i = cssPrefixes.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6828
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6829 while ( i-- ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6830 name = cssPrefixes[ i ] + capName;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6831 if ( name in style ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6832 return name;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6833 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6834 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6835
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6836 return origName;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6837 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6838
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6839 function isHidden( elem, el ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6840 // isHidden might be called from jQuery#filter function;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6841 // in that case, element will be second argument
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6842 elem = el || elem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6843 return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6844 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6845
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6846 function showHide( elements, show ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6847 var display, elem, hidden,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6848 values = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6849 index = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6850 length = elements.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6851
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6852 for ( ; index < length; index++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6853 elem = elements[ index ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6854 if ( !elem.style ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6855 continue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6856 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6857
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6858 values[ index ] = jQuery._data( elem, "olddisplay" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6859 display = elem.style.display;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6860 if ( show ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6861 // Reset the inline display of this element to learn if it is
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6862 // being hidden by cascaded rules or not
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6863 if ( !values[ index ] && display === "none" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6864 elem.style.display = "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6865 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6866
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6867 // Set elements which have been overridden with display: none
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6868 // in a stylesheet to whatever the default browser style is
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6869 // for such an element
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6870 if ( elem.style.display === "" && isHidden( elem ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6871 values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6872 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6873 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6874
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6875 if ( !values[ index ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6876 hidden = isHidden( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6877
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6878 if ( display && display !== "none" || !hidden ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6879 jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6880 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6881 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6882 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6883 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6884
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6885 // Set the display of most of the elements in a second loop
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6886 // to avoid the constant reflow
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6887 for ( index = 0; index < length; index++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6888 elem = elements[ index ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6889 if ( !elem.style ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6890 continue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6891 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6892 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6893 elem.style.display = show ? values[ index ] || "" : "none";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6894 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6895 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6896
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6897 return elements;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6898 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6899
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6900 jQuery.fn.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6901 css: function( name, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6902 return jQuery.access( this, function( elem, name, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6903 var len, styles,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6904 map = {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6905 i = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6906
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6907 if ( jQuery.isArray( name ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6908 styles = getStyles( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6909 len = name.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6910
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6911 for ( ; i < len; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6912 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6913 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6914
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6915 return map;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6916 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6917
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6918 return value !== undefined ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6919 jQuery.style( elem, name, value ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6920 jQuery.css( elem, name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6921 }, name, value, arguments.length > 1 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6922 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6923 show: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6924 return showHide( this, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6925 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6926 hide: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6927 return showHide( this );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6928 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6929 toggle: function( state ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6930 if ( typeof state === "boolean" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6931 return state ? this.show() : this.hide();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6932 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6933
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6934 return this.each(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6935 if ( isHidden( this ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6936 jQuery( this ).show();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6937 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6938 jQuery( this ).hide();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6939 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6940 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6941 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6942 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6943
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6944 jQuery.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6945 // Add in style property hooks for overriding the default
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6946 // behavior of getting and setting a style property
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6947 cssHooks: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6948 opacity: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6949 get: function( elem, computed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6950 if ( computed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6951 // We should always get a number back from opacity
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6952 var ret = curCSS( elem, "opacity" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6953 return ret === "" ? "1" : ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6954 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6955 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6956 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6957 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6958
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6959 // Don't automatically add "px" to these possibly-unitless properties
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6960 cssNumber: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6961 "columnCount": true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6962 "fillOpacity": true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6963 "fontWeight": true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6964 "lineHeight": true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6965 "opacity": true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6966 "order": true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6967 "orphans": true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6968 "widows": true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6969 "zIndex": true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6970 "zoom": true
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6971 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6972
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6973 // Add in properties whose names you wish to fix before
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6974 // setting or getting the value
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6975 cssProps: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6976 // normalize float css property
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6977 "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6978 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6979
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6980 // Get and set the style property on a DOM Node
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6981 style: function( elem, name, value, extra ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6982 // Don't set styles on text and comment nodes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6983 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6984 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6985 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6986
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6987 // Make sure that we're working with the right name
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6988 var ret, type, hooks,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6989 origName = jQuery.camelCase( name ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6990 style = elem.style;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6991
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6992 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6993
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6994 // gets hook for the prefixed version
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6995 // followed by the unprefixed version
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6996 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6997
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6998 // Check if we're setting a value
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
6999 if ( value !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7000 type = typeof value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7001
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7002 // convert relative number strings (+= or -=) to relative numbers. #7345
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7003 if ( type === "string" && (ret = rrelNum.exec( value )) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7004 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7005 // Fixes bug #9237
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7006 type = "number";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7007 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7008
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7009 // Make sure that NaN and null values aren't set. See: #7116
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7010 if ( value == null || type === "number" && isNaN( value ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7011 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7012 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7013
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7014 // If a number was passed in, add 'px' to the (except for certain CSS properties)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7015 if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7016 value += "px";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7017 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7018
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7019 // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7020 // but it would mean to define eight (for every problematic property) identical functions
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7021 if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7022 style[ name ] = "inherit";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7023 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7024
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7025 // If a hook was provided, use that value, otherwise just set the specified value
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7026 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7027
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7028 // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7029 // Fixes bug #5509
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7030 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7031 style[ name ] = value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7032 } catch(e) {}
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7033 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7034
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7035 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7036 // If a hook was provided get the non-computed value from there
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7037 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7038 return ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7039 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7040
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7041 // Otherwise just get the value from the style object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7042 return style[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7043 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7044 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7045
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7046 css: function( elem, name, extra, styles ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7047 var num, val, hooks,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7048 origName = jQuery.camelCase( name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7049
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7050 // Make sure that we're working with the right name
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7051 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7052
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7053 // gets hook for the prefixed version
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7054 // followed by the unprefixed version
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7055 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7056
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7057 // If a hook was provided get the computed value from there
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7058 if ( hooks && "get" in hooks ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7059 val = hooks.get( elem, true, extra );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7060 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7061
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7062 // Otherwise, if a way to get the computed value exists, use that
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7063 if ( val === undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7064 val = curCSS( elem, name, styles );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7065 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7066
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7067 //convert "normal" to computed value
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7068 if ( val === "normal" && name in cssNormalTransform ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7069 val = cssNormalTransform[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7070 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7071
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7072 // Return, converting to number if forced or a qualifier was provided and val looks numeric
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7073 if ( extra === "" || extra ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7074 num = parseFloat( val );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7075 return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7076 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7077 return val;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7078 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7079 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7080
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7081 // NOTE: we've included the "window" in window.getComputedStyle
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7082 // because jsdom on node.js will break without it.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7083 if ( window.getComputedStyle ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7084 getStyles = function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7085 return window.getComputedStyle( elem, null );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7086 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7087
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7088 curCSS = function( elem, name, _computed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7089 var width, minWidth, maxWidth,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7090 computed = _computed || getStyles( elem ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7091
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7092 // getPropertyValue is only needed for .css('filter') in IE9, see #12537
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7093 ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7094 style = elem.style;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7095
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7096 if ( computed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7097
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7098 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7099 ret = jQuery.style( elem, name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7100 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7101
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7102 // A tribute to the "awesome hack by Dean Edwards"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7103 // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7104 // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7105 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7106 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7107
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7108 // Remember the original values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7109 width = style.width;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7110 minWidth = style.minWidth;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7111 maxWidth = style.maxWidth;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7112
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7113 // Put in the new values to get a computed value out
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7114 style.minWidth = style.maxWidth = style.width = ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7115 ret = computed.width;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7116
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7117 // Revert the changed values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7118 style.width = width;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7119 style.minWidth = minWidth;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7120 style.maxWidth = maxWidth;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7121 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7122 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7123
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7124 return ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7125 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7126 } else if ( document.documentElement.currentStyle ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7127 getStyles = function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7128 return elem.currentStyle;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7129 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7130
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7131 curCSS = function( elem, name, _computed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7132 var left, rs, rsLeft,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7133 computed = _computed || getStyles( elem ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7134 ret = computed ? computed[ name ] : undefined,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7135 style = elem.style;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7136
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7137 // Avoid setting ret to empty string here
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7138 // so we don't default to auto
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7139 if ( ret == null && style && style[ name ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7140 ret = style[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7141 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7142
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7143 // From the awesome hack by Dean Edwards
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7144 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7145
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7146 // If we're not dealing with a regular pixel number
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7147 // but a number that has a weird ending, we need to convert it to pixels
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7148 // but not position css attributes, as those are proportional to the parent element instead
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7149 // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7150 if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7151
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7152 // Remember the original values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7153 left = style.left;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7154 rs = elem.runtimeStyle;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7155 rsLeft = rs && rs.left;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7156
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7157 // Put in the new values to get a computed value out
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7158 if ( rsLeft ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7159 rs.left = elem.currentStyle.left;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7160 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7161 style.left = name === "fontSize" ? "1em" : ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7162 ret = style.pixelLeft + "px";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7163
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7164 // Revert the changed values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7165 style.left = left;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7166 if ( rsLeft ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7167 rs.left = rsLeft;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7168 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7169 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7170
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7171 return ret === "" ? "auto" : ret;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7172 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7173 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7174
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7175 function setPositiveNumber( elem, value, subtract ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7176 var matches = rnumsplit.exec( value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7177 return matches ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7178 // Guard against undefined "subtract", e.g., when used as in cssHooks
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7179 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7180 value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7181 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7182
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7183 function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7184 var i = extra === ( isBorderBox ? "border" : "content" ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7185 // If we already have the right measurement, avoid augmentation
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7186 4 :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7187 // Otherwise initialize for horizontal or vertical properties
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7188 name === "width" ? 1 : 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7189
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7190 val = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7191
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7192 for ( ; i < 4; i += 2 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7193 // both box models exclude margin, so add it if we want it
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7194 if ( extra === "margin" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7195 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7196 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7197
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7198 if ( isBorderBox ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7199 // border-box includes padding, so remove it if we want content
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7200 if ( extra === "content" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7201 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7202 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7203
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7204 // at this point, extra isn't border nor margin, so remove border
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7205 if ( extra !== "margin" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7206 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7207 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7208 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7209 // at this point, extra isn't content, so add padding
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7210 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7211
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7212 // at this point, extra isn't content nor padding, so add border
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7213 if ( extra !== "padding" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7214 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7215 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7216 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7217 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7218
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7219 return val;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7220 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7221
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7222 function getWidthOrHeight( elem, name, extra ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7223
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7224 // Start with offset property, which is equivalent to the border-box value
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7225 var valueIsBorderBox = true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7226 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7227 styles = getStyles( elem ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7228 isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7229
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7230 // some non-html elements return undefined for offsetWidth, so check for null/undefined
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7231 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7232 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7233 if ( val <= 0 || val == null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7234 // Fall back to computed then uncomputed css if necessary
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7235 val = curCSS( elem, name, styles );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7236 if ( val < 0 || val == null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7237 val = elem.style[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7238 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7239
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7240 // Computed unit is not pixels. Stop here and return.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7241 if ( rnumnonpx.test(val) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7242 return val;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7243 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7244
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7245 // we need the check for style in case a browser which returns unreliable values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7246 // for getComputedStyle silently falls back to the reliable elem.style
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7247 valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7248
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7249 // Normalize "", auto, and prepare for extra
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7250 val = parseFloat( val ) || 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7251 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7252
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7253 // use the active box-sizing model to add/subtract irrelevant styles
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7254 return ( val +
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7255 augmentWidthOrHeight(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7256 elem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7257 name,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7258 extra || ( isBorderBox ? "border" : "content" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7259 valueIsBorderBox,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7260 styles
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7261 )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7262 ) + "px";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7263 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7264
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7265 // Try to determine the default display value of an element
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7266 function css_defaultDisplay( nodeName ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7267 var doc = document,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7268 display = elemdisplay[ nodeName ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7269
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7270 if ( !display ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7271 display = actualDisplay( nodeName, doc );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7272
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7273 // If the simple way fails, read from inside an iframe
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7274 if ( display === "none" || !display ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7275 // Use the already-created iframe if possible
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7276 iframe = ( iframe ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7277 jQuery("<iframe frameborder='0' width='0' height='0'/>")
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7278 .css( "cssText", "display:block !important" )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7279 ).appendTo( doc.documentElement );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7280
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7281 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7282 doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7283 doc.write("<!doctype html><html><body>");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7284 doc.close();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7285
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7286 display = actualDisplay( nodeName, doc );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7287 iframe.detach();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7288 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7289
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7290 // Store the correct default display
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7291 elemdisplay[ nodeName ] = display;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7292 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7293
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7294 return display;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7295 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7296
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7297 // Called ONLY from within css_defaultDisplay
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7298 function actualDisplay( name, doc ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7299 var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7300 display = jQuery.css( elem[0], "display" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7301 elem.remove();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7302 return display;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7303 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7304
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7305 jQuery.each([ "height", "width" ], function( i, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7306 jQuery.cssHooks[ name ] = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7307 get: function( elem, computed, extra ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7308 if ( computed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7309 // certain elements can have dimension info if we invisibly show them
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7310 // however, it must have a current display style that would benefit from this
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7311 return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7312 jQuery.swap( elem, cssShow, function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7313 return getWidthOrHeight( elem, name, extra );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7314 }) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7315 getWidthOrHeight( elem, name, extra );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7316 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7317 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7318
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7319 set: function( elem, value, extra ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7320 var styles = extra && getStyles( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7321 return setPositiveNumber( elem, value, extra ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7322 augmentWidthOrHeight(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7323 elem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7324 name,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7325 extra,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7326 jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7327 styles
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7328 ) : 0
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7329 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7330 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7331 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7332 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7333
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7334 if ( !jQuery.support.opacity ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7335 jQuery.cssHooks.opacity = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7336 get: function( elem, computed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7337 // IE uses filters for opacity
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7338 return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7339 ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7340 computed ? "1" : "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7341 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7342
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7343 set: function( elem, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7344 var style = elem.style,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7345 currentStyle = elem.currentStyle,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7346 opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7347 filter = currentStyle && currentStyle.filter || style.filter || "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7348
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7349 // IE has trouble with opacity if it does not have layout
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7350 // Force it by setting the zoom level
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7351 style.zoom = 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7352
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7353 // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7354 // if value === "", then remove inline opacity #12685
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7355 if ( ( value >= 1 || value === "" ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7356 jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7357 style.removeAttribute ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7358
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7359 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7360 // if "filter:" is present at all, clearType is disabled, we want to avoid this
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7361 // style.removeAttribute is IE Only, but so apparently is this code path...
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7362 style.removeAttribute( "filter" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7363
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7364 // if there is no filter style applied in a css rule or unset inline opacity, we are done
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7365 if ( value === "" || currentStyle && !currentStyle.filter ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7366 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7367 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7368 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7369
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7370 // otherwise, set new filter values
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7371 style.filter = ralpha.test( filter ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7372 filter.replace( ralpha, opacity ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7373 filter + " " + opacity;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7374 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7375 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7376 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7377
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7378 // These hooks cannot be added until DOM ready because the support test
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7379 // for it is not run until after DOM ready
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7380 jQuery(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7381 if ( !jQuery.support.reliableMarginRight ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7382 jQuery.cssHooks.marginRight = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7383 get: function( elem, computed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7384 if ( computed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7385 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7386 // Work around by temporarily setting element display to inline-block
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7387 return jQuery.swap( elem, { "display": "inline-block" },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7388 curCSS, [ elem, "marginRight" ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7389 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7390 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7391 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7392 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7393
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7394 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7395 // getComputedStyle returns percent when specified for top/left/bottom/right
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7396 // rather than make the css module depend on the offset module, we just check for it here
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7397 if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7398 jQuery.each( [ "top", "left" ], function( i, prop ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7399 jQuery.cssHooks[ prop ] = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7400 get: function( elem, computed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7401 if ( computed ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7402 computed = curCSS( elem, prop );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7403 // if curCSS returns percentage, fallback to offset
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7404 return rnumnonpx.test( computed ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7405 jQuery( elem ).position()[ prop ] + "px" :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7406 computed;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7407 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7408 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7409 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7410 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7411 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7412
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7413 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7414
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7415 if ( jQuery.expr && jQuery.expr.filters ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7416 jQuery.expr.filters.hidden = function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7417 // Support: Opera <= 12.12
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7418 // Opera reports offsetWidths and offsetHeights less than zero on some elements
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7419 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7420 (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7421 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7422
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7423 jQuery.expr.filters.visible = function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7424 return !jQuery.expr.filters.hidden( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7425 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7426 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7427
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7428 // These hooks are used by animate to expand properties
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7429 jQuery.each({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7430 margin: "",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7431 padding: "",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7432 border: "Width"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7433 }, function( prefix, suffix ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7434 jQuery.cssHooks[ prefix + suffix ] = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7435 expand: function( value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7436 var i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7437 expanded = {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7438
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7439 // assumes a single number if not a string
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7440 parts = typeof value === "string" ? value.split(" ") : [ value ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7441
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7442 for ( ; i < 4; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7443 expanded[ prefix + cssExpand[ i ] + suffix ] =
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7444 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7445 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7446
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7447 return expanded;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7448 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7449 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7450
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7451 if ( !rmargin.test( prefix ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7452 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7453 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7454 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7455 var r20 = /%20/g,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7456 rbracket = /\[\]$/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7457 rCRLF = /\r?\n/g,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7458 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7459 rsubmittable = /^(?:input|select|textarea|keygen)/i;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7460
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7461 jQuery.fn.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7462 serialize: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7463 return jQuery.param( this.serializeArray() );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7464 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7465 serializeArray: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7466 return this.map(function(){
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7467 // Can add propHook for "elements" to filter or add form elements
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7468 var elements = jQuery.prop( this, "elements" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7469 return elements ? jQuery.makeArray( elements ) : this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7470 })
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7471 .filter(function(){
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7472 var type = this.type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7473 // Use .is(":disabled") so that fieldset[disabled] works
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7474 return this.name && !jQuery( this ).is( ":disabled" ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7475 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7476 ( this.checked || !manipulation_rcheckableType.test( type ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7477 })
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7478 .map(function( i, elem ){
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7479 var val = jQuery( this ).val();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7480
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7481 return val == null ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7482 null :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7483 jQuery.isArray( val ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7484 jQuery.map( val, function( val ){
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7485 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7486 }) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7487 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7488 }).get();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7489 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7490 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7491
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7492 //Serialize an array of form elements or a set of
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7493 //key/values into a query string
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7494 jQuery.param = function( a, traditional ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7495 var prefix,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7496 s = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7497 add = function( key, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7498 // If value is a function, invoke it and return its value
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7499 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7500 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7501 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7502
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7503 // Set traditional to true for jQuery <= 1.3.2 behavior.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7504 if ( traditional === undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7505 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7506 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7507
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7508 // If an array was passed in, assume that it is an array of form elements.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7509 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7510 // Serialize the form elements
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7511 jQuery.each( a, function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7512 add( this.name, this.value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7513 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7514
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7515 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7516 // If traditional, encode the "old" way (the way 1.3.2 or older
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7517 // did it), otherwise encode params recursively.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7518 for ( prefix in a ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7519 buildParams( prefix, a[ prefix ], traditional, add );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7520 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7521 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7522
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7523 // Return the resulting serialization
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7524 return s.join( "&" ).replace( r20, "+" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7525 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7526
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7527 function buildParams( prefix, obj, traditional, add ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7528 var name;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7529
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7530 if ( jQuery.isArray( obj ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7531 // Serialize array item.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7532 jQuery.each( obj, function( i, v ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7533 if ( traditional || rbracket.test( prefix ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7534 // Treat each array item as a scalar.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7535 add( prefix, v );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7536
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7537 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7538 // Item is non-scalar (array or object), encode its numeric index.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7539 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7540 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7541 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7542
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7543 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7544 // Serialize object item.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7545 for ( name in obj ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7546 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7547 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7548
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7549 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7550 // Serialize scalar item.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7551 add( prefix, obj );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7552 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7553 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7554 jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7555 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7556 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7557
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7558 // Handle event binding
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7559 jQuery.fn[ name ] = function( data, fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7560 return arguments.length > 0 ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7561 this.on( name, null, data, fn ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7562 this.trigger( name );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7563 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7564 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7565
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7566 jQuery.fn.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7567 hover: function( fnOver, fnOut ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7568 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7569 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7570
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7571 bind: function( types, data, fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7572 return this.on( types, null, data, fn );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7573 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7574 unbind: function( types, fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7575 return this.off( types, null, fn );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7576 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7577
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7578 delegate: function( selector, types, data, fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7579 return this.on( types, selector, data, fn );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7580 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7581 undelegate: function( selector, types, fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7582 // ( namespace ) or ( selector, types [, fn] )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7583 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7584 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7585 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7586 var
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7587 // Document location
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7588 ajaxLocParts,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7589 ajaxLocation,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7590 ajax_nonce = jQuery.now(),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7591
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7592 ajax_rquery = /\?/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7593 rhash = /#.*$/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7594 rts = /([?&])_=[^&]*/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7595 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7596 // #7653, #8125, #8152: local protocol detection
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7597 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7598 rnoContent = /^(?:GET|HEAD)$/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7599 rprotocol = /^\/\//,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7600 rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7601
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7602 // Keep a copy of the old load method
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7603 _load = jQuery.fn.load,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7604
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7605 /* Prefilters
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7606 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7607 * 2) These are called:
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7608 * - BEFORE asking for a transport
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7609 * - AFTER param serialization (s.data is a string if s.processData is true)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7610 * 3) key is the dataType
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7611 * 4) the catchall symbol "*" can be used
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7612 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7613 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7614 prefilters = {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7615
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7616 /* Transports bindings
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7617 * 1) key is the dataType
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7618 * 2) the catchall symbol "*" can be used
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7619 * 3) selection will start with transport dataType and THEN go to "*" if needed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7620 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7621 transports = {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7622
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7623 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7624 allTypes = "*/".concat("*");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7625
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7626 // #8138, IE may throw an exception when accessing
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7627 // a field from window.location if document.domain has been set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7628 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7629 ajaxLocation = location.href;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7630 } catch( e ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7631 // Use the href attribute of an A element
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7632 // since IE will modify it given document.location
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7633 ajaxLocation = document.createElement( "a" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7634 ajaxLocation.href = "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7635 ajaxLocation = ajaxLocation.href;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7636 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7637
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7638 // Segment location into parts
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7639 ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7640
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7641 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7642 function addToPrefiltersOrTransports( structure ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7643
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7644 // dataTypeExpression is optional and defaults to "*"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7645 return function( dataTypeExpression, func ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7646
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7647 if ( typeof dataTypeExpression !== "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7648 func = dataTypeExpression;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7649 dataTypeExpression = "*";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7650 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7651
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7652 var dataType,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7653 i = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7654 dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7655
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7656 if ( jQuery.isFunction( func ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7657 // For each dataType in the dataTypeExpression
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7658 while ( (dataType = dataTypes[i++]) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7659 // Prepend if requested
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7660 if ( dataType[0] === "+" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7661 dataType = dataType.slice( 1 ) || "*";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7662 (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7663
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7664 // Otherwise append
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7665 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7666 (structure[ dataType ] = structure[ dataType ] || []).push( func );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7667 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7668 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7669 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7670 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7671 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7672
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7673 // Base inspection function for prefilters and transports
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7674 function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7675
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7676 var inspected = {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7677 seekingTransport = ( structure === transports );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7678
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7679 function inspect( dataType ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7680 var selected;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7681 inspected[ dataType ] = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7682 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7683 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7684 if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7685 options.dataTypes.unshift( dataTypeOrTransport );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7686 inspect( dataTypeOrTransport );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7687 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7688 } else if ( seekingTransport ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7689 return !( selected = dataTypeOrTransport );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7690 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7691 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7692 return selected;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7693 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7694
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7695 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7696 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7697
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7698 // A special extend for ajax options
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7699 // that takes "flat" options (not to be deep extended)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7700 // Fixes #9887
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7701 function ajaxExtend( target, src ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7702 var deep, key,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7703 flatOptions = jQuery.ajaxSettings.flatOptions || {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7704
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7705 for ( key in src ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7706 if ( src[ key ] !== undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7707 ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7708 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7709 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7710 if ( deep ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7711 jQuery.extend( true, target, deep );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7712 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7713
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7714 return target;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7715 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7716
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7717 jQuery.fn.load = function( url, params, callback ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7718 if ( typeof url !== "string" && _load ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7719 return _load.apply( this, arguments );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7720 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7721
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7722 var selector, response, type,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7723 self = this,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7724 off = url.indexOf(" ");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7725
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7726 if ( off >= 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7727 selector = url.slice( off, url.length );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7728 url = url.slice( 0, off );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7729 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7730
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7731 // If it's a function
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7732 if ( jQuery.isFunction( params ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7733
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7734 // We assume that it's the callback
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7735 callback = params;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7736 params = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7737
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7738 // Otherwise, build a param string
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7739 } else if ( params && typeof params === "object" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7740 type = "POST";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7741 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7742
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7743 // If we have elements to modify, make the request
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7744 if ( self.length > 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7745 jQuery.ajax({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7746 url: url,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7747
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7748 // if "type" variable is undefined, then "GET" method will be used
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7749 type: type,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7750 dataType: "html",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7751 data: params
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7752 }).done(function( responseText ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7753
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7754 // Save response for use in complete callback
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7755 response = arguments;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7756
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7757 self.html( selector ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7758
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7759 // If a selector was specified, locate the right elements in a dummy div
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7760 // Exclude scripts to avoid IE 'Permission Denied' errors
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7761 jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7762
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7763 // Otherwise use the full result
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7764 responseText );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7765
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7766 }).complete( callback && function( jqXHR, status ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7767 self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7768 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7769 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7770
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7771 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7772 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7773
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7774 // Attach a bunch of functions for handling common AJAX events
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7775 jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7776 jQuery.fn[ type ] = function( fn ){
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7777 return this.on( type, fn );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7778 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7779 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7780
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7781 jQuery.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7782
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7783 // Counter for holding the number of active queries
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7784 active: 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7785
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7786 // Last-Modified header cache for next request
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7787 lastModified: {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7788 etag: {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7789
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7790 ajaxSettings: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7791 url: ajaxLocation,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7792 type: "GET",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7793 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7794 global: true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7795 processData: true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7796 async: true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7797 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7798 /*
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7799 timeout: 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7800 data: null,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7801 dataType: null,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7802 username: null,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7803 password: null,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7804 cache: null,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7805 throws: false,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7806 traditional: false,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7807 headers: {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7808 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7809
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7810 accepts: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7811 "*": allTypes,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7812 text: "text/plain",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7813 html: "text/html",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7814 xml: "application/xml, text/xml",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7815 json: "application/json, text/javascript"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7816 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7817
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7818 contents: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7819 xml: /xml/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7820 html: /html/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7821 json: /json/
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7822 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7823
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7824 responseFields: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7825 xml: "responseXML",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7826 text: "responseText",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7827 json: "responseJSON"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7828 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7829
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7830 // Data converters
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7831 // Keys separate source (or catchall "*") and destination types with a single space
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7832 converters: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7833
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7834 // Convert anything to text
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7835 "* text": String,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7836
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7837 // Text to html (true = no transformation)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7838 "text html": true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7839
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7840 // Evaluate text as a json expression
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7841 "text json": jQuery.parseJSON,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7842
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7843 // Parse text as xml
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7844 "text xml": jQuery.parseXML
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7845 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7846
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7847 // For options that shouldn't be deep extended:
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7848 // you can add your own custom options here if
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7849 // and when you create one that shouldn't be
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7850 // deep extended (see ajaxExtend)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7851 flatOptions: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7852 url: true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7853 context: true
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7854 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7855 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7856
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7857 // Creates a full fledged settings object into target
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7858 // with both ajaxSettings and settings fields.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7859 // If target is omitted, writes into ajaxSettings.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7860 ajaxSetup: function( target, settings ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7861 return settings ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7862
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7863 // Building a settings object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7864 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7865
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7866 // Extending ajaxSettings
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7867 ajaxExtend( jQuery.ajaxSettings, target );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7868 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7869
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7870 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7871 ajaxTransport: addToPrefiltersOrTransports( transports ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7872
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7873 // Main method
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7874 ajax: function( url, options ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7875
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7876 // If url is an object, simulate pre-1.5 signature
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7877 if ( typeof url === "object" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7878 options = url;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7879 url = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7880 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7881
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7882 // Force options to be an object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7883 options = options || {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7884
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7885 var // Cross-domain detection vars
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7886 parts,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7887 // Loop variable
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7888 i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7889 // URL without anti-cache param
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7890 cacheURL,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7891 // Response headers as string
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7892 responseHeadersString,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7893 // timeout handle
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7894 timeoutTimer,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7895
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7896 // To know if global events are to be dispatched
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7897 fireGlobals,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7898
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7899 transport,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7900 // Response headers
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7901 responseHeaders,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7902 // Create the final options object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7903 s = jQuery.ajaxSetup( {}, options ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7904 // Callbacks context
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7905 callbackContext = s.context || s,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7906 // Context for global events is callbackContext if it is a DOM node or jQuery collection
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7907 globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7908 jQuery( callbackContext ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7909 jQuery.event,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7910 // Deferreds
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7911 deferred = jQuery.Deferred(),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7912 completeDeferred = jQuery.Callbacks("once memory"),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7913 // Status-dependent callbacks
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7914 statusCode = s.statusCode || {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7915 // Headers (they are sent all at once)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7916 requestHeaders = {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7917 requestHeadersNames = {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7918 // The jqXHR state
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7919 state = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7920 // Default abort message
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7921 strAbort = "canceled",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7922 // Fake xhr
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7923 jqXHR = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7924 readyState: 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7925
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7926 // Builds headers hashtable if needed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7927 getResponseHeader: function( key ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7928 var match;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7929 if ( state === 2 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7930 if ( !responseHeaders ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7931 responseHeaders = {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7932 while ( (match = rheaders.exec( responseHeadersString )) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7933 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7934 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7935 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7936 match = responseHeaders[ key.toLowerCase() ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7937 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7938 return match == null ? null : match;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7939 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7940
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7941 // Raw string
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7942 getAllResponseHeaders: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7943 return state === 2 ? responseHeadersString : null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7944 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7945
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7946 // Caches the header
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7947 setRequestHeader: function( name, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7948 var lname = name.toLowerCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7949 if ( !state ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7950 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7951 requestHeaders[ name ] = value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7952 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7953 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7954 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7955
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7956 // Overrides response content-type header
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7957 overrideMimeType: function( type ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7958 if ( !state ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7959 s.mimeType = type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7960 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7961 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7962 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7963
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7964 // Status-dependent callbacks
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7965 statusCode: function( map ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7966 var code;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7967 if ( map ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7968 if ( state < 2 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7969 for ( code in map ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7970 // Lazy-add the new callback in a way that preserves old ones
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7971 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7972 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7973 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7974 // Execute the appropriate callbacks
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7975 jqXHR.always( map[ jqXHR.status ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7976 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7977 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7978 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7979 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7980
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7981 // Cancel the request
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7982 abort: function( statusText ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7983 var finalText = statusText || strAbort;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7984 if ( transport ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7985 transport.abort( finalText );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7986 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7987 done( 0, finalText );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7988 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7989 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7990 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7991
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7992 // Attach deferreds
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7993 deferred.promise( jqXHR ).complete = completeDeferred.add;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7994 jqXHR.success = jqXHR.done;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7995 jqXHR.error = jqXHR.fail;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7996
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7997 // Remove hash character (#7531: and string promotion)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7998 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
7999 // Handle falsy url in the settings object (#10093: consistency with old signature)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8000 // We also use the url parameter if available
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8001 s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8002
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8003 // Alias method option to type as per ticket #12004
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8004 s.type = options.method || options.type || s.method || s.type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8005
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8006 // Extract dataTypes list
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8007 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8008
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8009 // A cross-domain request is in order when we have a protocol:host:port mismatch
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8010 if ( s.crossDomain == null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8011 parts = rurl.exec( s.url.toLowerCase() );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8012 s.crossDomain = !!( parts &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8013 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8014 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8015 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8016 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8017 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8018
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8019 // Convert data if not already a string
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8020 if ( s.data && s.processData && typeof s.data !== "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8021 s.data = jQuery.param( s.data, s.traditional );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8022 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8023
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8024 // Apply prefilters
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8025 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8026
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8027 // If request was aborted inside a prefilter, stop there
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8028 if ( state === 2 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8029 return jqXHR;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8030 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8031
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8032 // We can fire global events as of now if asked to
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8033 fireGlobals = s.global;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8034
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8035 // Watch for a new set of requests
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8036 if ( fireGlobals && jQuery.active++ === 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8037 jQuery.event.trigger("ajaxStart");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8038 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8039
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8040 // Uppercase the type
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8041 s.type = s.type.toUpperCase();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8042
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8043 // Determine if request has content
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8044 s.hasContent = !rnoContent.test( s.type );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8045
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8046 // Save the URL in case we're toying with the If-Modified-Since
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8047 // and/or If-None-Match header later on
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8048 cacheURL = s.url;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8049
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8050 // More options handling for requests with no content
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8051 if ( !s.hasContent ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8052
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8053 // If data is available, append data to url
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8054 if ( s.data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8055 cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8056 // #9682: remove data so that it's not used in an eventual retry
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8057 delete s.data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8058 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8059
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8060 // Add anti-cache in url if needed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8061 if ( s.cache === false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8062 s.url = rts.test( cacheURL ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8063
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8064 // If there is already a '_' parameter, set its value
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8065 cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8066
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8067 // Otherwise add one to the end
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8068 cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8069 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8070 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8071
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8072 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8073 if ( s.ifModified ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8074 if ( jQuery.lastModified[ cacheURL ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8075 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8076 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8077 if ( jQuery.etag[ cacheURL ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8078 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8079 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8080 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8081
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8082 // Set the correct header, if data is being sent
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8083 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8084 jqXHR.setRequestHeader( "Content-Type", s.contentType );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8085 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8086
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8087 // Set the Accepts header for the server, depending on the dataType
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8088 jqXHR.setRequestHeader(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8089 "Accept",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8090 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8091 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8092 s.accepts[ "*" ]
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8093 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8094
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8095 // Check for headers option
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8096 for ( i in s.headers ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8097 jqXHR.setRequestHeader( i, s.headers[ i ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8098 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8099
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8100 // Allow custom headers/mimetypes and early abort
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8101 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8102 // Abort if not done already and return
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8103 return jqXHR.abort();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8104 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8105
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8106 // aborting is no longer a cancellation
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8107 strAbort = "abort";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8108
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8109 // Install callbacks on deferreds
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8110 for ( i in { success: 1, error: 1, complete: 1 } ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8111 jqXHR[ i ]( s[ i ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8112 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8113
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8114 // Get transport
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8115 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8116
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8117 // If no transport, we auto-abort
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8118 if ( !transport ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8119 done( -1, "No Transport" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8120 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8121 jqXHR.readyState = 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8122
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8123 // Send global event
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8124 if ( fireGlobals ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8125 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8126 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8127 // Timeout
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8128 if ( s.async && s.timeout > 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8129 timeoutTimer = setTimeout(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8130 jqXHR.abort("timeout");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8131 }, s.timeout );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8132 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8133
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8134 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8135 state = 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8136 transport.send( requestHeaders, done );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8137 } catch ( e ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8138 // Propagate exception as error if not done
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8139 if ( state < 2 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8140 done( -1, e );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8141 // Simply rethrow otherwise
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8142 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8143 throw e;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8144 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8145 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8146 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8147
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8148 // Callback for when everything is done
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8149 function done( status, nativeStatusText, responses, headers ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8150 var isSuccess, success, error, response, modified,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8151 statusText = nativeStatusText;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8152
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8153 // Called once
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8154 if ( state === 2 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8155 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8156 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8157
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8158 // State is "done" now
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8159 state = 2;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8160
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8161 // Clear timeout if it exists
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8162 if ( timeoutTimer ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8163 clearTimeout( timeoutTimer );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8164 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8165
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8166 // Dereference transport for early garbage collection
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8167 // (no matter how long the jqXHR object will be used)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8168 transport = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8169
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8170 // Cache response headers
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8171 responseHeadersString = headers || "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8172
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8173 // Set readyState
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8174 jqXHR.readyState = status > 0 ? 4 : 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8175
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8176 // Determine if successful
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8177 isSuccess = status >= 200 && status < 300 || status === 304;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8178
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8179 // Get response data
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8180 if ( responses ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8181 response = ajaxHandleResponses( s, jqXHR, responses );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8182 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8183
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8184 // Convert no matter what (that way responseXXX fields are always set)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8185 response = ajaxConvert( s, response, jqXHR, isSuccess );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8186
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8187 // If successful, handle type chaining
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8188 if ( isSuccess ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8189
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8190 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8191 if ( s.ifModified ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8192 modified = jqXHR.getResponseHeader("Last-Modified");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8193 if ( modified ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8194 jQuery.lastModified[ cacheURL ] = modified;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8195 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8196 modified = jqXHR.getResponseHeader("etag");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8197 if ( modified ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8198 jQuery.etag[ cacheURL ] = modified;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8199 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8200 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8201
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8202 // if no content
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8203 if ( status === 204 || s.type === "HEAD" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8204 statusText = "nocontent";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8205
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8206 // if not modified
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8207 } else if ( status === 304 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8208 statusText = "notmodified";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8209
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8210 // If we have data, let's convert it
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8211 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8212 statusText = response.state;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8213 success = response.data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8214 error = response.error;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8215 isSuccess = !error;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8216 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8217 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8218 // We extract error from statusText
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8219 // then normalize statusText and status for non-aborts
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8220 error = statusText;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8221 if ( status || !statusText ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8222 statusText = "error";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8223 if ( status < 0 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8224 status = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8225 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8226 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8227 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8228
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8229 // Set data for the fake xhr object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8230 jqXHR.status = status;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8231 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8232
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8233 // Success/Error
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8234 if ( isSuccess ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8235 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8236 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8237 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8238 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8239
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8240 // Status-dependent callbacks
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8241 jqXHR.statusCode( statusCode );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8242 statusCode = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8243
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8244 if ( fireGlobals ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8245 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8246 [ jqXHR, s, isSuccess ? success : error ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8247 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8248
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8249 // Complete
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8250 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8251
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8252 if ( fireGlobals ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8253 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8254 // Handle the global AJAX counter
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8255 if ( !( --jQuery.active ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8256 jQuery.event.trigger("ajaxStop");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8257 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8258 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8259 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8260
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8261 return jqXHR;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8262 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8263
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8264 getJSON: function( url, data, callback ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8265 return jQuery.get( url, data, callback, "json" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8266 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8267
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8268 getScript: function( url, callback ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8269 return jQuery.get( url, undefined, callback, "script" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8270 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8271 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8272
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8273 jQuery.each( [ "get", "post" ], function( i, method ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8274 jQuery[ method ] = function( url, data, callback, type ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8275 // shift arguments if data argument was omitted
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8276 if ( jQuery.isFunction( data ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8277 type = type || callback;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8278 callback = data;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8279 data = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8280 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8281
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8282 return jQuery.ajax({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8283 url: url,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8284 type: method,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8285 dataType: type,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8286 data: data,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8287 success: callback
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8288 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8289 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8290 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8291
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8292 /* Handles responses to an ajax request:
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8293 * - finds the right dataType (mediates between content-type and expected dataType)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8294 * - returns the corresponding response
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8295 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8296 function ajaxHandleResponses( s, jqXHR, responses ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8297 var firstDataType, ct, finalDataType, type,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8298 contents = s.contents,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8299 dataTypes = s.dataTypes;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8300
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8301 // Remove auto dataType and get content-type in the process
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8302 while( dataTypes[ 0 ] === "*" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8303 dataTypes.shift();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8304 if ( ct === undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8305 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8306 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8307 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8308
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8309 // Check if we're dealing with a known content-type
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8310 if ( ct ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8311 for ( type in contents ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8312 if ( contents[ type ] && contents[ type ].test( ct ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8313 dataTypes.unshift( type );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8314 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8315 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8316 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8317 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8318
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8319 // Check to see if we have a response for the expected dataType
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8320 if ( dataTypes[ 0 ] in responses ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8321 finalDataType = dataTypes[ 0 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8322 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8323 // Try convertible dataTypes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8324 for ( type in responses ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8325 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8326 finalDataType = type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8327 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8328 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8329 if ( !firstDataType ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8330 firstDataType = type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8331 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8332 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8333 // Or just use first one
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8334 finalDataType = finalDataType || firstDataType;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8335 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8336
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8337 // If we found a dataType
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8338 // We add the dataType to the list if needed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8339 // and return the corresponding response
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8340 if ( finalDataType ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8341 if ( finalDataType !== dataTypes[ 0 ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8342 dataTypes.unshift( finalDataType );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8343 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8344 return responses[ finalDataType ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8345 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8346 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8347
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8348 /* Chain conversions given the request and the original response
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8349 * Also sets the responseXXX fields on the jqXHR instance
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8350 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8351 function ajaxConvert( s, response, jqXHR, isSuccess ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8352 var conv2, current, conv, tmp, prev,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8353 converters = {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8354 // Work with a copy of dataTypes in case we need to modify it for conversion
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8355 dataTypes = s.dataTypes.slice();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8356
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8357 // Create converters map with lowercased keys
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8358 if ( dataTypes[ 1 ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8359 for ( conv in s.converters ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8360 converters[ conv.toLowerCase() ] = s.converters[ conv ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8361 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8362 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8363
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8364 current = dataTypes.shift();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8365
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8366 // Convert to each sequential dataType
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8367 while ( current ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8368
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8369 if ( s.responseFields[ current ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8370 jqXHR[ s.responseFields[ current ] ] = response;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8371 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8372
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8373 // Apply the dataFilter if provided
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8374 if ( !prev && isSuccess && s.dataFilter ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8375 response = s.dataFilter( response, s.dataType );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8376 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8377
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8378 prev = current;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8379 current = dataTypes.shift();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8380
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8381 if ( current ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8382
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8383 // There's only work to do if current dataType is non-auto
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8384 if ( current === "*" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8385
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8386 current = prev;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8387
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8388 // Convert response if prev dataType is non-auto and differs from current
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8389 } else if ( prev !== "*" && prev !== current ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8390
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8391 // Seek a direct converter
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8392 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8393
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8394 // If none found, seek a pair
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8395 if ( !conv ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8396 for ( conv2 in converters ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8397
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8398 // If conv2 outputs current
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8399 tmp = conv2.split( " " );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8400 if ( tmp[ 1 ] === current ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8401
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8402 // If prev can be converted to accepted input
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8403 conv = converters[ prev + " " + tmp[ 0 ] ] ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8404 converters[ "* " + tmp[ 0 ] ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8405 if ( conv ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8406 // Condense equivalence converters
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8407 if ( conv === true ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8408 conv = converters[ conv2 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8409
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8410 // Otherwise, insert the intermediate dataType
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8411 } else if ( converters[ conv2 ] !== true ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8412 current = tmp[ 0 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8413 dataTypes.unshift( tmp[ 1 ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8414 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8415 break;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8416 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8417 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8418 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8419 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8420
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8421 // Apply converter (if not an equivalence)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8422 if ( conv !== true ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8423
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8424 // Unless errors are allowed to bubble, catch and return them
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8425 if ( conv && s[ "throws" ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8426 response = conv( response );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8427 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8428 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8429 response = conv( response );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8430 } catch ( e ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8431 return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8432 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8433 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8434 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8435 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8436 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8437 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8438
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8439 return { state: "success", data: response };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8440 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8441 // Install script dataType
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8442 jQuery.ajaxSetup({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8443 accepts: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8444 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8445 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8446 contents: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8447 script: /(?:java|ecma)script/
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8448 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8449 converters: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8450 "text script": function( text ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8451 jQuery.globalEval( text );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8452 return text;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8453 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8454 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8455 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8456
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8457 // Handle cache's special case and global
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8458 jQuery.ajaxPrefilter( "script", function( s ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8459 if ( s.cache === undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8460 s.cache = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8461 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8462 if ( s.crossDomain ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8463 s.type = "GET";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8464 s.global = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8465 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8466 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8467
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8468 // Bind script tag hack transport
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8469 jQuery.ajaxTransport( "script", function(s) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8470
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8471 // This transport only deals with cross domain requests
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8472 if ( s.crossDomain ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8473
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8474 var script,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8475 head = document.head || jQuery("head")[0] || document.documentElement;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8476
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8477 return {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8478
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8479 send: function( _, callback ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8480
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8481 script = document.createElement("script");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8482
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8483 script.async = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8484
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8485 if ( s.scriptCharset ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8486 script.charset = s.scriptCharset;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8487 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8488
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8489 script.src = s.url;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8490
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8491 // Attach handlers for all browsers
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8492 script.onload = script.onreadystatechange = function( _, isAbort ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8493
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8494 if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8495
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8496 // Handle memory leak in IE
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8497 script.onload = script.onreadystatechange = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8498
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8499 // Remove the script
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8500 if ( script.parentNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8501 script.parentNode.removeChild( script );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8502 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8503
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8504 // Dereference the script
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8505 script = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8506
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8507 // Callback if not abort
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8508 if ( !isAbort ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8509 callback( 200, "success" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8510 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8511 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8512 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8513
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8514 // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8515 // Use native DOM manipulation to avoid our domManip AJAX trickery
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8516 head.insertBefore( script, head.firstChild );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8517 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8518
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8519 abort: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8520 if ( script ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8521 script.onload( undefined, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8522 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8523 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8524 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8525 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8526 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8527 var oldCallbacks = [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8528 rjsonp = /(=)\?(?=&|$)|\?\?/;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8529
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8530 // Default jsonp settings
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8531 jQuery.ajaxSetup({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8532 jsonp: "callback",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8533 jsonpCallback: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8534 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8535 this[ callback ] = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8536 return callback;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8537 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8538 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8539
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8540 // Detect, normalize options and install callbacks for jsonp requests
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8541 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8542
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8543 var callbackName, overwritten, responseContainer,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8544 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8545 "url" :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8546 typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8547 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8548
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8549 // Handle iff the expected data type is "jsonp" or we have a parameter to set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8550 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8551
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8552 // Get callback name, remembering preexisting value associated with it
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8553 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8554 s.jsonpCallback() :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8555 s.jsonpCallback;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8556
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8557 // Insert callback into url or form data
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8558 if ( jsonProp ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8559 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8560 } else if ( s.jsonp !== false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8561 s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8562 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8563
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8564 // Use data converter to retrieve json after script execution
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8565 s.converters["script json"] = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8566 if ( !responseContainer ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8567 jQuery.error( callbackName + " was not called" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8568 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8569 return responseContainer[ 0 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8570 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8571
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8572 // force json dataType
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8573 s.dataTypes[ 0 ] = "json";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8574
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8575 // Install callback
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8576 overwritten = window[ callbackName ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8577 window[ callbackName ] = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8578 responseContainer = arguments;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8579 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8580
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8581 // Clean-up function (fires after converters)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8582 jqXHR.always(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8583 // Restore preexisting value
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8584 window[ callbackName ] = overwritten;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8585
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8586 // Save back as free
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8587 if ( s[ callbackName ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8588 // make sure that re-using the options doesn't screw things around
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8589 s.jsonpCallback = originalSettings.jsonpCallback;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8590
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8591 // save the callback name for future use
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8592 oldCallbacks.push( callbackName );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8593 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8594
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8595 // Call if it was a function and we have a response
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8596 if ( responseContainer && jQuery.isFunction( overwritten ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8597 overwritten( responseContainer[ 0 ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8598 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8599
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8600 responseContainer = overwritten = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8601 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8602
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8603 // Delegate to script
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8604 return "script";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8605 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8606 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8607 var xhrCallbacks, xhrSupported,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8608 xhrId = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8609 // #5280: Internet Explorer will keep connections alive if we don't abort on unload
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8610 xhrOnUnloadAbort = window.ActiveXObject && function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8611 // Abort all pending requests
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8612 var key;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8613 for ( key in xhrCallbacks ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8614 xhrCallbacks[ key ]( undefined, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8615 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8616 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8617
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8618 // Functions to create xhrs
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8619 function createStandardXHR() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8620 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8621 return new window.XMLHttpRequest();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8622 } catch( e ) {}
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8623 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8624
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8625 function createActiveXHR() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8626 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8627 return new window.ActiveXObject("Microsoft.XMLHTTP");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8628 } catch( e ) {}
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8629 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8630
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8631 // Create the request object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8632 // (This is still attached to ajaxSettings for backward compatibility)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8633 jQuery.ajaxSettings.xhr = window.ActiveXObject ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8634 /* Microsoft failed to properly
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8635 * implement the XMLHttpRequest in IE7 (can't request local files),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8636 * so we use the ActiveXObject when it is available
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8637 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8638 * we need a fallback.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8639 */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8640 function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8641 return !this.isLocal && createStandardXHR() || createActiveXHR();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8642 } :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8643 // For all other browsers, use the standard XMLHttpRequest object
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8644 createStandardXHR;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8645
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8646 // Determine support properties
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8647 xhrSupported = jQuery.ajaxSettings.xhr();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8648 jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8649 xhrSupported = jQuery.support.ajax = !!xhrSupported;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8650
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8651 // Create transport if the browser can provide an xhr
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8652 if ( xhrSupported ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8653
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8654 jQuery.ajaxTransport(function( s ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8655 // Cross domain only allowed if supported through XMLHttpRequest
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8656 if ( !s.crossDomain || jQuery.support.cors ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8657
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8658 var callback;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8659
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8660 return {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8661 send: function( headers, complete ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8662
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8663 // Get a new xhr
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8664 var handle, i,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8665 xhr = s.xhr();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8666
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8667 // Open the socket
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8668 // Passing null username, generates a login popup on Opera (#2865)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8669 if ( s.username ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8670 xhr.open( s.type, s.url, s.async, s.username, s.password );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8671 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8672 xhr.open( s.type, s.url, s.async );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8673 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8674
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8675 // Apply custom fields if provided
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8676 if ( s.xhrFields ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8677 for ( i in s.xhrFields ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8678 xhr[ i ] = s.xhrFields[ i ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8679 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8680 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8681
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8682 // Override mime type if needed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8683 if ( s.mimeType && xhr.overrideMimeType ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8684 xhr.overrideMimeType( s.mimeType );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8685 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8686
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8687 // X-Requested-With header
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8688 // For cross-domain requests, seeing as conditions for a preflight are
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8689 // akin to a jigsaw puzzle, we simply never set it to be sure.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8690 // (it can always be set on a per-request basis or even using ajaxSetup)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8691 // For same-domain requests, won't change header if already provided.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8692 if ( !s.crossDomain && !headers["X-Requested-With"] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8693 headers["X-Requested-With"] = "XMLHttpRequest";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8694 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8695
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8696 // Need an extra try/catch for cross domain requests in Firefox 3
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8697 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8698 for ( i in headers ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8699 xhr.setRequestHeader( i, headers[ i ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8700 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8701 } catch( err ) {}
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8702
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8703 // Do send the request
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8704 // This may raise an exception which is actually
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8705 // handled in jQuery.ajax (so no try/catch here)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8706 xhr.send( ( s.hasContent && s.data ) || null );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8707
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8708 // Listener
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8709 callback = function( _, isAbort ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8710 var status, responseHeaders, statusText, responses;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8711
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8712 // Firefox throws exceptions when accessing properties
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8713 // of an xhr when a network error occurred
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8714 // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8715 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8716
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8717 // Was never called and is aborted or complete
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8718 if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8719
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8720 // Only called once
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8721 callback = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8722
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8723 // Do not keep as active anymore
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8724 if ( handle ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8725 xhr.onreadystatechange = jQuery.noop;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8726 if ( xhrOnUnloadAbort ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8727 delete xhrCallbacks[ handle ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8728 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8729 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8730
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8731 // If it's an abort
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8732 if ( isAbort ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8733 // Abort it manually if needed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8734 if ( xhr.readyState !== 4 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8735 xhr.abort();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8736 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8737 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8738 responses = {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8739 status = xhr.status;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8740 responseHeaders = xhr.getAllResponseHeaders();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8741
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8742 // When requesting binary data, IE6-9 will throw an exception
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8743 // on any attempt to access responseText (#11426)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8744 if ( typeof xhr.responseText === "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8745 responses.text = xhr.responseText;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8746 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8747
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8748 // Firefox throws an exception when accessing
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8749 // statusText for faulty cross-domain requests
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8750 try {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8751 statusText = xhr.statusText;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8752 } catch( e ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8753 // We normalize with Webkit giving an empty statusText
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8754 statusText = "";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8755 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8756
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8757 // Filter status for non standard behaviors
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8758
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8759 // If the request is local and we have data: assume a success
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8760 // (success with no data won't get notified, that's the best we
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8761 // can do given current implementations)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8762 if ( !status && s.isLocal && !s.crossDomain ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8763 status = responses.text ? 200 : 404;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8764 // IE - #1450: sometimes returns 1223 when it should be 204
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8765 } else if ( status === 1223 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8766 status = 204;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8767 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8768 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8769 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8770 } catch( firefoxAccessException ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8771 if ( !isAbort ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8772 complete( -1, firefoxAccessException );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8773 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8774 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8775
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8776 // Call complete if needed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8777 if ( responses ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8778 complete( status, statusText, responses, responseHeaders );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8779 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8780 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8781
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8782 if ( !s.async ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8783 // if we're in sync mode we fire the callback
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8784 callback();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8785 } else if ( xhr.readyState === 4 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8786 // (IE6 & IE7) if it's in cache and has been
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8787 // retrieved directly we need to fire the callback
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8788 setTimeout( callback );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8789 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8790 handle = ++xhrId;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8791 if ( xhrOnUnloadAbort ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8792 // Create the active xhrs callbacks list if needed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8793 // and attach the unload handler
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8794 if ( !xhrCallbacks ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8795 xhrCallbacks = {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8796 jQuery( window ).unload( xhrOnUnloadAbort );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8797 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8798 // Add to list of active xhrs callbacks
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8799 xhrCallbacks[ handle ] = callback;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8800 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8801 xhr.onreadystatechange = callback;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8802 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8803 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8804
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8805 abort: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8806 if ( callback ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8807 callback( undefined, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8808 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8809 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8810 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8811 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8812 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8813 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8814 var fxNow, timerId,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8815 rfxtypes = /^(?:toggle|show|hide)$/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8816 rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8817 rrun = /queueHooks$/,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8818 animationPrefilters = [ defaultPrefilter ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8819 tweeners = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8820 "*": [function( prop, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8821 var tween = this.createTween( prop, value ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8822 target = tween.cur(),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8823 parts = rfxnum.exec( value ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8824 unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8825
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8826 // Starting value computation is required for potential unit mismatches
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8827 start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8828 rfxnum.exec( jQuery.css( tween.elem, prop ) ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8829 scale = 1,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8830 maxIterations = 20;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8831
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8832 if ( start && start[ 3 ] !== unit ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8833 // Trust units reported by jQuery.css
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8834 unit = unit || start[ 3 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8835
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8836 // Make sure we update the tween properties later on
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8837 parts = parts || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8838
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8839 // Iteratively approximate from a nonzero starting point
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8840 start = +target || 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8841
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8842 do {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8843 // If previous iteration zeroed out, double until we get *something*
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8844 // Use a string for doubling factor so we don't accidentally see scale as unchanged below
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8845 scale = scale || ".5";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8846
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8847 // Adjust and apply
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8848 start = start / scale;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8849 jQuery.style( tween.elem, prop, start + unit );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8850
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8851 // Update scale, tolerating zero or NaN from tween.cur()
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8852 // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8853 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8854 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8855
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8856 // Update tween properties
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8857 if ( parts ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8858 start = tween.start = +start || +target || 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8859 tween.unit = unit;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8860 // If a +=/-= token was provided, we're doing a relative animation
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8861 tween.end = parts[ 1 ] ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8862 start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8863 +parts[ 2 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8864 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8865
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8866 return tween;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8867 }]
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8868 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8869
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8870 // Animations created synchronously will run synchronously
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8871 function createFxNow() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8872 setTimeout(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8873 fxNow = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8874 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8875 return ( fxNow = jQuery.now() );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8876 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8877
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8878 function createTween( value, prop, animation ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8879 var tween,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8880 collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8881 index = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8882 length = collection.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8883 for ( ; index < length; index++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8884 if ( (tween = collection[ index ].call( animation, prop, value )) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8885
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8886 // we're done with this property
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8887 return tween;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8888 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8889 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8890 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8891
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8892 function Animation( elem, properties, options ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8893 var result,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8894 stopped,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8895 index = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8896 length = animationPrefilters.length,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8897 deferred = jQuery.Deferred().always( function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8898 // don't match elem in the :animated selector
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8899 delete tick.elem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8900 }),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8901 tick = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8902 if ( stopped ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8903 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8904 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8905 var currentTime = fxNow || createFxNow(),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8906 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8907 // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8908 temp = remaining / animation.duration || 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8909 percent = 1 - temp,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8910 index = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8911 length = animation.tweens.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8912
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8913 for ( ; index < length ; index++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8914 animation.tweens[ index ].run( percent );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8915 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8916
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8917 deferred.notifyWith( elem, [ animation, percent, remaining ]);
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8918
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8919 if ( percent < 1 && length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8920 return remaining;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8921 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8922 deferred.resolveWith( elem, [ animation ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8923 return false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8924 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8925 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8926 animation = deferred.promise({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8927 elem: elem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8928 props: jQuery.extend( {}, properties ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8929 opts: jQuery.extend( true, { specialEasing: {} }, options ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8930 originalProperties: properties,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8931 originalOptions: options,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8932 startTime: fxNow || createFxNow(),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8933 duration: options.duration,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8934 tweens: [],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8935 createTween: function( prop, end ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8936 var tween = jQuery.Tween( elem, animation.opts, prop, end,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8937 animation.opts.specialEasing[ prop ] || animation.opts.easing );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8938 animation.tweens.push( tween );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8939 return tween;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8940 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8941 stop: function( gotoEnd ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8942 var index = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8943 // if we are going to the end, we want to run all the tweens
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8944 // otherwise we skip this part
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8945 length = gotoEnd ? animation.tweens.length : 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8946 if ( stopped ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8947 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8948 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8949 stopped = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8950 for ( ; index < length ; index++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8951 animation.tweens[ index ].run( 1 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8952 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8953
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8954 // resolve when we played the last frame
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8955 // otherwise, reject
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8956 if ( gotoEnd ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8957 deferred.resolveWith( elem, [ animation, gotoEnd ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8958 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8959 deferred.rejectWith( elem, [ animation, gotoEnd ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8960 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8961 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8962 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8963 }),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8964 props = animation.props;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8965
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8966 propFilter( props, animation.opts.specialEasing );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8967
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8968 for ( ; index < length ; index++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8969 result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8970 if ( result ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8971 return result;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8972 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8973 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8974
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8975 jQuery.map( props, createTween, animation );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8976
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8977 if ( jQuery.isFunction( animation.opts.start ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8978 animation.opts.start.call( elem, animation );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8979 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8980
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8981 jQuery.fx.timer(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8982 jQuery.extend( tick, {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8983 elem: elem,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8984 anim: animation,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8985 queue: animation.opts.queue
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8986 })
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8987 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8988
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8989 // attach callbacks from options
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8990 return animation.progress( animation.opts.progress )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8991 .done( animation.opts.done, animation.opts.complete )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8992 .fail( animation.opts.fail )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8993 .always( animation.opts.always );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8994 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8995
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8996 function propFilter( props, specialEasing ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8997 var index, name, easing, value, hooks;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8998
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
8999 // camelCase, specialEasing and expand cssHook pass
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9000 for ( index in props ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9001 name = jQuery.camelCase( index );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9002 easing = specialEasing[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9003 value = props[ index ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9004 if ( jQuery.isArray( value ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9005 easing = value[ 1 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9006 value = props[ index ] = value[ 0 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9007 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9008
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9009 if ( index !== name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9010 props[ name ] = value;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9011 delete props[ index ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9012 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9013
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9014 hooks = jQuery.cssHooks[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9015 if ( hooks && "expand" in hooks ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9016 value = hooks.expand( value );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9017 delete props[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9018
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9019 // not quite $.extend, this wont overwrite keys already present.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9020 // also - reusing 'index' from above because we have the correct "name"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9021 for ( index in value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9022 if ( !( index in props ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9023 props[ index ] = value[ index ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9024 specialEasing[ index ] = easing;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9025 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9026 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9027 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9028 specialEasing[ name ] = easing;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9029 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9030 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9031 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9032
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9033 jQuery.Animation = jQuery.extend( Animation, {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9034
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9035 tweener: function( props, callback ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9036 if ( jQuery.isFunction( props ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9037 callback = props;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9038 props = [ "*" ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9039 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9040 props = props.split(" ");
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9041 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9042
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9043 var prop,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9044 index = 0,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9045 length = props.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9046
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9047 for ( ; index < length ; index++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9048 prop = props[ index ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9049 tweeners[ prop ] = tweeners[ prop ] || [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9050 tweeners[ prop ].unshift( callback );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9051 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9052 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9053
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9054 prefilter: function( callback, prepend ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9055 if ( prepend ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9056 animationPrefilters.unshift( callback );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9057 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9058 animationPrefilters.push( callback );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9059 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9060 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9061 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9062
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9063 function defaultPrefilter( elem, props, opts ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9064 /* jshint validthis: true */
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9065 var prop, value, toggle, tween, hooks, oldfire,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9066 anim = this,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9067 orig = {},
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9068 style = elem.style,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9069 hidden = elem.nodeType && isHidden( elem ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9070 dataShow = jQuery._data( elem, "fxshow" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9071
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9072 // handle queue: false promises
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9073 if ( !opts.queue ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9074 hooks = jQuery._queueHooks( elem, "fx" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9075 if ( hooks.unqueued == null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9076 hooks.unqueued = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9077 oldfire = hooks.empty.fire;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9078 hooks.empty.fire = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9079 if ( !hooks.unqueued ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9080 oldfire();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9081 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9082 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9083 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9084 hooks.unqueued++;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9085
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9086 anim.always(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9087 // doing this makes sure that the complete handler will be called
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9088 // before this completes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9089 anim.always(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9090 hooks.unqueued--;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9091 if ( !jQuery.queue( elem, "fx" ).length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9092 hooks.empty.fire();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9093 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9094 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9095 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9096 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9097
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9098 // height/width overflow pass
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9099 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9100 // Make sure that nothing sneaks out
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9101 // Record all 3 overflow attributes because IE does not
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9102 // change the overflow attribute when overflowX and
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9103 // overflowY are set to the same value
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9104 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9105
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9106 // Set display property to inline-block for height/width
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9107 // animations on inline elements that are having width/height animated
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9108 if ( jQuery.css( elem, "display" ) === "inline" &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9109 jQuery.css( elem, "float" ) === "none" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9110
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9111 // inline-level elements accept inline-block;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9112 // block-level elements need to be inline with layout
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9113 if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9114 style.display = "inline-block";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9115
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9116 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9117 style.zoom = 1;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9118 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9119 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9120 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9121
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9122 if ( opts.overflow ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9123 style.overflow = "hidden";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9124 if ( !jQuery.support.shrinkWrapBlocks ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9125 anim.always(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9126 style.overflow = opts.overflow[ 0 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9127 style.overflowX = opts.overflow[ 1 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9128 style.overflowY = opts.overflow[ 2 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9129 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9130 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9131 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9132
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9133
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9134 // show/hide pass
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9135 for ( prop in props ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9136 value = props[ prop ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9137 if ( rfxtypes.exec( value ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9138 delete props[ prop ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9139 toggle = toggle || value === "toggle";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9140 if ( value === ( hidden ? "hide" : "show" ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9141 continue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9142 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9143 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9144 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9145 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9146
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9147 if ( !jQuery.isEmptyObject( orig ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9148 if ( dataShow ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9149 if ( "hidden" in dataShow ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9150 hidden = dataShow.hidden;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9151 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9152 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9153 dataShow = jQuery._data( elem, "fxshow", {} );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9154 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9155
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9156 // store state if its toggle - enables .stop().toggle() to "reverse"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9157 if ( toggle ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9158 dataShow.hidden = !hidden;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9159 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9160 if ( hidden ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9161 jQuery( elem ).show();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9162 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9163 anim.done(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9164 jQuery( elem ).hide();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9165 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9166 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9167 anim.done(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9168 var prop;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9169 jQuery._removeData( elem, "fxshow" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9170 for ( prop in orig ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9171 jQuery.style( elem, prop, orig[ prop ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9172 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9173 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9174 for ( prop in orig ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9175 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9176
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9177 if ( !( prop in dataShow ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9178 dataShow[ prop ] = tween.start;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9179 if ( hidden ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9180 tween.end = tween.start;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9181 tween.start = prop === "width" || prop === "height" ? 1 : 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9182 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9183 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9184 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9185 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9186 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9187
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9188 function Tween( elem, options, prop, end, easing ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9189 return new Tween.prototype.init( elem, options, prop, end, easing );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9190 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9191 jQuery.Tween = Tween;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9192
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9193 Tween.prototype = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9194 constructor: Tween,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9195 init: function( elem, options, prop, end, easing, unit ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9196 this.elem = elem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9197 this.prop = prop;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9198 this.easing = easing || "swing";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9199 this.options = options;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9200 this.start = this.now = this.cur();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9201 this.end = end;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9202 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9203 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9204 cur: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9205 var hooks = Tween.propHooks[ this.prop ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9206
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9207 return hooks && hooks.get ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9208 hooks.get( this ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9209 Tween.propHooks._default.get( this );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9210 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9211 run: function( percent ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9212 var eased,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9213 hooks = Tween.propHooks[ this.prop ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9214
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9215 if ( this.options.duration ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9216 this.pos = eased = jQuery.easing[ this.easing ](
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9217 percent, this.options.duration * percent, 0, 1, this.options.duration
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9218 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9219 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9220 this.pos = eased = percent;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9221 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9222 this.now = ( this.end - this.start ) * eased + this.start;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9223
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9224 if ( this.options.step ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9225 this.options.step.call( this.elem, this.now, this );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9226 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9227
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9228 if ( hooks && hooks.set ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9229 hooks.set( this );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9230 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9231 Tween.propHooks._default.set( this );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9232 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9233 return this;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9234 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9235 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9236
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9237 Tween.prototype.init.prototype = Tween.prototype;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9238
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9239 Tween.propHooks = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9240 _default: {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9241 get: function( tween ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9242 var result;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9243
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9244 if ( tween.elem[ tween.prop ] != null &&
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9245 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9246 return tween.elem[ tween.prop ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9247 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9248
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9249 // passing an empty string as a 3rd parameter to .css will automatically
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9250 // attempt a parseFloat and fallback to a string if the parse fails
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9251 // so, simple values such as "10px" are parsed to Float.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9252 // complex values such as "rotate(1rad)" are returned as is.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9253 result = jQuery.css( tween.elem, tween.prop, "" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9254 // Empty strings, null, undefined and "auto" are converted to 0.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9255 return !result || result === "auto" ? 0 : result;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9256 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9257 set: function( tween ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9258 // use step hook for back compat - use cssHook if its there - use .style if its
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9259 // available and use plain properties where available
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9260 if ( jQuery.fx.step[ tween.prop ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9261 jQuery.fx.step[ tween.prop ]( tween );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9262 } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9263 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9264 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9265 tween.elem[ tween.prop ] = tween.now;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9266 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9267 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9268 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9269 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9270
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9271 // Support: IE <=9
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9272 // Panic based approach to setting things on disconnected nodes
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9273
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9274 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9275 set: function( tween ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9276 if ( tween.elem.nodeType && tween.elem.parentNode ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9277 tween.elem[ tween.prop ] = tween.now;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9278 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9279 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9280 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9281
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9282 jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9283 var cssFn = jQuery.fn[ name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9284 jQuery.fn[ name ] = function( speed, easing, callback ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9285 return speed == null || typeof speed === "boolean" ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9286 cssFn.apply( this, arguments ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9287 this.animate( genFx( name, true ), speed, easing, callback );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9288 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9289 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9290
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9291 jQuery.fn.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9292 fadeTo: function( speed, to, easing, callback ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9293
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9294 // show any hidden elements after setting opacity to 0
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9295 return this.filter( isHidden ).css( "opacity", 0 ).show()
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9296
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9297 // animate to the value specified
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9298 .end().animate({ opacity: to }, speed, easing, callback );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9299 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9300 animate: function( prop, speed, easing, callback ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9301 var empty = jQuery.isEmptyObject( prop ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9302 optall = jQuery.speed( speed, easing, callback ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9303 doAnimation = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9304 // Operate on a copy of prop so per-property easing won't be lost
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9305 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9306
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9307 // Empty animations, or finishing resolves immediately
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9308 if ( empty || jQuery._data( this, "finish" ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9309 anim.stop( true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9310 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9311 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9312 doAnimation.finish = doAnimation;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9313
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9314 return empty || optall.queue === false ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9315 this.each( doAnimation ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9316 this.queue( optall.queue, doAnimation );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9317 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9318 stop: function( type, clearQueue, gotoEnd ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9319 var stopQueue = function( hooks ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9320 var stop = hooks.stop;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9321 delete hooks.stop;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9322 stop( gotoEnd );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9323 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9324
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9325 if ( typeof type !== "string" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9326 gotoEnd = clearQueue;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9327 clearQueue = type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9328 type = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9329 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9330 if ( clearQueue && type !== false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9331 this.queue( type || "fx", [] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9332 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9333
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9334 return this.each(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9335 var dequeue = true,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9336 index = type != null && type + "queueHooks",
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9337 timers = jQuery.timers,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9338 data = jQuery._data( this );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9339
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9340 if ( index ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9341 if ( data[ index ] && data[ index ].stop ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9342 stopQueue( data[ index ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9343 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9344 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9345 for ( index in data ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9346 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9347 stopQueue( data[ index ] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9348 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9349 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9350 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9351
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9352 for ( index = timers.length; index--; ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9353 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9354 timers[ index ].anim.stop( gotoEnd );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9355 dequeue = false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9356 timers.splice( index, 1 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9357 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9358 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9359
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9360 // start the next in the queue if the last step wasn't forced
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9361 // timers currently will call their complete callbacks, which will dequeue
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9362 // but only if they were gotoEnd
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9363 if ( dequeue || !gotoEnd ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9364 jQuery.dequeue( this, type );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9365 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9366 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9367 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9368 finish: function( type ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9369 if ( type !== false ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9370 type = type || "fx";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9371 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9372 return this.each(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9373 var index,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9374 data = jQuery._data( this ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9375 queue = data[ type + "queue" ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9376 hooks = data[ type + "queueHooks" ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9377 timers = jQuery.timers,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9378 length = queue ? queue.length : 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9379
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9380 // enable finishing flag on private data
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9381 data.finish = true;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9382
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9383 // empty the queue first
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9384 jQuery.queue( this, type, [] );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9385
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9386 if ( hooks && hooks.stop ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9387 hooks.stop.call( this, true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9388 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9389
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9390 // look for any active animations, and finish them
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9391 for ( index = timers.length; index--; ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9392 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9393 timers[ index ].anim.stop( true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9394 timers.splice( index, 1 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9395 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9396 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9397
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9398 // look for any animations in the old queue and finish them
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9399 for ( index = 0; index < length; index++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9400 if ( queue[ index ] && queue[ index ].finish ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9401 queue[ index ].finish.call( this );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9402 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9403 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9404
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9405 // turn off finishing flag
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9406 delete data.finish;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9407 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9408 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9409 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9410
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9411 // Generate parameters to create a standard animation
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9412 function genFx( type, includeWidth ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9413 var which,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9414 attrs = { height: type },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9415 i = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9416
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9417 // if we include width, step value is 1 to do all cssExpand values,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9418 // if we don't include width, step value is 2 to skip over Left and Right
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9419 includeWidth = includeWidth? 1 : 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9420 for( ; i < 4 ; i += 2 - includeWidth ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9421 which = cssExpand[ i ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9422 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9423 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9424
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9425 if ( includeWidth ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9426 attrs.opacity = attrs.width = type;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9427 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9428
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9429 return attrs;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9430 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9431
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9432 // Generate shortcuts for custom animations
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9433 jQuery.each({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9434 slideDown: genFx("show"),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9435 slideUp: genFx("hide"),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9436 slideToggle: genFx("toggle"),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9437 fadeIn: { opacity: "show" },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9438 fadeOut: { opacity: "hide" },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9439 fadeToggle: { opacity: "toggle" }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9440 }, function( name, props ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9441 jQuery.fn[ name ] = function( speed, easing, callback ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9442 return this.animate( props, speed, easing, callback );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9443 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9444 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9445
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9446 jQuery.speed = function( speed, easing, fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9447 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9448 complete: fn || !fn && easing ||
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9449 jQuery.isFunction( speed ) && speed,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9450 duration: speed,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9451 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9452 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9453
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9454 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9455 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9456
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9457 // normalize opt.queue - true/undefined/null -> "fx"
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9458 if ( opt.queue == null || opt.queue === true ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9459 opt.queue = "fx";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9460 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9461
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9462 // Queueing
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9463 opt.old = opt.complete;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9464
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9465 opt.complete = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9466 if ( jQuery.isFunction( opt.old ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9467 opt.old.call( this );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9468 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9469
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9470 if ( opt.queue ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9471 jQuery.dequeue( this, opt.queue );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9472 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9473 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9474
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9475 return opt;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9476 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9477
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9478 jQuery.easing = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9479 linear: function( p ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9480 return p;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9481 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9482 swing: function( p ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9483 return 0.5 - Math.cos( p*Math.PI ) / 2;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9484 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9485 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9486
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9487 jQuery.timers = [];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9488 jQuery.fx = Tween.prototype.init;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9489 jQuery.fx.tick = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9490 var timer,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9491 timers = jQuery.timers,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9492 i = 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9493
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9494 fxNow = jQuery.now();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9495
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9496 for ( ; i < timers.length; i++ ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9497 timer = timers[ i ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9498 // Checks the timer has not already been removed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9499 if ( !timer() && timers[ i ] === timer ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9500 timers.splice( i--, 1 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9501 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9502 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9503
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9504 if ( !timers.length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9505 jQuery.fx.stop();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9506 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9507 fxNow = undefined;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9508 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9509
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9510 jQuery.fx.timer = function( timer ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9511 if ( timer() && jQuery.timers.push( timer ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9512 jQuery.fx.start();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9513 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9514 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9515
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9516 jQuery.fx.interval = 13;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9517
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9518 jQuery.fx.start = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9519 if ( !timerId ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9520 timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9521 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9522 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9523
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9524 jQuery.fx.stop = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9525 clearInterval( timerId );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9526 timerId = null;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9527 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9528
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9529 jQuery.fx.speeds = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9530 slow: 600,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9531 fast: 200,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9532 // Default speed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9533 _default: 400
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9534 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9535
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9536 // Back Compat <1.8 extension point
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9537 jQuery.fx.step = {};
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9538
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9539 if ( jQuery.expr && jQuery.expr.filters ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9540 jQuery.expr.filters.animated = function( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9541 return jQuery.grep(jQuery.timers, function( fn ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9542 return elem === fn.elem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9543 }).length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9544 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9545 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9546 jQuery.fn.offset = function( options ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9547 if ( arguments.length ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9548 return options === undefined ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9549 this :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9550 this.each(function( i ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9551 jQuery.offset.setOffset( this, options, i );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9552 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9553 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9554
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9555 var docElem, win,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9556 box = { top: 0, left: 0 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9557 elem = this[ 0 ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9558 doc = elem && elem.ownerDocument;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9559
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9560 if ( !doc ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9561 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9562 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9563
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9564 docElem = doc.documentElement;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9565
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9566 // Make sure it's not a disconnected DOM node
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9567 if ( !jQuery.contains( docElem, elem ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9568 return box;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9569 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9570
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9571 // If we don't have gBCR, just use 0,0 rather than error
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9572 // BlackBerry 5, iOS 3 (original iPhone)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9573 if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9574 box = elem.getBoundingClientRect();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9575 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9576 win = getWindow( doc );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9577 return {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9578 top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9579 left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9580 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9581 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9582
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9583 jQuery.offset = {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9584
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9585 setOffset: function( elem, options, i ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9586 var position = jQuery.css( elem, "position" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9587
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9588 // set position first, in-case top/left are set even on static elem
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9589 if ( position === "static" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9590 elem.style.position = "relative";
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9591 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9592
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9593 var curElem = jQuery( elem ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9594 curOffset = curElem.offset(),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9595 curCSSTop = jQuery.css( elem, "top" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9596 curCSSLeft = jQuery.css( elem, "left" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9597 calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9598 props = {}, curPosition = {}, curTop, curLeft;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9599
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9600 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9601 if ( calculatePosition ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9602 curPosition = curElem.position();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9603 curTop = curPosition.top;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9604 curLeft = curPosition.left;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9605 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9606 curTop = parseFloat( curCSSTop ) || 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9607 curLeft = parseFloat( curCSSLeft ) || 0;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9608 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9609
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9610 if ( jQuery.isFunction( options ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9611 options = options.call( elem, i, curOffset );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9612 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9613
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9614 if ( options.top != null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9615 props.top = ( options.top - curOffset.top ) + curTop;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9616 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9617 if ( options.left != null ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9618 props.left = ( options.left - curOffset.left ) + curLeft;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9619 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9620
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9621 if ( "using" in options ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9622 options.using.call( elem, props );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9623 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9624 curElem.css( props );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9625 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9626 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9627 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9628
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9629
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9630 jQuery.fn.extend({
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9631
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9632 position: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9633 if ( !this[ 0 ] ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9634 return;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9635 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9636
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9637 var offsetParent, offset,
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9638 parentOffset = { top: 0, left: 0 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9639 elem = this[ 0 ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9640
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9641 // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9642 if ( jQuery.css( elem, "position" ) === "fixed" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9643 // we assume that getBoundingClientRect is available when computed position is fixed
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9644 offset = elem.getBoundingClientRect();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9645 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9646 // Get *real* offsetParent
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9647 offsetParent = this.offsetParent();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9648
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9649 // Get correct offsets
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9650 offset = this.offset();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9651 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9652 parentOffset = offsetParent.offset();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9653 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9654
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9655 // Add offsetParent borders
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9656 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9657 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9658 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9659
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9660 // Subtract parent offsets and element margins
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9661 // note: when an element has margin: auto the offsetLeft and marginLeft
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9662 // are the same in Safari causing offset.left to incorrectly be 0
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9663 return {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9664 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9665 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9666 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9667 },
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9668
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9669 offsetParent: function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9670 return this.map(function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9671 var offsetParent = this.offsetParent || docElem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9672 while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9673 offsetParent = offsetParent.offsetParent;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9674 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9675 return offsetParent || docElem;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9676 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9677 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9678 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9679
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9680
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9681 // Create scrollLeft and scrollTop methods
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9682 jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9683 var top = /Y/.test( prop );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9684
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9685 jQuery.fn[ method ] = function( val ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9686 return jQuery.access( this, function( elem, method, val ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9687 var win = getWindow( elem );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9688
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9689 if ( val === undefined ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9690 return win ? (prop in win) ? win[ prop ] :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9691 win.document.documentElement[ method ] :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9692 elem[ method ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9693 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9694
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9695 if ( win ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9696 win.scrollTo(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9697 !top ? val : jQuery( win ).scrollLeft(),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9698 top ? val : jQuery( win ).scrollTop()
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9699 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9700
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9701 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9702 elem[ method ] = val;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9703 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9704 }, method, val, arguments.length, null );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9705 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9706 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9707
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9708 function getWindow( elem ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9709 return jQuery.isWindow( elem ) ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9710 elem :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9711 elem.nodeType === 9 ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9712 elem.defaultView || elem.parentWindow :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9713 false;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9714 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9715 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9716 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9717 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9718 // margin is only for outerHeight, outerWidth
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9719 jQuery.fn[ funcName ] = function( margin, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9720 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9721 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9722
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9723 return jQuery.access( this, function( elem, type, value ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9724 var doc;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9725
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9726 if ( jQuery.isWindow( elem ) ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9727 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9728 // isn't a whole lot we can do. See pull request at this URL for discussion:
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9729 // https://github.com/jquery/jquery/pull/764
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9730 return elem.document.documentElement[ "client" + name ];
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9731 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9732
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9733 // Get document width or height
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9734 if ( elem.nodeType === 9 ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9735 doc = elem.documentElement;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9736
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9737 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9738 // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9739 return Math.max(
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9740 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9741 elem.body[ "offset" + name ], doc[ "offset" + name ],
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9742 doc[ "client" + name ]
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9743 );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9744 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9745
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9746 return value === undefined ?
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9747 // Get width or height on the element, requesting but not forcing parseFloat
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9748 jQuery.css( elem, type, extra ) :
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9749
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9750 // Set width or height on the element
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9751 jQuery.style( elem, type, value, extra );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9752 }, type, chainable ? margin : undefined, chainable, null );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9753 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9754 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9755 });
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9756 // Limit scope pollution from any deprecated API
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9757 // (function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9758
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9759 // The number of elements contained in the matched element set
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9760 jQuery.fn.size = function() {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9761 return this.length;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9762 };
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9763
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9764 jQuery.fn.andSelf = jQuery.fn.addBack;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9765
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9766 // })();
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9767 if ( typeof module === "object" && module && typeof module.exports === "object" ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9768 // Expose jQuery as module.exports in loaders that implement the Node
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9769 // module pattern (including browserify). Do not create the global, since
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9770 // the user will be storing it themselves locally, and globals are frowned
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9771 // upon in the Node module world.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9772 module.exports = jQuery;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9773 } else {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9774 // Otherwise expose jQuery to the global object as usual
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9775 window.jQuery = window.$ = jQuery;
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9776
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9777 // Register as a named AMD module, since jQuery can be concatenated with other
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9778 // files that may use define, but not via a proper concatenation script that
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9779 // understands anonymous AMD modules. A named AMD is safest and most robust
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9780 // way to register. Lowercase jquery is used because AMD module names are
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9781 // derived from file names, and jQuery is normally delivered in a lowercase
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9782 // file name. Do this after creating the global so that if an AMD module wants
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9783 // to call noConflict to hide this version of jQuery, it will work.
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9784 if ( typeof define === "function" && define.amd ) {
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9785 define( "jquery", [], function () { return jQuery; } );
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9786 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9787 }
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9788
440f4aa3db97 Added option to dowload iReports
saskia-hiltemann
parents:
diff changeset
9789 })( window );