Produced by Araxis Merge on 2/1/2017 2:56:58 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\Araxis_Merge_Comprasion\Pub_un\BTSSS_CIF_122016.zip\BTSSS_CIF_12_20_16\clean\CRM\trunk\SDK\SampleCode\JS\RESTEndpoint\JQueryRESTDataOperations\JQueryRESTDataOperations\Scripts | jquery-1.9.1.js | Tue Dec 20 19:51:48 2016 UTC |
| 2 | Wed Feb 1 19:56:58 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 9657 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /*! | |||||
| 2 | * jQuery J avaSript L ibrary v1. 9.1 | |||||
| 3 | * | |||||
| 4 | * Microsof t grants y ou the rig ht to use these scri pt files f or the sol e purpose of either: (i) inter acting thr ough your browser wi th the Mic rosoft web site, subj ect to the website’s terms of use; or (i i) using t he files a s included with a Mi crosoft pr oduct subj ect to tha t product’ s license terms. Mic rosoft res erves all other righ ts to the files not expressly granted by Microsoft , whether by implica tion, esto ppel or ot herwise. T he notices and licen ses below are for in formationa l purposes only. | |||||
| 5 | ||||||
| 6 | ---------- ---------- Copyright Attributio ns-------- ---------- --------- | |||||
| 7 | ||||||
| 8 | * jQuery J avaScript Library v1 .9.1 | |||||
| 9 | * http://j query.com/ | |||||
| 10 | * | |||||
| 11 | * Includes Sizzle.js | |||||
| 12 | * http://s izzlejs.co m/ | |||||
| 13 | * | |||||
| 14 | * Copyrigh t 2005, 20 12 jQuery Foundation , Inc. and other con tributors | |||||
| 15 | * | |||||
| 16 | * Date: 20 13-2-4 | |||||
| 17 | * | |||||
| 18 | ---------- ------MIT License--- ---------- ---------- ---------- -------- | |||||
| 19 | * | |||||
| 20 | * Provided f or Informa tional Pur poses Only | |||||
| 21 | * MIT Lice nse | |||||
| 22 | * | |||||
| 23 | * Permissi on is here by granted , free of charge, to any perso n obtainin g | |||||
| 24 | * a copy o f this sof tware and associated documenta tion files (the | |||||
| 25 | * "Softwar e"), to de al in the Software w ithout res triction, including | |||||
| 26 | * without limitation the right s to use, copy, modi fy, merge, publish, | |||||
| 27 | * distribu te, sublic ense, and/ or sell co pies of th e Software , and to | |||||
| 28 | * permit p ersons to whom the S oftware is furnished to do so, subject t o | |||||
| 29 | * the foll owing cond itions: | |||||
| 30 | * | |||||
| 31 | * The copy right noti ce and thi s permissi on notice shall be | |||||
| 32 | * included in all co pies or su bstantial portions o f the Soft ware. | |||||
| 33 | * | |||||
| 34 | * THE SOFT WARE IS PR OVIDED "AS IS", WITH OUT WARRAN TY OF ANY KIND, | |||||
| 35 | * EXPRESS OR IMPLIED , INCLUDIN G BUT NOT LIMITED TO THE WARRA NTIES OF | |||||
| 36 | * MERCHANT ABILITY, F ITNESS FOR A PARTICU LAR PURPOS E AND | |||||
| 37 | * NONINFRI NGEMENT. I N NO EVENT SHALL THE AUTHORS O R COPYRIGH T HOLDERS BE | |||||
| 38 | * LIABLE F OR ANY CLA IM, DAMAGE S OR OTHER LIABILITY , WHETHER IN AN ACTI ON | |||||
| 39 | * OF CONTR ACT, TORT OR OTHERWI SE, ARISIN G FROM, OU T OF OR IN CONNECTIO N | |||||
| 40 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS I N THE SOFT WARE. | |||||
| 41 | */ | |||||
| 42 | ||||||
| 43 | ||||||
| 44 | (function( window, u ndefined ) { | |||||
| 45 | ||||||
| 46 | // Can't d o this bec ause sever al apps in cluding AS P.NET trac e | |||||
| 47 | // the sta ck via arg uments.cal ler.callee and Firef ox dies if | |||||
| 48 | // you try to trace through "u se strict" call chai ns. (#1333 5) | |||||
| 49 | // Support : Firefox 18+ | |||||
| 50 | //"use str ict"; | |||||
| 51 | var | |||||
| 52 | // The defer red used o n DOM read y | |||||
| 53 | re adyList, | |||||
| 54 | ||||||
| 55 | // A central reference to the ro ot jQuery( document) | |||||
| 56 | ro otjQuery, | |||||
| 57 | ||||||
| 58 | // Support: IE<9 | |||||
| 59 | // For `type of node.me thod` inst ead of `no de.method !== undefi ned` | |||||
| 60 | co re_strunde fined = ty peof undef ined, | |||||
| 61 | ||||||
| 62 | // Use the c orrect doc ument acco rdingly wi th window argument ( sandbox) | |||||
| 63 | do cument = w indow.docu ment, | |||||
| 64 | lo cation = w indow.loca tion, | |||||
| 65 | ||||||
| 66 | // Map over jQuery in case of ov erwrite | |||||
| 67 | _j Query = wi ndow.jQuer y, | |||||
| 68 | ||||||
| 69 | // Map over the $ in c ase of ove rwrite | |||||
| 70 | _$ = window. $, | |||||
| 71 | ||||||
| 72 | // [[Class]] -> type p airs | |||||
| 73 | cl ass2type = {}, | |||||
| 74 | ||||||
| 75 | // List of d eleted dat a cache id s, so we c an reuse t hem | |||||
| 76 | co re_deleted Ids = [], | |||||
| 77 | ||||||
| 78 | co re_version = "1.9.1" , | |||||
| 79 | ||||||
| 80 | // Save a re ference to some core methods | |||||
| 81 | co re_concat = core_del etedIds.co ncat, | |||||
| 82 | co re_push = core_delet edIds.push , | |||||
| 83 | co re_slice = core_dele tedIds.sli ce, | |||||
| 84 | co re_indexOf = core_de letedIds.i ndexOf, | |||||
| 85 | co re_toStrin g = class2 type.toStr ing, | |||||
| 86 | co re_hasOwn = class2ty pe.hasOwnP roperty, | |||||
| 87 | co re_trim = core_versi on.trim, | |||||
| 88 | ||||||
| 89 | // Define a local copy of jQuery | |||||
| 90 | jQ uery = fun ction( sel ector, con text ) { | |||||
| 91 | // T he jQuery object is actually j ust the in it constru ctor 'enha nced' | |||||
| 92 | retu rn new jQu ery.fn.ini t( selecto r, context , rootjQue ry ); | |||||
| 93 | }, | |||||
| 94 | ||||||
| 95 | // Used for matching n umbers | |||||
| 96 | co re_pnum = /[+-]?(?:\ d*\.|)\d+( ?:[eE][+-] ?\d+|)/.so urce, | |||||
| 97 | ||||||
| 98 | // Used for splitting on whitesp ace | |||||
| 99 | co re_rnotwhi te = /\S+/ g, | |||||
| 100 | ||||||
| 101 | // Make sure we trim B OM and NBS P (here's looking at you, Safa ri 5.0 and IE) | |||||
| 102 | rt rim = /^[\ s\uFEFF\xA 0]+|[\s\uF EFF\xA0]+$ /g, | |||||
| 103 | ||||||
| 104 | // A simple way to che ck for HTM L strings | |||||
| 105 | // Prioritiz e #id over <tag> to avoid XSS via locati on.hash (# 9521) | |||||
| 106 | // Strict HT ML recogni tion (#112 90: must s tart with <) | |||||
| 107 | rq uickExpr = /^(?:(<[\ w\W]+>)[^> ]*|#([\w-] *))$/, | |||||
| 108 | ||||||
| 109 | // Match a s tandalone tag | |||||
| 110 | rs ingleTag = /^<(\w+)\ s*\/?>(?:< \/\1>|)$/, | |||||
| 111 | ||||||
| 112 | // JSON RegE xp | |||||
| 113 | rv alidchars = /^[\],:{ }\s]*$/, | |||||
| 114 | rv alidbraces = /(?:^|: |,)(?:\s*\ [)+/g, | |||||
| 115 | rv alidescape = /\\(?:[ "\\\/bfnrt ]|u[\da-fA -F]{4})/g, | |||||
| 116 | rv alidtokens = /"[^"\\ \r\n]*"|tr ue|false|n ull|-?(?:\ d+\.|)\d+( ?:[eE][+-] ?\d+|)/g, | |||||
| 117 | ||||||
| 118 | // Matches d ashed stri ng for cam elizing | |||||
| 119 | rm sPrefix = /^-ms-/, | |||||
| 120 | rd ashAlpha = /-([\da-z ])/gi, | |||||
| 121 | ||||||
| 122 | // Used by j Query.came lCase as c allback to replace() | |||||
| 123 | fc amelCase = function( all, lett er ) { | |||||
| 124 | retu rn letter. toUpperCas e(); | |||||
| 125 | }, | |||||
| 126 | ||||||
| 127 | // The ready event han dler | |||||
| 128 | co mpleted = function( event ) { | |||||
| 129 | ||||||
| 130 | // r eadyState === "compl ete" is go od enough for us to call the d om ready i n oldIE | |||||
| 131 | if ( document. addEventLi stener || event.type === "load " || docum ent.readyS tate === " complete" ) { | |||||
| 132 | detach (); | |||||
| 133 | jQuery .ready(); | |||||
| 134 | } | |||||
| 135 | }, | |||||
| 136 | // Clean-up method for dom ready events | |||||
| 137 | de tach = fun ction() { | |||||
| 138 | if ( document. addEventLi stener ) { | |||||
| 139 | docume nt.removeE ventListen er( "DOMCo ntentLoade d", comple ted, false ); | |||||
| 140 | window .removeEve ntListener ( "load", completed, false ); | |||||
| 141 | ||||||
| 142 | } el se { | |||||
| 143 | docume nt.detachE vent( "onr eadystatec hange", co mpleted ); | |||||
| 144 | window .detachEve nt( "onloa d", comple ted ); | |||||
| 145 | } | |||||
| 146 | }; | |||||
| 147 | ||||||
| 148 | jQuery.fn = jQuery.p rototype = { | |||||
| 149 | // The curre nt version of jQuery being use d | |||||
| 150 | jq uery: core _version, | |||||
| 151 | ||||||
| 152 | co nstructor: jQuery, | |||||
| 153 | in it: functi on( select or, contex t, rootjQu ery ) { | |||||
| 154 | var match, ele m; | |||||
| 155 | ||||||
| 156 | // H ANDLE: $(" "), $(null ), $(undef ined), $(f alse) | |||||
| 157 | if ( !selector ) { | |||||
| 158 | return this; | |||||
| 159 | } | |||||
| 160 | ||||||
| 161 | // H andle HTML strings | |||||
| 162 | if ( typeof se lector === "string" ) { | |||||
| 163 | if ( s elector.ch arAt(0) == = "<" && s elector.ch arAt( sele ctor.lengt h - 1 ) == = ">" && s elector.le ngth >= 3 ) { | |||||
| 164 | // Assum e that str ings that start and end with < > are HTML and skip the regex check | |||||
| 165 | match = [ null, se lector, nu ll ]; | |||||
| 166 | ||||||
| 167 | } else { | |||||
| 168 | match = rquickExpr .exec( sel ector ); | |||||
| 169 | } | |||||
| 170 | ||||||
| 171 | // Mat ch html or make sure no contex t is speci fied for # id | |||||
| 172 | if ( m atch && (m atch[1] || !context) ) { | |||||
| 173 | ||||||
| 174 | // HANDL E: $(html) -> $(arra y) | |||||
| 175 | if ( mat ch[1] ) { | |||||
| 176 | context = context in stanceof j Query ? co ntext[0] : context; | |||||
| 177 | ||||||
| 178 | // scripts is true f or back-co mpat | |||||
| 179 | jQuery.mer ge( this, jQuery.par seHTML( | |||||
| 180 | ma tch[1], | |||||
| 181 | co ntext && c ontext.nod eType ? co ntext.owne rDocument || context : documen t, | |||||
| 182 | tr ue | |||||
| 183 | ) ); | |||||
| 184 | ||||||
| 185 | // HANDLE: $(html, p rops) | |||||
| 186 | if ( rsing leTag.test ( match[1] ) && jQue ry.isPlain Object( co ntext ) ) { | |||||
| 187 | fo r ( match in context ) { | |||||
| 188 | // P roperties of context are calle d as metho ds if poss ible | |||||
| 189 | if ( jQuery.is Function( this[ matc h ] ) ) { | |||||
| 190 | this[ match ]( c ontext[ ma tch ] ); | |||||
| 191 | ||||||
| 192 | // . ..and othe rwise set as attribu tes | |||||
| 193 | } el se { | |||||
| 194 | this.a ttr( match , context[ match ] ) ; | |||||
| 195 | } | |||||
| 196 | } | |||||
| 197 | } | |||||
| 198 | ||||||
| 199 | return thi s; | |||||
| 200 | ||||||
| 201 | // HANDL E: $(#id) | |||||
| 202 | } else { | |||||
| 203 | elem = doc ument.getE lementById ( match[2] ); | |||||
| 204 | ||||||
| 205 | // Check p arentNode to catch w hen Blackb erry 4.6 r eturns | |||||
| 206 | // nodes t hat are no longer in the docum ent #6963 | |||||
| 207 | if ( elem && elem.pa rentNode ) { | |||||
| 208 | // Handle th e case whe re IE and Opera retu rn items | |||||
| 209 | // by name i nstead of ID | |||||
| 210 | if ( elem.id !== match [2] ) { | |||||
| 211 | retu rn rootjQu ery.find( selector ) ; | |||||
| 212 | } | |||||
| 213 | ||||||
| 214 | // Otherwise , we injec t the elem ent direct ly into th e jQuery o bject | |||||
| 215 | th is.length = 1; | |||||
| 216 | th is[0] = el em; | |||||
| 217 | } | |||||
| 218 | ||||||
| 219 | this.conte xt = docum ent; | |||||
| 220 | this.selec tor = sele ctor; | |||||
| 221 | return thi s; | |||||
| 222 | } | |||||
| 223 | ||||||
| 224 | // HAN DLE: $(exp r, $(...)) | |||||
| 225 | } else if ( !con text || co ntext.jque ry ) { | |||||
| 226 | return ( context | | rootjQue ry ).find( selector ); | |||||
| 227 | ||||||
| 228 | // HAN DLE: $(exp r, context ) | |||||
| 229 | // (wh ich is jus t equivale nt to: $(c ontext).fi nd(expr) | |||||
| 230 | } else { | |||||
| 231 | return t his.constr uctor( con text ).fin d( selecto r ); | |||||
| 232 | } | |||||
| 233 | ||||||
| 234 | // H ANDLE: $(D OMElement) | |||||
| 235 | } el se if ( se lector.nod eType ) { | |||||
| 236 | this.c ontext = t his[0] = s elector; | |||||
| 237 | this.l ength = 1; | |||||
| 238 | return this; | |||||
| 239 | ||||||
| 240 | // H ANDLE: $(f unction) | |||||
| 241 | // S hortcut fo r document ready | |||||
| 242 | } el se if ( jQ uery.isFun ction( sel ector ) ) { | |||||
| 243 | return rootjQuer y.ready( s elector ); | |||||
| 244 | } | |||||
| 245 | ||||||
| 246 | if ( selector. selector ! == undefin ed ) { | |||||
| 247 | this.s elector = selector.s elector; | |||||
| 248 | this.c ontext = s elector.co ntext; | |||||
| 249 | } | |||||
| 250 | ||||||
| 251 | retu rn jQuery. makeArray( selector, this ); | |||||
| 252 | }, | |||||
| 253 | ||||||
| 254 | // Start wit h an empty selector | |||||
| 255 | se lector: "" , | |||||
| 256 | ||||||
| 257 | // The defau lt length of a jQuer y object i s 0 | |||||
| 258 | le ngth: 0, | |||||
| 259 | ||||||
| 260 | // The numbe r of eleme nts contai ned in the matched e lement set | |||||
| 261 | si ze: functi on() { | |||||
| 262 | retu rn this.le ngth; | |||||
| 263 | }, | |||||
| 264 | ||||||
| 265 | to Array: fun ction() { | |||||
| 266 | retu rn core_sl ice.call( this ); | |||||
| 267 | }, | |||||
| 268 | ||||||
| 269 | // Get the N th element in the ma tched elem ent set OR | |||||
| 270 | // Get the w hole match ed element set as a clean arra y | |||||
| 271 | ge t: functio n( num ) { | |||||
| 272 | retu rn num == null ? | |||||
| 273 | ||||||
| 274 | // Ret urn a 'cle an' array | |||||
| 275 | this.t oArray() : | |||||
| 276 | ||||||
| 277 | // Ret urn just t he object | |||||
| 278 | ( num < 0 ? this [ this.len gth + num ] : this[ num ] ); | |||||
| 279 | }, | |||||
| 280 | ||||||
| 281 | // Take an a rray of el ements and push it o nto the st ack | |||||
| 282 | // (returnin g the new matched el ement set) | |||||
| 283 | pu shStack: f unction( e lems ) { | |||||
| 284 | ||||||
| 285 | // B uild a new jQuery ma tched elem ent set | |||||
| 286 | var ret = jQue ry.merge( this.const ructor(), elems ); | |||||
| 287 | ||||||
| 288 | // A dd the old object on to the sta ck (as a r eference) | |||||
| 289 | ret. prevObject = this; | |||||
| 290 | ret. context = this.conte xt; | |||||
| 291 | ||||||
| 292 | // R eturn the newly-form ed element set | |||||
| 293 | retu rn ret; | |||||
| 294 | }, | |||||
| 295 | ||||||
| 296 | // Execute a callback for every element in the match ed set. | |||||
| 297 | // (You can seed the a rguments w ith an arr ay of args , but this is | |||||
| 298 | // only used internall y.) | |||||
| 299 | ea ch: functi on( callba ck, args ) { | |||||
| 300 | retu rn jQuery. each( this , callback , args ); | |||||
| 301 | }, | |||||
| 302 | ||||||
| 303 | re ady: funct ion( fn ) { | |||||
| 304 | // A dd the cal lback | |||||
| 305 | jQue ry.ready.p romise().d one( fn ); | |||||
| 306 | ||||||
| 307 | retu rn this; | |||||
| 308 | }, | |||||
| 309 | ||||||
| 310 | sl ice: funct ion() { | |||||
| 311 | retu rn this.pu shStack( c ore_slice. apply( thi s, argumen ts ) ); | |||||
| 312 | }, | |||||
| 313 | ||||||
| 314 | fi rst: funct ion() { | |||||
| 315 | retu rn this.eq ( 0 ); | |||||
| 316 | }, | |||||
| 317 | ||||||
| 318 | la st: functi on() { | |||||
| 319 | retu rn this.eq ( -1 ); | |||||
| 320 | }, | |||||
| 321 | ||||||
| 322 | eq : function ( i ) { | |||||
| 323 | var len = this .length, | |||||
| 324 | j = +i + ( i < 0 ? len : 0 ); | |||||
| 325 | retu rn this.pu shStack( j >= 0 && j < len ? [ this[j] ] : [] ); | |||||
| 326 | }, | |||||
| 327 | ||||||
| 328 | ma p: functio n( callbac k ) { | |||||
| 329 | retu rn this.pu shStack( j Query.map( this, func tion( elem , i ) { | |||||
| 330 | return callback. call( elem , i, elem ); | |||||
| 331 | })); | |||||
| 332 | }, | |||||
| 333 | ||||||
| 334 | en d: functio n() { | |||||
| 335 | retu rn this.pr evObject | | this.con structor(n ull); | |||||
| 336 | }, | |||||
| 337 | ||||||
| 338 | // For inter nal use on ly. | |||||
| 339 | // Behaves l ike an Arr ay's metho d, not lik e a jQuery method. | |||||
| 340 | pu sh: core_p ush, | |||||
| 341 | so rt: [].sor t, | |||||
| 342 | sp lice: [].s plice | |||||
| 343 | }; | |||||
| 344 | ||||||
| 345 | // Give th e init fun ction the jQuery pro totype for later ins tantiation | |||||
| 346 | jQuery.fn. init.proto type = jQu ery.fn; | |||||
| 347 | ||||||
| 348 | jQuery.ext end = jQue ry.fn.exte nd = funct ion() { | |||||
| 349 | va r src, cop yIsArray, copy, name , options, clone, | |||||
| 350 | targ et = argum ents[0] || {}, | |||||
| 351 | i = 1, | |||||
| 352 | leng th = argum ents.lengt h, | |||||
| 353 | deep = false; | |||||
| 354 | ||||||
| 355 | // Handle a deep copy situation | |||||
| 356 | if ( typeof target === "boolean" ) { | |||||
| 357 | deep = target; | |||||
| 358 | targ et = argum ents[1] || {}; | |||||
| 359 | // s kip the bo olean and the target | |||||
| 360 | i = 2; | |||||
| 361 | } | |||||
| 362 | ||||||
| 363 | // Handle ca se when ta rget is a string or something (possible in deep co py) | |||||
| 364 | if ( typeof target !== "object" && !jQuery .isFunctio n(target) ) { | |||||
| 365 | targ et = {}; | |||||
| 366 | } | |||||
| 367 | ||||||
| 368 | // extend jQ uery itsel f if only one argume nt is pass ed | |||||
| 369 | if ( length === i ) { | |||||
| 370 | targ et = this; | |||||
| 371 | --i; | |||||
| 372 | } | |||||
| 373 | ||||||
| 374 | fo r ( ; i < length; i+ + ) { | |||||
| 375 | // O nly deal w ith non-nu ll/undefin ed values | |||||
| 376 | if ( (options = argument s[ i ]) != null ) { | |||||
| 377 | // Ext end the ba se object | |||||
| 378 | for ( name in op tions ) { | |||||
| 379 | src = ta rget[ name ]; | |||||
| 380 | copy = o ptions[ na me ]; | |||||
| 381 | ||||||
| 382 | // Preve nt never-e nding loop | |||||
| 383 | if ( tar get === co py ) { | |||||
| 384 | continue; | |||||
| 385 | } | |||||
| 386 | ||||||
| 387 | // Recur se if we'r e merging plain obje cts or arr ays | |||||
| 388 | if ( dee p && copy && ( jQuer y.isPlainO bject(copy ) || (copy IsArray = jQuery.isA rray(copy) ) ) ) { | |||||
| 389 | if ( copyI sArray ) { | |||||
| 390 | co pyIsArray = false; | |||||
| 391 | cl one = src && jQuery. isArray(sr c) ? src : []; | |||||
| 392 | ||||||
| 393 | } else { | |||||
| 394 | cl one = src && jQuery. isPlainObj ect(src) ? src : {}; | |||||
| 395 | } | |||||
| 396 | ||||||
| 397 | // Never m ove origin al objects , clone th em | |||||
| 398 | target[ na me ] = jQu ery.extend ( deep, cl one, copy ); | |||||
| 399 | ||||||
| 400 | // Don't bring in undefined values | |||||
| 401 | } else i f ( copy ! == undefin ed ) { | |||||
| 402 | target[ na me ] = cop y; | |||||
| 403 | } | |||||
| 404 | } | |||||
| 405 | } | |||||
| 406 | } | |||||
| 407 | ||||||
| 408 | // Return th e modified object | |||||
| 409 | re turn targe t; | |||||
| 410 | }; | |||||
| 411 | ||||||
| 412 | jQuery.ext end({ | |||||
| 413 | no Conflict: function( deep ) { | |||||
| 414 | if ( window.$ === jQuery ) { | |||||
| 415 | window .$ = _$; | |||||
| 416 | } | |||||
| 417 | ||||||
| 418 | if ( deep && w indow.jQue ry === jQu ery ) { | |||||
| 419 | window .jQuery = _jQuery; | |||||
| 420 | } | |||||
| 421 | ||||||
| 422 | retu rn jQuery; | |||||
| 423 | }, | |||||
| 424 | ||||||
| 425 | // Is the DO M ready to be used? Set to tru e once it occurs. | |||||
| 426 | is Ready: fal se, | |||||
| 427 | ||||||
| 428 | // A counter to track how many i tems to wa it for bef ore | |||||
| 429 | // the ready event fir es. See #6 781 | |||||
| 430 | re adyWait: 1 , | |||||
| 431 | ||||||
| 432 | // Hold (or release) t he ready e vent | |||||
| 433 | ho ldReady: f unction( h old ) { | |||||
| 434 | if ( hold ) { | |||||
| 435 | jQuery .readyWait ++; | |||||
| 436 | } el se { | |||||
| 437 | jQuery .ready( tr ue ); | |||||
| 438 | } | |||||
| 439 | }, | |||||
| 440 | ||||||
| 441 | // Handle wh en the DOM is ready | |||||
| 442 | re ady: funct ion( wait ) { | |||||
| 443 | ||||||
| 444 | // A bort if th ere are pe nding hold s or we're already r eady | |||||
| 445 | if ( wait === true ? --j Query.read yWait : jQ uery.isRea dy ) { | |||||
| 446 | return ; | |||||
| 447 | } | |||||
| 448 | ||||||
| 449 | // M ake sure b ody exists , at least , in case IE gets a little ove rzealous ( ticket #54 43). | |||||
| 450 | if ( !document .body ) { | |||||
| 451 | return setTimeou t( jQuery. ready ); | |||||
| 452 | } | |||||
| 453 | ||||||
| 454 | // R emember th at the DOM is ready | |||||
| 455 | jQue ry.isReady = true; | |||||
| 456 | ||||||
| 457 | // I f a normal DOM Ready event fir ed, decrem ent, and w ait if nee d be | |||||
| 458 | if ( wait !== true && -- jQuery.rea dyWait > 0 ) { | |||||
| 459 | return ; | |||||
| 460 | } | |||||
| 461 | ||||||
| 462 | // I f there ar e function s bound, t o execute | |||||
| 463 | read yList.reso lveWith( d ocument, [ jQuery ] ); | |||||
| 464 | ||||||
| 465 | // T rigger any bound rea dy events | |||||
| 466 | if ( jQuery.fn .trigger ) { | |||||
| 467 | jQuery ( document ).trigger ("ready"). off("ready "); | |||||
| 468 | } | |||||
| 469 | }, | |||||
| 470 | ||||||
| 471 | // See test/ unit/core. js for det ails conce rning isFu nction. | |||||
| 472 | // Since ver sion 1.3, DOM method s and func tions like alert | |||||
| 473 | // aren't su pported. T hey return false on IE (#2968) . | |||||
| 474 | is Function: function( obj ) { | |||||
| 475 | retu rn jQuery. type(obj) === "funct ion"; | |||||
| 476 | }, | |||||
| 477 | ||||||
| 478 | is Array: Arr ay.isArray || functi on( obj ) { | |||||
| 479 | retu rn jQuery. type(obj) === "array "; | |||||
| 480 | }, | |||||
| 481 | ||||||
| 482 | is Window: fu nction( ob j ) { | |||||
| 483 | retu rn obj != null && ob j == obj.w indow; | |||||
| 484 | }, | |||||
| 485 | ||||||
| 486 | is Numeric: f unction( o bj ) { | |||||
| 487 | retu rn !isNaN( parseFloa t(obj) ) & & isFinite ( obj ); | |||||
| 488 | }, | |||||
| 489 | ||||||
| 490 | ty pe: functi on( obj ) { | |||||
| 491 | if ( obj == nu ll ) { | |||||
| 492 | return String( o bj ); | |||||
| 493 | } | |||||
| 494 | retu rn typeof obj === "o bject" || typeof obj === "func tion" ? | |||||
| 495 | class2 type[ core _toString. call(obj) ] || "obje ct" : | |||||
| 496 | typeof obj; | |||||
| 497 | }, | |||||
| 498 | ||||||
| 499 | is PlainObjec t: functio n( obj ) { | |||||
| 500 | // M ust be an Object. | |||||
| 501 | // B ecause of IE, we als o have to check the presence o f the cons tructor pr operty. | |||||
| 502 | // M ake sure t hat DOM no des and wi ndow objec ts don't p ass throug h, as well | |||||
| 503 | if ( !obj || j Query.type (obj) !== "object" | | obj.node Type || jQ uery.isWin dow( obj ) ) { | |||||
| 504 | return false; | |||||
| 505 | } | |||||
| 506 | ||||||
| 507 | try { | |||||
| 508 | // Not own const ructor pro perty must be Object | |||||
| 509 | if ( o bj.constru ctor && | |||||
| 510 | !core_ha sOwn.call( obj, "cons tructor") && | |||||
| 511 | !core_ha sOwn.call( obj.constr uctor.prot otype, "is PrototypeO f") ) { | |||||
| 512 | return f alse; | |||||
| 513 | } | |||||
| 514 | } ca tch ( e ) { | |||||
| 515 | // IE8 ,9 Will th row except ions on ce rtain host objects # 9897 | |||||
| 516 | return false; | |||||
| 517 | } | |||||
| 518 | ||||||
| 519 | // O wn propert ies are en umerated f irstly, so to speed up, | |||||
| 520 | // i f last one is own, t hen all pr operties a re own. | |||||
| 521 | ||||||
| 522 | var key; | |||||
| 523 | for ( key in o bj ) {} | |||||
| 524 | ||||||
| 525 | retu rn key === undefined || core_h asOwn.call ( obj, key ); | |||||
| 526 | }, | |||||
| 527 | ||||||
| 528 | is EmptyObjec t: functio n( obj ) { | |||||
| 529 | var name; | |||||
| 530 | for ( name in obj ) { | |||||
| 531 | return false; | |||||
| 532 | } | |||||
| 533 | retu rn true; | |||||
| 534 | }, | |||||
| 535 | ||||||
| 536 | er ror: funct ion( msg ) { | |||||
| 537 | thro w new Erro r( msg ); | |||||
| 538 | }, | |||||
| 539 | ||||||
| 540 | // data: str ing of htm l | |||||
| 541 | // context ( optional): If specif ied, the f ragment wi ll be crea ted in thi s context, defaults to documen t | |||||
| 542 | // keepScrip ts (option al): If tr ue, will i nclude scr ipts passe d in the h tml string | |||||
| 543 | pa rseHTML: f unction( d ata, conte xt, keepSc ripts ) { | |||||
| 544 | if ( !data || typeof dat a !== "str ing" ) { | |||||
| 545 | return null; | |||||
| 546 | } | |||||
| 547 | if ( typeof co ntext === "boolean" ) { | |||||
| 548 | keepSc ripts = co ntext; | |||||
| 549 | contex t = false; | |||||
| 550 | } | |||||
| 551 | cont ext = cont ext || doc ument; | |||||
| 552 | ||||||
| 553 | var parsed = r singleTag. exec( data ), | |||||
| 554 | script s = !keepS cripts && []; | |||||
| 555 | ||||||
| 556 | // S ingle tag | |||||
| 557 | if ( parsed ) { | |||||
| 558 | return [ context .createEle ment( pars ed[1] ) ]; | |||||
| 559 | } | |||||
| 560 | ||||||
| 561 | pars ed = jQuer y.buildFra gment( [ d ata ], con text, scri pts ); | |||||
| 562 | if ( scripts ) { | |||||
| 563 | jQuery ( scripts ).remove() ; | |||||
| 564 | } | |||||
| 565 | retu rn jQuery. merge( [], parsed.ch ildNodes ) ; | |||||
| 566 | }, | |||||
| 567 | ||||||
| 568 | pa rseJSON: f unction( d ata ) { | |||||
| 569 | // A ttempt to parse usin g the nati ve JSON pa rser first | |||||
| 570 | if ( window.JS ON && wind ow.JSON.pa rse ) { | |||||
| 571 | return window.JS ON.parse( data ); | |||||
| 572 | } | |||||
| 573 | ||||||
| 574 | if ( data === null ) { | |||||
| 575 | return data; | |||||
| 576 | } | |||||
| 577 | ||||||
| 578 | if ( typeof da ta === "st ring" ) { | |||||
| 579 | ||||||
| 580 | // Mak e sure lea ding/trail ing whites pace is re moved (IE can't hand le it) | |||||
| 581 | data = jQuery.tr im( data ) ; | |||||
| 582 | ||||||
| 583 | if ( d ata ) { | |||||
| 584 | // Make sure the i ncoming da ta is actu al JSON | |||||
| 585 | // Logic borrowed from http: //json.org /json2.js | |||||
| 586 | if ( rva lidchars.t est( data. replace( r validescap e, "@" ) | |||||
| 587 | .replace( rvalidtoke ns, "]" ) | |||||
| 588 | .replace( rvalidbrac es, "")) ) { | |||||
| 589 | ||||||
| 590 | return ( n ew Functio n( "return " + data ) )(); | |||||
| 591 | } | |||||
| 592 | } | |||||
| 593 | } | |||||
| 594 | ||||||
| 595 | jQue ry.error( "Invalid J SON: " + d ata ); | |||||
| 596 | }, | |||||
| 597 | ||||||
| 598 | // Cross-bro wser xml p arsing | |||||
| 599 | pa rseXML: fu nction( da ta ) { | |||||
| 600 | var xml, tmp; | |||||
| 601 | if ( !data || typeof dat a !== "str ing" ) { | |||||
| 602 | return null; | |||||
| 603 | } | |||||
| 604 | try { | |||||
| 605 | if ( w indow.DOMP arser ) { // Standar d | |||||
| 606 | tmp = ne w DOMParse r(); | |||||
| 607 | xml = tm p.parseFro mString( d ata , "tex t/xml" ); | |||||
| 608 | } else { // IE | |||||
| 609 | xml = ne w ActiveXO bject( "Mi crosoft.XM LDOM" ); | |||||
| 610 | xml.asyn c = "false "; | |||||
| 611 | xml.load XML( data ); | |||||
| 612 | } | |||||
| 613 | } ca tch( e ) { | |||||
| 614 | xml = undefined; | |||||
| 615 | } | |||||
| 616 | if ( !xml || ! xml.docume ntElement || xml.get ElementsBy TagName( " parsererro r" ).lengt h ) { | |||||
| 617 | jQuery .error( "I nvalid XML : " + data ); | |||||
| 618 | } | |||||
| 619 | retu rn xml; | |||||
| 620 | }, | |||||
| 621 | ||||||
| 622 | no op: functi on() {}, | |||||
| 623 | ||||||
| 624 | // Evaluates a script in a globa l context | |||||
| 625 | // Workaroun ds based o n findings by Jim Dr iscoll | |||||
| 626 | // http://we blogs.java .net/blog/ driscoll/a rchive/200 9/09/08/ev al-javascr ipt-global -context | |||||
| 627 | gl obalEval: function( data ) { | |||||
| 628 | if ( data && j Query.trim ( data ) ) { | |||||
| 629 | // We use execSc ript on In ternet Exp lorer | |||||
| 630 | // We use an ano nymous fun ction so t hat contex t is windo w | |||||
| 631 | // rat her than j Query in F irefox | |||||
| 632 | ( wind ow.execScr ipt || fun ction( dat a ) { | |||||
| 633 | window[ "eval" ].c all( windo w, data ); | |||||
| 634 | } )( d ata ); | |||||
| 635 | } | |||||
| 636 | }, | |||||
| 637 | ||||||
| 638 | // Convert d ashed to c amelCase; used by th e css and data modul es | |||||
| 639 | // Microsoft forgot to hump thei r vendor p refix (#95 72) | |||||
| 640 | ca melCase: f unction( s tring ) { | |||||
| 641 | retu rn string. replace( r msPrefix, "ms-" ).re place( rda shAlpha, f camelCase ); | |||||
| 642 | }, | |||||
| 643 | ||||||
| 644 | no deName: fu nction( el em, name ) { | |||||
| 645 | retu rn elem.no deName && elem.nodeN ame.toLowe rCase() == = name.toL owerCase() ; | |||||
| 646 | }, | |||||
| 647 | ||||||
| 648 | // args is f or interna l usage on ly | |||||
| 649 | ea ch: functi on( obj, c allback, a rgs ) { | |||||
| 650 | var value, | |||||
| 651 | i = 0, | |||||
| 652 | length = obj.len gth, | |||||
| 653 | isArra y = isArra ylike( obj ); | |||||
| 654 | ||||||
| 655 | if ( args ) { | |||||
| 656 | if ( i sArray ) { | |||||
| 657 | for ( ; i < length ; i++ ) { | |||||
| 658 | value = ca llback.app ly( obj[ i ], args ) ; | |||||
| 659 | ||||||
| 660 | if ( value === false ) { | |||||
| 661 | br eak; | |||||
| 662 | } | |||||
| 663 | } | |||||
| 664 | } else { | |||||
| 665 | for ( i in obj ) { | |||||
| 666 | value = ca llback.app ly( obj[ i ], args ) ; | |||||
| 667 | ||||||
| 668 | if ( value === false ) { | |||||
| 669 | br eak; | |||||
| 670 | } | |||||
| 671 | } | |||||
| 672 | } | |||||
| 673 | ||||||
| 674 | // A special, fast, case for the m ost common use of ea ch | |||||
| 675 | } el se { | |||||
| 676 | if ( i sArray ) { | |||||
| 677 | for ( ; i < length ; i++ ) { | |||||
| 678 | value = ca llback.cal l( obj[ i ], i, obj[ i ] ); | |||||
| 679 | ||||||
| 680 | if ( value === false ) { | |||||
| 681 | br eak; | |||||
| 682 | } | |||||
| 683 | } | |||||
| 684 | } else { | |||||
| 685 | for ( i in obj ) { | |||||
| 686 | value = ca llback.cal l( obj[ i ], i, obj[ i ] ); | |||||
| 687 | ||||||
| 688 | if ( value === false ) { | |||||
| 689 | br eak; | |||||
| 690 | } | |||||
| 691 | } | |||||
| 692 | } | |||||
| 693 | } | |||||
| 694 | ||||||
| 695 | retu rn obj; | |||||
| 696 | }, | |||||
| 697 | ||||||
| 698 | // Use nativ e String.t rim functi on whereve r possible | |||||
| 699 | tr im: core_t rim && !co re_trim.ca ll("\uFEFF \xA0") ? | |||||
| 700 | func tion( text ) { | |||||
| 701 | return text == n ull ? | |||||
| 702 | "" : | |||||
| 703 | core_tri m.call( te xt ); | |||||
| 704 | } : | |||||
| 705 | ||||||
| 706 | // O therwise u se our own trimming functional ity | |||||
| 707 | func tion( text ) { | |||||
| 708 | return text == n ull ? | |||||
| 709 | "" : | |||||
| 710 | ( text + "" ).repl ace( rtrim , "" ); | |||||
| 711 | }, | |||||
| 712 | ||||||
| 713 | // results i s for inte rnal usage only | |||||
| 714 | ma keArray: f unction( a rr, result s ) { | |||||
| 715 | var ret = resu lts || []; | |||||
| 716 | ||||||
| 717 | if ( arr != nu ll ) { | |||||
| 718 | if ( i sArraylike ( Object(a rr) ) ) { | |||||
| 719 | jQuery.m erge( ret, | |||||
| 720 | typeof arr === "stri ng" ? | |||||
| 721 | [ arr ] : arr | |||||
| 722 | ); | |||||
| 723 | } else { | |||||
| 724 | core_pus h.call( re t, arr ); | |||||
| 725 | } | |||||
| 726 | } | |||||
| 727 | ||||||
| 728 | retu rn ret; | |||||
| 729 | }, | |||||
| 730 | ||||||
| 731 | in Array: fun ction( ele m, arr, i ) { | |||||
| 732 | var len; | |||||
| 733 | ||||||
| 734 | if ( arr ) { | |||||
| 735 | if ( c ore_indexO f ) { | |||||
| 736 | return c ore_indexO f.call( ar r, elem, i ); | |||||
| 737 | } | |||||
| 738 | ||||||
| 739 | len = arr.length ; | |||||
| 740 | i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0 ; | |||||
| 741 | ||||||
| 742 | for ( ; i < len; i++ ) { | |||||
| 743 | // Skip accessing in sparse arrays | |||||
| 744 | if ( i i n arr && a rr[ i ] == = elem ) { | |||||
| 745 | return i; | |||||
| 746 | } | |||||
| 747 | } | |||||
| 748 | } | |||||
| 749 | ||||||
| 750 | retu rn -1; | |||||
| 751 | }, | |||||
| 752 | ||||||
| 753 | me rge: funct ion( first , second ) { | |||||
| 754 | var l = second .length, | |||||
| 755 | i = fi rst.length , | |||||
| 756 | j = 0; | |||||
| 757 | ||||||
| 758 | if ( typeof l === "numbe r" ) { | |||||
| 759 | for ( ; j < l; j ++ ) { | |||||
| 760 | first[ i ++ ] = sec ond[ j ]; | |||||
| 761 | } | |||||
| 762 | } el se { | |||||
| 763 | while ( second[j ] !== unde fined ) { | |||||
| 764 | first[ i ++ ] = sec ond[ j++ ] ; | |||||
| 765 | } | |||||
| 766 | } | |||||
| 767 | ||||||
| 768 | firs t.length = i; | |||||
| 769 | ||||||
| 770 | retu rn first; | |||||
| 771 | }, | |||||
| 772 | ||||||
| 773 | gr ep: functi on( elems, callback, inv ) { | |||||
| 774 | var retVal, | |||||
| 775 | ret = [], | |||||
| 776 | i = 0, | |||||
| 777 | length = elems.l ength; | |||||
| 778 | inv = !!inv; | |||||
| 779 | ||||||
| 780 | // G o through the array, only savi ng the ite ms | |||||
| 781 | // t hat pass t he validat or functio n | |||||
| 782 | for ( ; i < le ngth; i++ ) { | |||||
| 783 | retVal = !!callb ack( elems [ i ], i ) ; | |||||
| 784 | if ( i nv !== ret Val ) { | |||||
| 785 | ret.push ( elems[ i ] ); | |||||
| 786 | } | |||||
| 787 | } | |||||
| 788 | ||||||
| 789 | retu rn ret; | |||||
| 790 | }, | |||||
| 791 | ||||||
| 792 | // arg is fo r internal usage onl y | |||||
| 793 | ma p: functio n( elems, callback, arg ) { | |||||
| 794 | var value, | |||||
| 795 | i = 0, | |||||
| 796 | length = elems.l ength, | |||||
| 797 | isArra y = isArra ylike( ele ms ), | |||||
| 798 | ret = []; | |||||
| 799 | ||||||
| 800 | // G o through the array, translati ng each of the items to their | |||||
| 801 | if ( isArray ) { | |||||
| 802 | for ( ; i < leng th; i++ ) { | |||||
| 803 | value = callback( elems[ i ] , i, arg ) ; | |||||
| 804 | ||||||
| 805 | if ( val ue != null ) { | |||||
| 806 | ret[ ret.l ength ] = value; | |||||
| 807 | } | |||||
| 808 | } | |||||
| 809 | ||||||
| 810 | // G o through every key on the obj ect, | |||||
| 811 | } el se { | |||||
| 812 | for ( i in elems ) { | |||||
| 813 | value = callback( elems[ i ] , i, arg ) ; | |||||
| 814 | ||||||
| 815 | if ( val ue != null ) { | |||||
| 816 | ret[ ret.l ength ] = value; | |||||
| 817 | } | |||||
| 818 | } | |||||
| 819 | } | |||||
| 820 | ||||||
| 821 | // F latten any nested ar rays | |||||
| 822 | retu rn core_co ncat.apply ( [], ret ); | |||||
| 823 | }, | |||||
| 824 | ||||||
| 825 | // A global GUID count er for obj ects | |||||
| 826 | gu id: 1, | |||||
| 827 | ||||||
| 828 | // Bind a fu nction to a context, optionall y partiall y applying any | |||||
| 829 | // arguments . | |||||
| 830 | pr oxy: funct ion( fn, c ontext ) { | |||||
| 831 | var args, prox y, tmp; | |||||
| 832 | ||||||
| 833 | if ( typeof co ntext === "string" ) { | |||||
| 834 | tmp = fn[ contex t ]; | |||||
| 835 | contex t = fn; | |||||
| 836 | fn = t mp; | |||||
| 837 | } | |||||
| 838 | ||||||
| 839 | // Q uick check to determ ine if tar get is cal lable, in the spec | |||||
| 840 | // t his throws a TypeErr or, but we will just return un defined. | |||||
| 841 | if ( !jQuery.i sFunction( fn ) ) { | |||||
| 842 | return undefined ; | |||||
| 843 | } | |||||
| 844 | ||||||
| 845 | // S imulated b ind | |||||
| 846 | args = core_sl ice.call( arguments, 2 ); | |||||
| 847 | prox y = functi on() { | |||||
| 848 | return fn.apply( context | | this, ar gs.concat( core_slic e.call( ar guments ) ) ); | |||||
| 849 | }; | |||||
| 850 | ||||||
| 851 | // S et the gui d of uniqu e handler to the sam e of origi nal handle r, so it c an be remo ved | |||||
| 852 | prox y.guid = f n.guid = f n.guid || jQuery.gui d++; | |||||
| 853 | ||||||
| 854 | retu rn proxy; | |||||
| 855 | }, | |||||
| 856 | ||||||
| 857 | // Multifunc tional met hod to get and set v alues of a collectio n | |||||
| 858 | // The value /s can opt ionally be executed if it's a function | |||||
| 859 | ac cess: func tion( elem s, fn, key , value, c hainable, emptyGet, raw ) { | |||||
| 860 | var i = 0, | |||||
| 861 | length = elems.l ength, | |||||
| 862 | bulk = key == nu ll; | |||||
| 863 | ||||||
| 864 | // S ets many v alues | |||||
| 865 | if ( jQuery.ty pe( key ) === "objec t" ) { | |||||
| 866 | chaina ble = true ; | |||||
| 867 | for ( i in key ) { | |||||
| 868 | jQuery.a ccess( ele ms, fn, i, key[i], t rue, empty Get, raw ) ; | |||||
| 869 | } | |||||
| 870 | ||||||
| 871 | // S ets one va lue | |||||
| 872 | } el se if ( va lue !== un defined ) { | |||||
| 873 | chaina ble = true ; | |||||
| 874 | ||||||
| 875 | if ( ! jQuery.isF unction( v alue ) ) { | |||||
| 876 | raw = tr ue; | |||||
| 877 | } | |||||
| 878 | ||||||
| 879 | if ( b ulk ) { | |||||
| 880 | // Bulk operations run again st the ent ire set | |||||
| 881 | if ( raw ) { | |||||
| 882 | fn.call( e lems, valu e ); | |||||
| 883 | fn = null; | |||||
| 884 | ||||||
| 885 | // ...ex cept when executing function v alues | |||||
| 886 | } else { | |||||
| 887 | bulk = fn; | |||||
| 888 | fn = funct ion( elem, key, valu e ) { | |||||
| 889 | re turn bulk. call( jQue ry( elem ) , value ); | |||||
| 890 | }; | |||||
| 891 | } | |||||
| 892 | } | |||||
| 893 | ||||||
| 894 | if ( f n ) { | |||||
| 895 | for ( ; i < length ; i++ ) { | |||||
| 896 | fn( elems[ i], key, r aw ? value : value.c all( elems [i], i, fn ( elems[i] , key ) ) ); | |||||
| 897 | } | |||||
| 898 | } | |||||
| 899 | } | |||||
| 900 | ||||||
| 901 | retu rn chainab le ? | |||||
| 902 | elems : | |||||
| 903 | ||||||
| 904 | // Get s | |||||
| 905 | bulk ? | |||||
| 906 | fn.call( elems ) : | |||||
| 907 | length ? fn( elems [0], key ) : emptyGe t; | |||||
| 908 | }, | |||||
| 909 | ||||||
| 910 | no w: functio n() { | |||||
| 911 | retu rn ( new D ate() ).ge tTime(); | |||||
| 912 | } | |||||
| 913 | }); | |||||
| 914 | ||||||
| 915 | jQuery.rea dy.promise = functio n( obj ) { | |||||
| 916 | if ( !readyL ist ) { | |||||
| 917 | ||||||
| 918 | read yList = jQ uery.Defer red(); | |||||
| 919 | ||||||
| 920 | // C atch cases where $(d ocument).r eady() is called aft er the bro wser event has alrea dy occurre d. | |||||
| 921 | // w e once tri ed to use readyState "interact ive" here, but it ca used issue s like the one | |||||
| 922 | // d iscovered by ChrisS here: http ://bugs.jq uery.com/t icket/1228 2#comment: 15 | |||||
| 923 | if ( document. readyState === "comp lete" ) { | |||||
| 924 | // Han dle it asy nchronousl y to allow scripts t he opportu nity to de lay ready | |||||
| 925 | setTim eout( jQue ry.ready ) ; | |||||
| 926 | ||||||
| 927 | // S tandards-b ased brows ers suppor t DOMConte ntLoaded | |||||
| 928 | } el se if ( do cument.add EventListe ner ) { | |||||
| 929 | // Use the handy event cal lback | |||||
| 930 | docume nt.addEven tListener( "DOMConte ntLoaded", completed , false ); | |||||
| 931 | ||||||
| 932 | // A f allback to window.on load, that will alwa ys work | |||||
| 933 | window .addEventL istener( " load", com pleted, fa lse ); | |||||
| 934 | ||||||
| 935 | // I f IE event model is used | |||||
| 936 | } el se { | |||||
| 937 | // Ens ure firing before on load, mayb e late but safe also for ifram es | |||||
| 938 | docume nt.attachE vent( "onr eadystatec hange", co mpleted ); | |||||
| 939 | ||||||
| 940 | // A f allback to window.on load, that will alwa ys work | |||||
| 941 | window .attachEve nt( "onloa d", comple ted ); | |||||
| 942 | ||||||
| 943 | // If IE and not a frame | |||||
| 944 | // con tinually c heck to se e if the d ocument is ready | |||||
| 945 | var to p = false; | |||||
| 946 | ||||||
| 947 | try { | |||||
| 948 | top = wi ndow.frame Element == null && d ocument.do cumentElem ent; | |||||
| 949 | } catc h(e) {} | |||||
| 950 | ||||||
| 951 | if ( t op && top. doScroll ) { | |||||
| 952 | (functio n doScroll Check() { | |||||
| 953 | if ( !jQue ry.isReady ) { | |||||
| 954 | ||||||
| 955 | tr y { | |||||
| 956 | // U se the tri ck by Dieg o Perini | |||||
| 957 | // h ttp://java script.nwb ox.com/IEC ontentLoad ed/ | |||||
| 958 | top. doScroll(" left"); | |||||
| 959 | } catch(e) { | |||||
| 960 | retu rn setTime out( doScr ollCheck, 50 ); | |||||
| 961 | } | |||||
| 962 | ||||||
| 963 | // detach al l dom read y events | |||||
| 964 | de tach(); | |||||
| 965 | ||||||
| 966 | // and execu te any wai ting funct ions | |||||
| 967 | jQ uery.ready (); | |||||
| 968 | } | |||||
| 969 | })(); | |||||
| 970 | } | |||||
| 971 | } | |||||
| 972 | } | |||||
| 973 | re turn ready List.promi se( obj ); | |||||
| 974 | }; | |||||
| 975 | ||||||
| 976 | // Populat e the clas s2type map | |||||
| 977 | jQuery.eac h("Boolean Number St ring Funct ion Array Date RegEx p Object E rror".spli t(" "), fu nction(i, name) { | |||||
| 978 | cl ass2type[ "[object " + name + "]" ] = na me.toLower Case(); | |||||
| 979 | }); | |||||
| 980 | ||||||
| 981 | function i sArraylike ( obj ) { | |||||
| 982 | va r length = obj.lengt h, | |||||
| 983 | type = jQuery. type( obj ); | |||||
| 984 | ||||||
| 985 | if ( jQuery. isWindow( obj ) ) { | |||||
| 986 | retu rn false; | |||||
| 987 | } | |||||
| 988 | ||||||
| 989 | if ( obj.nod eType === 1 && lengt h ) { | |||||
| 990 | retu rn true; | |||||
| 991 | } | |||||
| 992 | ||||||
| 993 | re turn type === "array " || type !== "funct ion" && | |||||
| 994 | ( le ngth === 0 || | |||||
| 995 | type of length === "numbe r" && leng th > 0 && ( length - 1 ) in ob j ); | |||||
| 996 | } | |||||
| 997 | ||||||
| 998 | // All jQu ery object s should p oint back to these | |||||
| 999 | rootjQuery = jQuery( document); | |||||
| 1000 | // String to Object options fo rmat cache | |||||
| 1001 | var option sCache = { }; | |||||
| 1002 | ||||||
| 1003 | // Convert String-fo rmatted op tions into Object-fo rmatted on es and sto re in cach e | |||||
| 1004 | function c reateOptio ns( option s ) { | |||||
| 1005 | va r object = optionsCa che[ optio ns ] = {}; | |||||
| 1006 | jQ uery.each( options.m atch( core _rnotwhite ) || [], function( _, flag ) { | |||||
| 1007 | obje ct[ flag ] = true; | |||||
| 1008 | }) ; | |||||
| 1009 | re turn objec t; | |||||
| 1010 | } | |||||
| 1011 | ||||||
| 1012 | /* | |||||
| 1013 | * Create a callback list usin g the foll owing para meters: | |||||
| 1014 | * | |||||
| 1015 | * op tions: an optional l ist of spa ce-separat ed options that will change ho w | |||||
| 1016 | * the ca llback lis t behaves or a more traditiona l option o bject | |||||
| 1017 | * | |||||
| 1018 | * By defa ult a call back list will act l ike an eve nt callbac k list and can be | |||||
| 1019 | * "fired" multiple times. | |||||
| 1020 | * | |||||
| 1021 | * Possibl e options: | |||||
| 1022 | * | |||||
| 1023 | * on ce: will ens ure the ca llback lis t can only be fired once (like a Deferre d) | |||||
| 1024 | * | |||||
| 1025 | * me mory: will kee p track of previous values and will call any callb ack added | |||||
| 1026 | * after the list has b een fired right away with the latest "me morized" | |||||
| 1027 | * values (li ke a Defer red) | |||||
| 1028 | * | |||||
| 1029 | * un ique: will ens ure a call back can o nly be add ed once (n o duplicat e in the l ist) | |||||
| 1030 | * | |||||
| 1031 | * st opOnFalse: interr upt callin gs when a callback r eturns fal se | |||||
| 1032 | * | |||||
| 1033 | */ | |||||
| 1034 | jQuery.Cal lbacks = f unction( o ptions ) { | |||||
| 1035 | ||||||
| 1036 | // Convert o ptions fro m String-f ormatted t o Object-f ormatted i f needed | |||||
| 1037 | // (we check in cache first) | |||||
| 1038 | op tions = ty peof optio ns === "st ring" ? | |||||
| 1039 | ( op tionsCache [ options ] || creat eOptions( options ) ) : | |||||
| 1040 | jQue ry.extend( {}, optio ns ); | |||||
| 1041 | ||||||
| 1042 | va r // Flag to know if list is c urrently f iring | |||||
| 1043 | firi ng, | |||||
| 1044 | // L ast fire v alue (for non-forget table list s) | |||||
| 1045 | memo ry, | |||||
| 1046 | // F lag to kno w if list was alread y fired | |||||
| 1047 | fire d, | |||||
| 1048 | // E nd of the loop when firing | |||||
| 1049 | firi ngLength, | |||||
| 1050 | // I ndex of cu rrently fi ring callb ack (modif ied by rem ove if nee ded) | |||||
| 1051 | firi ngIndex, | |||||
| 1052 | // F irst callb ack to fir e (used in ternally b y add and fireWith) | |||||
| 1053 | firi ngStart, | |||||
| 1054 | // A ctual call back list | |||||
| 1055 | list = [], | |||||
| 1056 | // S tack of fi re calls f or repeata ble lists | |||||
| 1057 | stac k = !optio ns.once && [], | |||||
| 1058 | // F ire callba cks | |||||
| 1059 | fire = functio n( data ) { | |||||
| 1060 | memory = options .memory && data; | |||||
| 1061 | fired = true; | |||||
| 1062 | firing Index = fi ringStart || 0; | |||||
| 1063 | firing Start = 0; | |||||
| 1064 | firing Length = l ist.length ; | |||||
| 1065 | firing = true; | |||||
| 1066 | for ( ; list && firingInde x < firing Length; fi ringIndex+ + ) { | |||||
| 1067 | if ( lis t[ firingI ndex ].app ly( data[ 0 ], data[ 1 ] ) === false && options.st opOnFalse ) { | |||||
| 1068 | memory = f alse; // T o prevent further ca lls using add | |||||
| 1069 | break; | |||||
| 1070 | } | |||||
| 1071 | } | |||||
| 1072 | firing = false; | |||||
| 1073 | if ( l ist ) { | |||||
| 1074 | if ( sta ck ) { | |||||
| 1075 | if ( stack .length ) { | |||||
| 1076 | fi re( stack. shift() ); | |||||
| 1077 | } | |||||
| 1078 | } else i f ( memory ) { | |||||
| 1079 | list = []; | |||||
| 1080 | } else { | |||||
| 1081 | self.disab le(); | |||||
| 1082 | } | |||||
| 1083 | } | |||||
| 1084 | }, | |||||
| 1085 | // A ctual Call backs obje ct | |||||
| 1086 | self = { | |||||
| 1087 | // Add a callbac k or a col lection of callbacks to the li st | |||||
| 1088 | add: f unction() { | |||||
| 1089 | if ( lis t ) { | |||||
| 1090 | // First, we save th e current length | |||||
| 1091 | var start = list.len gth; | |||||
| 1092 | (function add( args ) { | |||||
| 1093 | jQ uery.each( args, fun ction( _, arg ) { | |||||
| 1094 | var type = jQu ery.type( arg ); | |||||
| 1095 | if ( type === "function" ) { | |||||
| 1096 | if ( ! options.un ique || !s elf.has( a rg ) ) { | |||||
| 1097 | list.pus h( arg ); | |||||
| 1098 | } | |||||
| 1099 | } el se if ( ar g && arg.l ength && t ype !== "s tring" ) { | |||||
| 1100 | // Ins pect recur sively | |||||
| 1101 | add( a rg ); | |||||
| 1102 | } | |||||
| 1103 | }) ; | |||||
| 1104 | })( argume nts ); | |||||
| 1105 | // Do we n eed to add the callb acks to th e | |||||
| 1106 | // current firing ba tch? | |||||
| 1107 | if ( firin g ) { | |||||
| 1108 | fi ringLength = list.le ngth; | |||||
| 1109 | // With me mory, if w e're not f iring then | |||||
| 1110 | // we shou ld call ri ght away | |||||
| 1111 | } else if ( memory ) { | |||||
| 1112 | fi ringStart = start; | |||||
| 1113 | fi re( memory ); | |||||
| 1114 | } | |||||
| 1115 | } | |||||
| 1116 | return t his; | |||||
| 1117 | }, | |||||
| 1118 | // Rem ove a call back from the list | |||||
| 1119 | remove : function () { | |||||
| 1120 | if ( lis t ) { | |||||
| 1121 | jQuery.eac h( argumen ts, functi on( _, arg ) { | |||||
| 1122 | va r index; | |||||
| 1123 | wh ile( ( ind ex = jQuer y.inArray( arg, list , index ) ) > -1 ) { | |||||
| 1124 | list .splice( i ndex, 1 ); | |||||
| 1125 | // H andle firi ng indexes | |||||
| 1126 | if ( firing ) { | |||||
| 1127 | if ( i ndex <= fi ringLength ) { | |||||
| 1128 | firingLe ngth--; | |||||
| 1129 | } | |||||
| 1130 | if ( i ndex <= fi ringIndex ) { | |||||
| 1131 | firingIn dex--; | |||||
| 1132 | } | |||||
| 1133 | } | |||||
| 1134 | } | |||||
| 1135 | }); | |||||
| 1136 | } | |||||
| 1137 | return t his; | |||||
| 1138 | }, | |||||
| 1139 | // Che ck if a gi ven callba ck is in t he list. | |||||
| 1140 | // If no argumen t is given , return w hether or not list h as callbac ks attache d. | |||||
| 1141 | has: f unction( f n ) { | |||||
| 1142 | return f n ? jQuery .inArray( fn, list ) > -1 : !! ( list && list.lengt h ); | |||||
| 1143 | }, | |||||
| 1144 | // Rem ove all ca llbacks fr om the lis t | |||||
| 1145 | empty: function( ) { | |||||
| 1146 | list = [ ]; | |||||
| 1147 | return t his; | |||||
| 1148 | }, | |||||
| 1149 | // Hav e the list do nothin g anymore | |||||
| 1150 | disabl e: functio n() { | |||||
| 1151 | list = s tack = mem ory = unde fined; | |||||
| 1152 | return t his; | |||||
| 1153 | }, | |||||
| 1154 | // Is it disable d? | |||||
| 1155 | disabl ed: functi on() { | |||||
| 1156 | return ! list; | |||||
| 1157 | }, | |||||
| 1158 | // Loc k the list in its cu rrent stat e | |||||
| 1159 | lock: function() { | |||||
| 1160 | stack = undefined; | |||||
| 1161 | if ( !me mory ) { | |||||
| 1162 | self.disab le(); | |||||
| 1163 | } | |||||
| 1164 | return t his; | |||||
| 1165 | }, | |||||
| 1166 | // Is it locked? | |||||
| 1167 | locked : function () { | |||||
| 1168 | return ! stack; | |||||
| 1169 | }, | |||||
| 1170 | // Cal l all call backs with the given context a nd argumen ts | |||||
| 1171 | fireWi th: functi on( contex t, args ) { | |||||
| 1172 | args = a rgs || []; | |||||
| 1173 | args = [ context, args.slice ? args.sl ice() : ar gs ]; | |||||
| 1174 | if ( lis t && ( !fi red || sta ck ) ) { | |||||
| 1175 | if ( firin g ) { | |||||
| 1176 | st ack.push( args ); | |||||
| 1177 | } else { | |||||
| 1178 | fi re( args ) ; | |||||
| 1179 | } | |||||
| 1180 | } | |||||
| 1181 | return t his; | |||||
| 1182 | }, | |||||
| 1183 | // Cal l all the callbacks with the g iven argum ents | |||||
| 1184 | fire: function() { | |||||
| 1185 | self.fir eWith( thi s, argumen ts ); | |||||
| 1186 | return t his; | |||||
| 1187 | }, | |||||
| 1188 | // To know if th e callback s have alr eady been called at least once | |||||
| 1189 | fired: function( ) { | |||||
| 1190 | return ! !fired; | |||||
| 1191 | } | |||||
| 1192 | }; | |||||
| 1193 | ||||||
| 1194 | re turn self; | |||||
| 1195 | }; | |||||
| 1196 | jQuery.ext end({ | |||||
| 1197 | ||||||
| 1198 | De ferred: fu nction( fu nc ) { | |||||
| 1199 | var tuples = [ | |||||
| 1200 | // actio n, add lis tener, lis tener list , final st ate | |||||
| 1201 | [ "resol ve", "done ", jQuery. Callbacks( "once memo ry"), "res olved" ], | |||||
| 1202 | [ "rejec t", "fail" , jQuery.C allbacks(" once memor y"), "reje cted" ], | |||||
| 1203 | [ "notif y", "progr ess", jQue ry.Callbac ks("memory ") ] | |||||
| 1204 | ], | |||||
| 1205 | state = "pending ", | |||||
| 1206 | promis e = { | |||||
| 1207 | state: f unction() { | |||||
| 1208 | return sta te; | |||||
| 1209 | }, | |||||
| 1210 | always: function() { | |||||
| 1211 | deferred.d one( argum ents ).fai l( argumen ts ); | |||||
| 1212 | return thi s; | |||||
| 1213 | }, | |||||
| 1214 | then: fu nction( /* fnDone, f nFail, fnP rogress */ ) { | |||||
| 1215 | var fns = arguments; | |||||
| 1216 | return jQu ery.Deferr ed(functio n( newDefe r ) { | |||||
| 1217 | jQ uery.each( tuples, f unction( i , tuple ) { | |||||
| 1218 | var action = t uple[ 0 ], | |||||
| 1219 | fn = j Query.isFu nction( fn s[ i ] ) & & fns[ i ] ; | |||||
| 1220 | // d eferred[ d one | fail | progres s ] for fo rwarding a ctions to newDefer | |||||
| 1221 | defe rred[ tupl e[1] ](fun ction() { | |||||
| 1222 | var re turned = f n && fn.ap ply( this, arguments ); | |||||
| 1223 | if ( r eturned && jQuery.is Function( returned.p romise ) ) { | |||||
| 1224 | returned .promise() | |||||
| 1225 | .done( new Defer.reso lve ) | |||||
| 1226 | .fail( new Defer.reje ct ) | |||||
| 1227 | .progress( newDefer. notify ); | |||||
| 1228 | } else { | |||||
| 1229 | newDefer [ action + "With" ]( this === promise ? newDefer.p romise() : this, fn ? [ return ed ] : arg uments ); | |||||
| 1230 | } | |||||
| 1231 | }); | |||||
| 1232 | }) ; | |||||
| 1233 | fn s = null; | |||||
| 1234 | }).promise (); | |||||
| 1235 | }, | |||||
| 1236 | // Get a promise f or this de ferred | |||||
| 1237 | // If ob j is provi ded, the p romise asp ect is add ed to the object | |||||
| 1238 | promise: function( obj ) { | |||||
| 1239 | return obj != null ? jQuery.ex tend( obj, promise ) : promise ; | |||||
| 1240 | } | |||||
| 1241 | }, | |||||
| 1242 | deferr ed = {}; | |||||
| 1243 | ||||||
| 1244 | // K eep pipe f or back-co mpat | |||||
| 1245 | prom ise.pipe = promise.t hen; | |||||
| 1246 | ||||||
| 1247 | // A dd list-sp ecific met hods | |||||
| 1248 | jQue ry.each( t uples, fun ction( i, tuple ) { | |||||
| 1249 | var li st = tuple [ 2 ], | |||||
| 1250 | stateStr ing = tupl e[ 3 ]; | |||||
| 1251 | ||||||
| 1252 | // pro mise[ done | fail | progress ] = list.ad d | |||||
| 1253 | promis e[ tuple[1 ] ] = list .add; | |||||
| 1254 | ||||||
| 1255 | // Han dle state | |||||
| 1256 | if ( s tateString ) { | |||||
| 1257 | list.add (function( ) { | |||||
| 1258 | // state = [ resolve d | reject ed ] | |||||
| 1259 | state = st ateString; | |||||
| 1260 | ||||||
| 1261 | // [ rej ect_list | resolve_l ist ].disa ble; progr ess_list.l ock | |||||
| 1262 | }, tuple s[ i ^ 1 ] [ 2 ].disa ble, tuple s[ 2 ][ 2 ].lock ); | |||||
| 1263 | } | |||||
| 1264 | ||||||
| 1265 | // def erred[ res olve | rej ect | noti fy ] | |||||
| 1266 | deferr ed[ tuple[ 0] ] = fun ction() { | |||||
| 1267 | deferred [ tuple[0] + "With" ]( this == = deferred ? promise : this, a rguments ) ; | |||||
| 1268 | return t his; | |||||
| 1269 | }; | |||||
| 1270 | deferr ed[ tuple[ 0] + "With " ] = list .fireWith; | |||||
| 1271 | }); | |||||
| 1272 | ||||||
| 1273 | // M ake the de ferred a p romise | |||||
| 1274 | prom ise.promis e( deferre d ); | |||||
| 1275 | ||||||
| 1276 | // C all given func if an y | |||||
| 1277 | if ( func ) { | |||||
| 1278 | func.c all( defer red, defer red ); | |||||
| 1279 | } | |||||
| 1280 | ||||||
| 1281 | // A ll done! | |||||
| 1282 | retu rn deferre d; | |||||
| 1283 | }, | |||||
| 1284 | ||||||
| 1285 | // Deferred helper | |||||
| 1286 | wh en: functi on( subord inate /* , ..., subo rdinateN * / ) { | |||||
| 1287 | var i = 0, | |||||
| 1288 | resolv eValues = core_slice .call( arg uments ), | |||||
| 1289 | length = resolve Values.len gth, | |||||
| 1290 | ||||||
| 1291 | // the count of uncomplete d subordin ates | |||||
| 1292 | remain ing = leng th !== 1 | | ( subord inate && j Query.isFu nction( su bordinate. promise ) ) ? length : 0, | |||||
| 1293 | ||||||
| 1294 | // the master De ferred. If resolveVa lues consi st of only a single Deferred, just use t hat. | |||||
| 1295 | deferr ed = remai ning === 1 ? subordi nate : jQu ery.Deferr ed(), | |||||
| 1296 | ||||||
| 1297 | // Upd ate functi on for bot h resolve and progre ss values | |||||
| 1298 | update Func = fun ction( i, contexts, values ) { | |||||
| 1299 | return f unction( v alue ) { | |||||
| 1300 | contexts[ i ] = this ; | |||||
| 1301 | values[ i ] = argume nts.length > 1 ? cor e_slice.ca ll( argume nts ) : va lue; | |||||
| 1302 | if( values === progr essValues ) { | |||||
| 1303 | de ferred.not ifyWith( c ontexts, v alues ); | |||||
| 1304 | } else if ( !( --rem aining ) ) { | |||||
| 1305 | de ferred.res olveWith( contexts, values ); | |||||
| 1306 | } | |||||
| 1307 | }; | |||||
| 1308 | }, | |||||
| 1309 | ||||||
| 1310 | progre ssValues, progressCo ntexts, re solveConte xts; | |||||
| 1311 | ||||||
| 1312 | // a dd listene rs to Defe rred subor dinates; t reat other s as resol ved | |||||
| 1313 | if ( length > 1 ) { | |||||
| 1314 | progre ssValues = new Array ( length ) ; | |||||
| 1315 | progre ssContexts = new Arr ay( length ); | |||||
| 1316 | resolv eContexts = new Arra y( length ); | |||||
| 1317 | for ( ; i < leng th; i++ ) { | |||||
| 1318 | if ( res olveValues [ i ] && j Query.isFu nction( re solveValue s[ i ].pro mise ) ) { | |||||
| 1319 | resolveVal ues[ i ].p romise() | |||||
| 1320 | .d one( updat eFunc( i, resolveCon texts, res olveValues ) ) | |||||
| 1321 | .f ail( defer red.reject ) | |||||
| 1322 | .p rogress( u pdateFunc( i, progre ssContexts , progress Values ) ) ; | |||||
| 1323 | } else { | |||||
| 1324 | --remainin g; | |||||
| 1325 | } | |||||
| 1326 | } | |||||
| 1327 | } | |||||
| 1328 | ||||||
| 1329 | // i f we're no t waiting on anythin g, resolve the maste r | |||||
| 1330 | if ( !remainin g ) { | |||||
| 1331 | deferr ed.resolve With( reso lveContext s, resolve Values ); | |||||
| 1332 | } | |||||
| 1333 | ||||||
| 1334 | retu rn deferre d.promise( ); | |||||
| 1335 | } | |||||
| 1336 | }); | |||||
| 1337 | jQuery.sup port = (fu nction() { | |||||
| 1338 | ||||||
| 1339 | va r support, all, a, | |||||
| 1340 | inpu t, select, fragment, | |||||
| 1341 | opt, eventName , isSuppor ted, i, | |||||
| 1342 | div = document .createEle ment("div" ); | |||||
| 1343 | ||||||
| 1344 | // Setup | |||||
| 1345 | di v.setAttri bute( "cla ssName", " t" ); | |||||
| 1346 | di v.innerHTM L = " <li nk/><table ></table>< a href='/a '>a</a><in put type=' checkbox'/ >"; | |||||
| 1347 | ||||||
| 1348 | // Support t ests won't run in so me limited or non-br owser envi ronments | |||||
| 1349 | al l = div.ge tElementsB yTagName(" *"); | |||||
| 1350 | a = div.getE lementsByT agName("a" )[ 0 ]; | |||||
| 1351 | if ( !all || !a || !al l.length ) { | |||||
| 1352 | retu rn {}; | |||||
| 1353 | } | |||||
| 1354 | ||||||
| 1355 | // First bat ch of test s | |||||
| 1356 | se lect = doc ument.crea teElement( "select"); | |||||
| 1357 | op t = select .appendChi ld( docume nt.createE lement("op tion") ); | |||||
| 1358 | in put = div. getElement sByTagName ("input")[ 0 ]; | |||||
| 1359 | ||||||
| 1360 | a. style.cssT ext = "top :1px;float :left;opac ity:.5"; | |||||
| 1361 | su pport = { | |||||
| 1362 | // T est setAtt ribute on camelCase class. If it works, we need at trFixes wh en doing g et/setAttr ibute (ie6 /7) | |||||
| 1363 | getS etAttribut e: div.cla ssName !== "t", | |||||
| 1364 | ||||||
| 1365 | // I E strips l eading whi tespace wh en .innerH TML is use d | |||||
| 1366 | lead ingWhitesp ace: div.f irstChild. nodeType = == 3, | |||||
| 1367 | ||||||
| 1368 | // M ake sure t hat tbody elements a ren't auto matically inserted | |||||
| 1369 | // I E will ins ert them i nto empty tables | |||||
| 1370 | tbod y: !div.ge tElementsB yTagName(" tbody").le ngth, | |||||
| 1371 | ||||||
| 1372 | // M ake sure t hat link e lements ge t serializ ed correct ly by inne rHTML | |||||
| 1373 | // T his requir es a wrapp er element in IE | |||||
| 1374 | html Serialize: !!div.get ElementsBy TagName("l ink").leng th, | |||||
| 1375 | ||||||
| 1376 | // G et the sty le informa tion from getAttribu te | |||||
| 1377 | // ( IE uses .c ssText ins tead) | |||||
| 1378 | styl e: /top/.t est( a.get Attribute( "style") ) , | |||||
| 1379 | ||||||
| 1380 | // M ake sure t hat URLs a ren't mani pulated | |||||
| 1381 | // ( IE normali zes it by default) | |||||
| 1382 | href Normalized : a.getAtt ribute("hr ef") === " /a", | |||||
| 1383 | ||||||
| 1384 | // M ake sure t hat elemen t opacity exists | |||||
| 1385 | // ( IE uses fi lter inste ad) | |||||
| 1386 | // U se a regex to work a round a We bKit issue . See #514 5 | |||||
| 1387 | opac ity: /^0.5 /.test( a. style.opac ity ), | |||||
| 1388 | ||||||
| 1389 | // V erify styl e float ex istence | |||||
| 1390 | // ( IE uses st yleFloat i nstead of cssFloat) | |||||
| 1391 | cssF loat: !!a. style.cssF loat, | |||||
| 1392 | ||||||
| 1393 | // C heck the d efault che ckbox/radi o value (" " on WebKi t; "on" el sewhere) | |||||
| 1394 | chec kOn: !!inp ut.value, | |||||
| 1395 | ||||||
| 1396 | // M ake sure t hat a sele cted-by-de fault opti on has a w orking sel ected prop erty. | |||||
| 1397 | // ( WebKit def aults to f alse inste ad of true , IE too, if it's in an optgro up) | |||||
| 1398 | optS elected: o pt.selecte d, | |||||
| 1399 | ||||||
| 1400 | // T ests for e nctype sup port on a form (#674 3) | |||||
| 1401 | enct ype: !!doc ument.crea teElement( "form").en ctype, | |||||
| 1402 | ||||||
| 1403 | // M akes sure cloning an html5 ele ment does not cause problems | |||||
| 1404 | // W here outer HTML is un defined, t his still works | |||||
| 1405 | html 5Clone: do cument.cre ateElement ("nav").cl oneNode( t rue ).oute rHTML !== "<:nav></: nav>", | |||||
| 1406 | ||||||
| 1407 | // j Query.supp ort.boxMod el DEPRECA TED in 1.8 since we don't supp ort Quirks Mode | |||||
| 1408 | boxM odel: docu ment.compa tMode === "CSS1Compa t", | |||||
| 1409 | ||||||
| 1410 | // W ill be def ined later | |||||
| 1411 | dele teExpando: true, | |||||
| 1412 | noCl oneEvent: true, | |||||
| 1413 | inli neBlockNee dsLayout: false, | |||||
| 1414 | shri nkWrapBloc ks: false, | |||||
| 1415 | reli ableMargin Right: tru e, | |||||
| 1416 | boxS izingRelia ble: true, | |||||
| 1417 | pixe lPosition: false | |||||
| 1418 | }; | |||||
| 1419 | ||||||
| 1420 | // Make sure checked s tatus is p roperly cl oned | |||||
| 1421 | in put.checke d = true; | |||||
| 1422 | su pport.noCl oneChecked = input.c loneNode( true ).che cked; | |||||
| 1423 | ||||||
| 1424 | // Make sure that the options in side disab led select s aren't m arked as d isabled | |||||
| 1425 | // (WebKit m arks them as disable d) | |||||
| 1426 | se lect.disab led = true ; | |||||
| 1427 | su pport.optD isabled = !opt.disab led; | |||||
| 1428 | ||||||
| 1429 | // Support: IE<9 | |||||
| 1430 | tr y { | |||||
| 1431 | dele te div.tes t; | |||||
| 1432 | } catch( e ) { | |||||
| 1433 | supp ort.delete Expando = false; | |||||
| 1434 | } | |||||
| 1435 | ||||||
| 1436 | // Check if we can tru st getAttr ibute("val ue") | |||||
| 1437 | in put = docu ment.creat eElement(" input"); | |||||
| 1438 | in put.setAtt ribute( "v alue", "" ); | |||||
| 1439 | su pport.inpu t = input. getAttribu te( "value " ) === "" ; | |||||
| 1440 | ||||||
| 1441 | // Check if an input m aintains i ts value a fter becom ing a radi o | |||||
| 1442 | in put.value = "t"; | |||||
| 1443 | in put.setAtt ribute( "t ype", "rad io" ); | |||||
| 1444 | su pport.radi oValue = i nput.value === "t"; | |||||
| 1445 | ||||||
| 1446 | // #11217 - WebKit los es check w hen the na me is afte r the chec ked attrib ute | |||||
| 1447 | in put.setAtt ribute( "c hecked", " t" ); | |||||
| 1448 | in put.setAtt ribute( "n ame", "t" ); | |||||
| 1449 | ||||||
| 1450 | fr agment = d ocument.cr eateDocume ntFragment (); | |||||
| 1451 | fr agment.app endChild( input ); | |||||
| 1452 | ||||||
| 1453 | // Check if a disconne cted check box will r etain its checked | |||||
| 1454 | // value of true after appended to the DOM (IE6/7) | |||||
| 1455 | su pport.appe ndChecked = input.ch ecked; | |||||
| 1456 | ||||||
| 1457 | // WebKit do esn't clon e checked state corr ectly in f ragments | |||||
| 1458 | su pport.chec kClone = f ragment.cl oneNode( t rue ).clon eNode( tru e ).lastCh ild.checke d; | |||||
| 1459 | ||||||
| 1460 | // Support: IE<9 | |||||
| 1461 | // Opera doe s not clon e events ( and typeof div.attac hEvent === undefined ). | |||||
| 1462 | // IE9-10 cl ones event s bound vi a attachEv ent, but t hey don't trigger wi th .click( ) | |||||
| 1463 | if ( div.att achEvent ) { | |||||
| 1464 | div. attachEven t( "onclic k", functi on() { | |||||
| 1465 | suppor t.noCloneE vent = fal se; | |||||
| 1466 | }); | |||||
| 1467 | ||||||
| 1468 | div. cloneNode( true ).cl ick(); | |||||
| 1469 | } | |||||
| 1470 | ||||||
| 1471 | // Support: IE<9 (lack submit/ch ange bubbl e), Firefo x 17+ (lac k focusin event) | |||||
| 1472 | // Beware of CSP restr ictions (h ttps://dev eloper.moz illa.org/e n/Security /CSP), tes t/csp.php | |||||
| 1473 | fo r ( i in { submit: t rue, chang e: true, f ocusin: tr ue }) { | |||||
| 1474 | div. setAttribu te( eventN ame = "on" + i, "t" ); | |||||
| 1475 | ||||||
| 1476 | supp ort[ i + " Bubbles" ] = eventNa me in wind ow || div. attributes [ eventNam e ].expand o === fals e; | |||||
| 1477 | } | |||||
| 1478 | ||||||
| 1479 | di v.style.ba ckgroundCl ip = "cont ent-box"; | |||||
| 1480 | di v.cloneNod e( true ). style.back groundClip = ""; | |||||
| 1481 | su pport.clea rCloneStyl e = div.st yle.backgr oundClip = == "conten t-box"; | |||||
| 1482 | ||||||
| 1483 | // Run tests that need a body at doc ready | |||||
| 1484 | jQ uery(funct ion() { | |||||
| 1485 | var container, marginDiv , tds, | |||||
| 1486 | divRes et = "padd ing:0;marg in:0;borde r:0;displa y:block;bo x-sizing:c ontent-box ;-moz-box- sizing:con tent-box;- webkit-box -sizing:co ntent-box; ", | |||||
| 1487 | body = document. getElement sByTagName ("body")[0 ]; | |||||
| 1488 | ||||||
| 1489 | if ( !body ) { | |||||
| 1490 | // Ret urn for fr ameset doc s that don 't have a body | |||||
| 1491 | return ; | |||||
| 1492 | } | |||||
| 1493 | ||||||
| 1494 | cont ainer = do cument.cre ateElement ("div"); | |||||
| 1495 | cont ainer.styl e.cssText = "border: 0;width:0; height:0;p osition:ab solute;top :0;left:-9 999px;marg in-top:1px "; | |||||
| 1496 | ||||||
| 1497 | body .appendChi ld( contai ner ).appe ndChild( d iv ); | |||||
| 1498 | ||||||
| 1499 | // S upport: IE 8 | |||||
| 1500 | // C heck if ta ble cells still have offsetWid th/Height when they are set | |||||
| 1501 | // t o display: none and t here are s till other visible t able cells in a | |||||
| 1502 | // t able row; if so, off setWidth/H eight are not reliab le for use when | |||||
| 1503 | // d etermining if an ele ment has b een hidden directly using | |||||
| 1504 | // d isplay:non e (it is s till safe to use off sets if a parent ele ment is | |||||
| 1505 | // h idden; don safety go ggles and see bug #4 512 for mo re informa tion). | |||||
| 1506 | div. innerHTML = "<table> <tr><td></ td><td>t</ td></tr></ table>"; | |||||
| 1507 | tds = div.getE lementsByT agName("td "); | |||||
| 1508 | tds[ 0 ].style .cssText = "padding: 0;margin:0 ;border:0; display:no ne"; | |||||
| 1509 | isSu pported = ( tds[ 0 ] .offsetHei ght === 0 ); | |||||
| 1510 | ||||||
| 1511 | tds[ 0 ].style .display = ""; | |||||
| 1512 | tds[ 1 ].style .display = "none"; | |||||
| 1513 | ||||||
| 1514 | // S upport: IE 8 | |||||
| 1515 | // C heck if em pty table cells stil l have off setWidth/H eight | |||||
| 1516 | supp ort.reliab leHiddenOf fsets = is Supported && ( tds[ 0 ].offset Height === 0 ); | |||||
| 1517 | ||||||
| 1518 | // C heck box-s izing and margin beh avior | |||||
| 1519 | div. innerHTML = ""; | |||||
| 1520 | div. style.cssT ext = "box -sizing:bo rder-box;- moz-box-si zing:borde r-box;-web kit-box-si zing:borde r-box;padd ing:1px;bo rder:1px;d isplay:blo ck;width:4 px;margin- top:1%;pos ition:abso lute;top:1 %;"; | |||||
| 1521 | supp ort.boxSiz ing = ( di v.offsetWi dth === 4 ); | |||||
| 1522 | supp ort.doesNo tIncludeMa rginInBody Offset = ( body.offs etTop !== 1 ); | |||||
| 1523 | ||||||
| 1524 | // U se window. getCompute dStyle bec ause jsdom on node.j s will bre ak without it. | |||||
| 1525 | if ( window.ge tComputedS tyle ) { | |||||
| 1526 | suppor t.pixelPos ition = ( window.get ComputedSt yle( div, null ) || {} ).top ! == "1%"; | |||||
| 1527 | suppor t.boxSizin gReliable = ( window .getComput edStyle( d iv, null ) || { widt h: "4px" } ).width = == "4px"; | |||||
| 1528 | ||||||
| 1529 | // Che ck if div with expli cit width and no mar gin-right incorrectl y | |||||
| 1530 | // get s computed margin-ri ght based on width o f containe r. (#3333) | |||||
| 1531 | // Fai ls in WebK it before Feb 2011 n ightlies | |||||
| 1532 | // Web Kit Bug 13 343 - getC omputedSty le returns wrong val ue for mar gin-right | |||||
| 1533 | margin Div = div. appendChil d( documen t.createEl ement("div ") ); | |||||
| 1534 | margin Div.style. cssText = div.style. cssText = divReset; | |||||
| 1535 | margin Div.style. marginRigh t = margin Div.style. width = "0 "; | |||||
| 1536 | div.st yle.width = "1px"; | |||||
| 1537 | ||||||
| 1538 | suppor t.reliable MarginRigh t = | |||||
| 1539 | !parseFl oat( ( win dow.getCom putedStyle ( marginDi v, null ) || {} ).ma rginRight ); | |||||
| 1540 | } | |||||
| 1541 | ||||||
| 1542 | if ( typeof di v.style.zo om !== cor e_strundef ined ) { | |||||
| 1543 | // Sup port: IE<8 | |||||
| 1544 | // Che ck if nati vely block -level ele ments act like inlin e-block | |||||
| 1545 | // ele ments when setting t heir displ ay to 'inl ine' and g iving | |||||
| 1546 | // the m layout | |||||
| 1547 | div.in nerHTML = ""; | |||||
| 1548 | div.st yle.cssTex t = divRes et + "widt h:1px;padd ing:1px;di splay:inli ne;zoom:1" ; | |||||
| 1549 | suppor t.inlineBl ockNeedsLa yout = ( d iv.offsetW idth === 3 ); | |||||
| 1550 | ||||||
| 1551 | // Sup port: IE6 | |||||
| 1552 | // Che ck if elem ents with layout shr ink-wrap t heir child ren | |||||
| 1553 | div.st yle.displa y = "block "; | |||||
| 1554 | div.in nerHTML = "<div></di v>"; | |||||
| 1555 | div.fi rstChild.s tyle.width = "5px"; | |||||
| 1556 | suppor t.shrinkWr apBlocks = ( div.off setWidth ! == 3 ); | |||||
| 1557 | ||||||
| 1558 | if ( s upport.inl ineBlockNe edsLayout ) { | |||||
| 1559 | // Preve nt IE 6 fr om affecti ng layout for positi oned eleme nts #11048 | |||||
| 1560 | // Preve nt IE from shrinking the body in IE 7 mo de #12869 | |||||
| 1561 | // Suppo rt: IE<8 | |||||
| 1562 | body.sty le.zoom = 1; | |||||
| 1563 | } | |||||
| 1564 | } | |||||
| 1565 | ||||||
| 1566 | body .removeChi ld( contai ner ); | |||||
| 1567 | ||||||
| 1568 | // N ull elemen ts to avoi d leaks in IE | |||||
| 1569 | cont ainer = di v = tds = marginDiv = null; | |||||
| 1570 | }) ; | |||||
| 1571 | ||||||
| 1572 | // Null elem ents to av oid leaks in IE | |||||
| 1573 | al l = select = fragmen t = opt = a = input = null; | |||||
| 1574 | ||||||
| 1575 | re turn suppo rt; | |||||
| 1576 | })(); | |||||
| 1577 | ||||||
| 1578 | var rbrace = /(?:\{[ \s\S]*\}|\ [[\s\S]*\] )$/, | |||||
| 1579 | rm ultiDash = /([A-Z])/ g; | |||||
| 1580 | ||||||
| 1581 | function i nternalDat a( elem, n ame, data, pvt /* In ternal Use Only */ ) { | |||||
| 1582 | if ( !jQuery .acceptDat a( elem ) ) { | |||||
| 1583 | retu rn; | |||||
| 1584 | } | |||||
| 1585 | ||||||
| 1586 | va r thisCach e, ret, | |||||
| 1587 | inte rnalKey = jQuery.exp ando, | |||||
| 1588 | getB yName = ty peof name === "strin g", | |||||
| 1589 | ||||||
| 1590 | // W e have to handle DOM nodes and JS object s differen tly becaus e IE6-7 | |||||
| 1591 | // c an't GC ob ject refer ences prop erly acros s the DOM- JS boundar y | |||||
| 1592 | isNo de = elem. nodeType, | |||||
| 1593 | ||||||
| 1594 | // O nly DOM no des need t he global jQuery cac he; JS obj ect data i s | |||||
| 1595 | // a ttached di rectly to the object so GC can occur aut omatically | |||||
| 1596 | cach e = isNode ? jQuery. cache : el em, | |||||
| 1597 | ||||||
| 1598 | // O nly defini ng an ID f or JS obje cts if its cache alr eady exist s allows | |||||
| 1599 | // t he code to shortcut on the sam e path as a DOM node with no c ache | |||||
| 1600 | id = isNode ? elem[ inte rnalKey ] : elem[ in ternalKey ] && inter nalKey; | |||||
| 1601 | ||||||
| 1602 | // Avoid doi ng any mor e work tha n we need to when tr ying to ge t data on an | |||||
| 1603 | // object th at has no data at al l | |||||
| 1604 | if ( (!id || !cache[id ] || (!pvt && !cache [id].data) ) && getBy Name && da ta === und efined ) { | |||||
| 1605 | retu rn; | |||||
| 1606 | } | |||||
| 1607 | ||||||
| 1608 | if ( !id ) { | |||||
| 1609 | // O nly DOM no des need a new uniqu e ID for e ach elemen t since th eir data | |||||
| 1610 | // e nds up in the global cache | |||||
| 1611 | if ( isNode ) { | |||||
| 1612 | elem[ internalKe y ] = id = core_dele tedIds.pop () || jQue ry.guid++; | |||||
| 1613 | } el se { | |||||
| 1614 | id = i nternalKey ; | |||||
| 1615 | } | |||||
| 1616 | } | |||||
| 1617 | ||||||
| 1618 | if ( !cache[ id ] ) { | |||||
| 1619 | cach e[ id ] = {}; | |||||
| 1620 | ||||||
| 1621 | // A voids expo sing jQuer y metadata on plain JS objects when the object | |||||
| 1622 | // i s serializ ed using J SON.string ify | |||||
| 1623 | if ( !isNode ) { | |||||
| 1624 | cache[ id ].toJS ON = jQuer y.noop; | |||||
| 1625 | } | |||||
| 1626 | } | |||||
| 1627 | ||||||
| 1628 | // An object can be pa ssed to jQ uery.data instead of a key/val ue pair; t his gets | |||||
| 1629 | // shallow c opied over onto the existing c ache | |||||
| 1630 | if ( typeof name === " object" || typeof na me === "fu nction" ) { | |||||
| 1631 | if ( pvt ) { | |||||
| 1632 | cache[ id ] = jQ uery.exten d( cache[ id ], name ); | |||||
| 1633 | } el se { | |||||
| 1634 | cache[ id ].data = jQuery. extend( ca che[ id ]. data, name ); | |||||
| 1635 | } | |||||
| 1636 | } | |||||
| 1637 | ||||||
| 1638 | th isCache = cache[ id ]; | |||||
| 1639 | ||||||
| 1640 | // jQuery da ta() is st ored in a separate o bject insi de the obj ect's inte rnal data | |||||
| 1641 | // cache in order to a void key c ollisions between in ternal dat a and user -defined | |||||
| 1642 | // data. | |||||
| 1643 | if ( !pvt ) { | |||||
| 1644 | if ( !thisCach e.data ) { | |||||
| 1645 | thisCa che.data = {}; | |||||
| 1646 | } | |||||
| 1647 | ||||||
| 1648 | this Cache = th isCache.da ta; | |||||
| 1649 | } | |||||
| 1650 | ||||||
| 1651 | if ( data != = undefine d ) { | |||||
| 1652 | this Cache[ jQu ery.camelC ase( name ) ] = data ; | |||||
| 1653 | } | |||||
| 1654 | ||||||
| 1655 | // Check for both conv erted-to-c amel and n on-convert ed data pr operty nam es | |||||
| 1656 | // If a data property was specif ied | |||||
| 1657 | if ( getByNa me ) { | |||||
| 1658 | ||||||
| 1659 | // F irst Try t o find as- is propert y data | |||||
| 1660 | ret = thisCach e[ name ]; | |||||
| 1661 | ||||||
| 1662 | // T est for nu ll|undefin ed propert y data | |||||
| 1663 | if ( ret == nu ll ) { | |||||
| 1664 | ||||||
| 1665 | // Try to find t he camelCa sed proper ty | |||||
| 1666 | ret = thisCache[ jQuery.ca melCase( n ame ) ]; | |||||
| 1667 | } | |||||
| 1668 | } else { | |||||
| 1669 | ret = thisCach e; | |||||
| 1670 | } | |||||
| 1671 | ||||||
| 1672 | re turn ret; | |||||
| 1673 | } | |||||
| 1674 | ||||||
| 1675 | function i nternalRem oveData( e lem, name, pvt ) { | |||||
| 1676 | if ( !jQuery .acceptDat a( elem ) ) { | |||||
| 1677 | retu rn; | |||||
| 1678 | } | |||||
| 1679 | ||||||
| 1680 | va r i, l, th isCache, | |||||
| 1681 | isNo de = elem. nodeType, | |||||
| 1682 | ||||||
| 1683 | // S ee jQuery. data for m ore inform ation | |||||
| 1684 | cach e = isNode ? jQuery. cache : el em, | |||||
| 1685 | id = isNode ? elem[ jQue ry.expando ] : jQuer y.expando; | |||||
| 1686 | ||||||
| 1687 | // If there is already no cache entry for this objec t, there i s no | |||||
| 1688 | // purpose i n continui ng | |||||
| 1689 | if ( !cache[ id ] ) { | |||||
| 1690 | retu rn; | |||||
| 1691 | } | |||||
| 1692 | ||||||
| 1693 | if ( name ) { | |||||
| 1694 | ||||||
| 1695 | this Cache = pv t ? cache[ id ] : ca che[ id ]. data; | |||||
| 1696 | ||||||
| 1697 | if ( thisCache ) { | |||||
| 1698 | ||||||
| 1699 | // Sup port array or space separated string nam es for dat a keys | |||||
| 1700 | if ( ! jQuery.isA rray( name ) ) { | |||||
| 1701 | ||||||
| 1702 | // try t he string as a key b efore any manipulati on | |||||
| 1703 | if ( nam e in thisC ache ) { | |||||
| 1704 | name = [ n ame ]; | |||||
| 1705 | } else { | |||||
| 1706 | ||||||
| 1707 | // split t he camel c ased versi on by spac es unless a key with the space s exists | |||||
| 1708 | name = jQu ery.camelC ase( name ); | |||||
| 1709 | if ( name in thisCac he ) { | |||||
| 1710 | na me = [ nam e ]; | |||||
| 1711 | } else { | |||||
| 1712 | na me = name. split(" ") ; | |||||
| 1713 | } | |||||
| 1714 | } | |||||
| 1715 | } else { | |||||
| 1716 | // If "n ame" is an array of keys... | |||||
| 1717 | // When data is in itially cr eated, via ("key", " val") sign ature, | |||||
| 1718 | // keys will be co nverted to camelCase . | |||||
| 1719 | // Since there is no way to tell _how_ a key was added, re move | |||||
| 1720 | // both plain key and camelC ase key. # 12786 | |||||
| 1721 | // This will only penalize t he array a rgument pa th. | |||||
| 1722 | name = n ame.concat ( jQuery.m ap( name, jQuery.cam elCase ) ) ; | |||||
| 1723 | } | |||||
| 1724 | ||||||
| 1725 | for ( i = 0, l = name.leng th; i < l; i++ ) { | |||||
| 1726 | delete t hisCache[ name[i] ]; | |||||
| 1727 | } | |||||
| 1728 | ||||||
| 1729 | // If there is n o data lef t in the c ache, we w ant to con tinue | |||||
| 1730 | // and let the c ache objec t itself g et destroy ed | |||||
| 1731 | if ( ! ( pvt ? is EmptyDataO bject : jQ uery.isEmp tyObject ) ( thisCach e ) ) { | |||||
| 1732 | return; | |||||
| 1733 | } | |||||
| 1734 | } | |||||
| 1735 | } | |||||
| 1736 | ||||||
| 1737 | // See jQuer y.data for more info rmation | |||||
| 1738 | if ( !pvt ) { | |||||
| 1739 | dele te cache[ id ].data; | |||||
| 1740 | ||||||
| 1741 | // D on't destr oy the par ent cache unless the internal data objec t | |||||
| 1742 | // h ad been th e only thi ng left in it | |||||
| 1743 | if ( !isEmptyD ataObject( cache[ id ] ) ) { | |||||
| 1744 | return ; | |||||
| 1745 | } | |||||
| 1746 | } | |||||
| 1747 | ||||||
| 1748 | // Destroy t he cache | |||||
| 1749 | if ( isNode ) { | |||||
| 1750 | jQue ry.cleanDa ta( [ elem ], true ) ; | |||||
| 1751 | ||||||
| 1752 | // Use delet e when sup ported for expandos or `cache` is not a window per isWindow (#10080) | |||||
| 1753 | } else if ( jQuery.sup port.delet eExpando | | cache != cache.win dow ) { | |||||
| 1754 | dele te cache[ id ]; | |||||
| 1755 | ||||||
| 1756 | // When all else fails , null | |||||
| 1757 | } else { | |||||
| 1758 | cach e[ id ] = null; | |||||
| 1759 | } | |||||
| 1760 | } | |||||
| 1761 | ||||||
| 1762 | jQuery.ext end({ | |||||
| 1763 | ca che: {}, | |||||
| 1764 | ||||||
| 1765 | // Unique fo r each cop y of jQuer y on the p age | |||||
| 1766 | // Non-digit s removed to match r inlinejQue ry | |||||
| 1767 | ex pando: "jQ uery" + ( core_versi on + Math. random() ) .replace( /\D/g, "" ), | |||||
| 1768 | ||||||
| 1769 | // The follo wing eleme nts throw uncatchabl e exceptio ns if you | |||||
| 1770 | // attempt t o add expa ndo proper ties to th em. | |||||
| 1771 | no Data: { | |||||
| 1772 | "emb ed": true, | |||||
| 1773 | // B an all obj ects excep t for Flas h (which h andle expa ndos) | |||||
| 1774 | "obj ect": "cls id:D27CDB6 E-AE6D-11c f-96B8-444 553540000" , | |||||
| 1775 | "app let": true | |||||
| 1776 | }, | |||||
| 1777 | ||||||
| 1778 | ha sData: fun ction( ele m ) { | |||||
| 1779 | elem = elem.no deType ? j Query.cach e[ elem[jQ uery.expan do] ] : el em[ jQuery .expando ] ; | |||||
| 1780 | retu rn !!elem && !isEmpt yDataObjec t( elem ); | |||||
| 1781 | }, | |||||
| 1782 | ||||||
| 1783 | da ta: functi on( elem, name, data ) { | |||||
| 1784 | retu rn interna lData( ele m, name, d ata ); | |||||
| 1785 | }, | |||||
| 1786 | ||||||
| 1787 | re moveData: function( elem, name ) { | |||||
| 1788 | retu rn interna lRemoveDat a( elem, n ame ); | |||||
| 1789 | }, | |||||
| 1790 | ||||||
| 1791 | // For inter nal use on ly. | |||||
| 1792 | _d ata: funct ion( elem, name, dat a ) { | |||||
| 1793 | retu rn interna lData( ele m, name, d ata, true ); | |||||
| 1794 | }, | |||||
| 1795 | ||||||
| 1796 | _r emoveData: function( elem, nam e ) { | |||||
| 1797 | retu rn interna lRemoveDat a( elem, n ame, true ); | |||||
| 1798 | }, | |||||
| 1799 | ||||||
| 1800 | // A method for determ ining if a DOM node can handle the data expando | |||||
| 1801 | ac ceptData: function( elem ) { | |||||
| 1802 | // D o not set data on no n-element because it will not be cleared (#8335). | |||||
| 1803 | if ( elem.node Type && el em.nodeTyp e !== 1 && elem.node Type !== 9 ) { | |||||
| 1804 | return false; | |||||
| 1805 | } | |||||
| 1806 | ||||||
| 1807 | var noData = e lem.nodeNa me && jQue ry.noData[ elem.node Name.toLow erCase() ] ; | |||||
| 1808 | ||||||
| 1809 | // n odes accep t data unl ess otherw ise specif ied; rejec tion can b e conditio nal | |||||
| 1810 | retu rn !noData || noData !== true && elem.ge tAttribute ("classid" ) === noDa ta; | |||||
| 1811 | } | |||||
| 1812 | }); | |||||
| 1813 | ||||||
| 1814 | jQuery.fn. extend({ | |||||
| 1815 | da ta: functi on( key, v alue ) { | |||||
| 1816 | var attrs, nam e, | |||||
| 1817 | elem = this[0], | |||||
| 1818 | i = 0, | |||||
| 1819 | data = null; | |||||
| 1820 | ||||||
| 1821 | // G ets all va lues | |||||
| 1822 | if ( key === u ndefined ) { | |||||
| 1823 | if ( t his.length ) { | |||||
| 1824 | data = j Query.data ( elem ); | |||||
| 1825 | ||||||
| 1826 | if ( ele m.nodeType === 1 && !jQuery._d ata( elem, "parsedAt trs" ) ) { | |||||
| 1827 | attrs = el em.attribu tes; | |||||
| 1828 | for ( ; i < attrs.le ngth; i++ ) { | |||||
| 1829 | na me = attrs [i].name; | |||||
| 1830 | ||||||
| 1831 | if ( !name.i ndexOf( "d ata-" ) ) { | |||||
| 1832 | name = jQuery. camelCase( name.slic e(5) ); | |||||
| 1833 | ||||||
| 1834 | data Attr( elem , name, da ta[ name ] ); | |||||
| 1835 | } | |||||
| 1836 | } | |||||
| 1837 | jQuery._da ta( elem, "parsedAtt rs", true ); | |||||
| 1838 | } | |||||
| 1839 | } | |||||
| 1840 | ||||||
| 1841 | return data; | |||||
| 1842 | } | |||||
| 1843 | ||||||
| 1844 | // S ets multip le values | |||||
| 1845 | if ( typeof ke y === "obj ect" ) { | |||||
| 1846 | return this.each (function( ) { | |||||
| 1847 | jQuery.d ata( this, key ); | |||||
| 1848 | }); | |||||
| 1849 | } | |||||
| 1850 | ||||||
| 1851 | retu rn jQuery. access( th is, functi on( value ) { | |||||
| 1852 | ||||||
| 1853 | if ( v alue === u ndefined ) { | |||||
| 1854 | // Try t o fetch an y internal ly stored data first | |||||
| 1855 | return e lem ? data Attr( elem , key, jQu ery.data( elem, key ) ) : null ; | |||||
| 1856 | } | |||||
| 1857 | ||||||
| 1858 | this.e ach(functi on() { | |||||
| 1859 | jQuery.d ata( this, key, valu e ); | |||||
| 1860 | }); | |||||
| 1861 | }, n ull, value , argument s.length > 1, null, true ); | |||||
| 1862 | }, | |||||
| 1863 | ||||||
| 1864 | re moveData: function( key ) { | |||||
| 1865 | retu rn this.ea ch(functio n() { | |||||
| 1866 | jQuery .removeDat a( this, k ey ); | |||||
| 1867 | }); | |||||
| 1868 | } | |||||
| 1869 | }); | |||||
| 1870 | ||||||
| 1871 | function d ataAttr( e lem, key, data ) { | |||||
| 1872 | // If nothin g was foun d internal ly, try to fetch any | |||||
| 1873 | // data from the HTML5 data-* at tribute | |||||
| 1874 | if ( data == = undefine d && elem. nodeType = == 1 ) { | |||||
| 1875 | ||||||
| 1876 | var name = "da ta-" + key .replace( rmultiDash , "-$1" ). toLowerCas e(); | |||||
| 1877 | ||||||
| 1878 | data = elem.ge tAttribute ( name ); | |||||
| 1879 | ||||||
| 1880 | if ( typeof da ta === "st ring" ) { | |||||
| 1881 | try { | |||||
| 1882 | data = d ata === "t rue" ? tru e : | |||||
| 1883 | data === " false" ? f alse : | |||||
| 1884 | data === " null" ? nu ll : | |||||
| 1885 | // Only co nvert to a number if it doesn' t change t he string | |||||
| 1886 | +data + "" === data ? +data : | |||||
| 1887 | rbrace.tes t( data ) ? jQuery.p arseJSON( data ) : | |||||
| 1888 | da ta; | |||||
| 1889 | } catc h( e ) {} | |||||
| 1890 | ||||||
| 1891 | // Mak e sure we set the da ta so it i sn't chang ed later | |||||
| 1892 | jQuery .data( ele m, key, da ta ); | |||||
| 1893 | ||||||
| 1894 | } el se { | |||||
| 1895 | data = undefined ; | |||||
| 1896 | } | |||||
| 1897 | } | |||||
| 1898 | ||||||
| 1899 | re turn data; | |||||
| 1900 | } | |||||
| 1901 | ||||||
| 1902 | // checks a cache ob ject for e mptiness | |||||
| 1903 | function i sEmptyData Object( ob j ) { | |||||
| 1904 | va r name; | |||||
| 1905 | fo r ( name i n obj ) { | |||||
| 1906 | ||||||
| 1907 | // i f the publ ic data ob ject is em pty, the p rivate is still empt y | |||||
| 1908 | if ( name === "data" && jQuery.isE mptyObject ( obj[name ] ) ) { | |||||
| 1909 | contin ue; | |||||
| 1910 | } | |||||
| 1911 | if ( name !== "toJSON" ) { | |||||
| 1912 | return false; | |||||
| 1913 | } | |||||
| 1914 | } | |||||
| 1915 | ||||||
| 1916 | re turn true; | |||||
| 1917 | } | |||||
| 1918 | jQuery.ext end({ | |||||
| 1919 | qu eue: funct ion( elem, type, dat a ) { | |||||
| 1920 | var queue; | |||||
| 1921 | ||||||
| 1922 | if ( elem ) { | |||||
| 1923 | type = ( type || "fx" ) + "queue"; | |||||
| 1924 | queue = jQuery._ data( elem , type ); | |||||
| 1925 | ||||||
| 1926 | // Spe ed up dequ eue by get ting out q uickly if this is ju st a looku p | |||||
| 1927 | if ( d ata ) { | |||||
| 1928 | if ( !qu eue || jQu ery.isArra y(data) ) { | |||||
| 1929 | queue = jQ uery._data ( elem, ty pe, jQuery .makeArray (data) ); | |||||
| 1930 | } else { | |||||
| 1931 | queue.push ( data ); | |||||
| 1932 | } | |||||
| 1933 | } | |||||
| 1934 | return queue || []; | |||||
| 1935 | } | |||||
| 1936 | }, | |||||
| 1937 | ||||||
| 1938 | de queue: fun ction( ele m, type ) { | |||||
| 1939 | type = type || "fx"; | |||||
| 1940 | ||||||
| 1941 | var queue = jQ uery.queue ( elem, ty pe ), | |||||
| 1942 | startL ength = qu eue.length , | |||||
| 1943 | fn = q ueue.shift (), | |||||
| 1944 | hooks = jQuery._ queueHooks ( elem, ty pe ), | |||||
| 1945 | next = function( ) { | |||||
| 1946 | jQuery.d equeue( el em, type ) ; | |||||
| 1947 | }; | |||||
| 1948 | ||||||
| 1949 | // I f the fx q ueue is de queued, al ways remov e the prog ress senti nel | |||||
| 1950 | if ( fn === "i nprogress" ) { | |||||
| 1951 | fn = q ueue.shift (); | |||||
| 1952 | startL ength--; | |||||
| 1953 | } | |||||
| 1954 | ||||||
| 1955 | hook s.cur = fn ; | |||||
| 1956 | if ( fn ) { | |||||
| 1957 | ||||||
| 1958 | // Add a progres s sentinel to preven t the fx q ueue from being | |||||
| 1959 | // aut omatically dequeued | |||||
| 1960 | if ( t ype === "f x" ) { | |||||
| 1961 | queue.un shift( "in progress" ); | |||||
| 1962 | } | |||||
| 1963 | ||||||
| 1964 | // cle ar up the last queue stop func tion | |||||
| 1965 | delete hooks.sto p; | |||||
| 1966 | fn.cal l( elem, n ext, hooks ); | |||||
| 1967 | } | |||||
| 1968 | ||||||
| 1969 | if ( !startLen gth && hoo ks ) { | |||||
| 1970 | hooks. empty.fire (); | |||||
| 1971 | } | |||||
| 1972 | }, | |||||
| 1973 | ||||||
| 1974 | // not inten ded for pu blic consu mption - g enerates a queueHook s object, or returns the curre nt one | |||||
| 1975 | _q ueueHooks: function( elem, typ e ) { | |||||
| 1976 | var key = type + "queueH ooks"; | |||||
| 1977 | retu rn jQuery. _data( ele m, key ) | | jQuery._ data( elem , key, { | |||||
| 1978 | empty: jQuery.Ca llbacks("o nce memory ").add(fun ction() { | |||||
| 1979 | jQuery._ removeData ( elem, ty pe + "queu e" ); | |||||
| 1980 | jQuery._ removeData ( elem, ke y ); | |||||
| 1981 | }) | |||||
| 1982 | }); | |||||
| 1983 | } | |||||
| 1984 | }); | |||||
| 1985 | ||||||
| 1986 | jQuery.fn. extend({ | |||||
| 1987 | qu eue: funct ion( type, data ) { | |||||
| 1988 | var setter = 2 ; | |||||
| 1989 | ||||||
| 1990 | if ( typeof ty pe !== "st ring" ) { | |||||
| 1991 | data = type; | |||||
| 1992 | type = "fx"; | |||||
| 1993 | setter --; | |||||
| 1994 | } | |||||
| 1995 | ||||||
| 1996 | if ( arguments .length < setter ) { | |||||
| 1997 | return jQuery.qu eue( this[ 0], type ) ; | |||||
| 1998 | } | |||||
| 1999 | ||||||
| 2000 | retu rn data == = undefine d ? | |||||
| 2001 | this : | |||||
| 2002 | this.e ach(functi on() { | |||||
| 2003 | var queu e = jQuery .queue( th is, type, data ); | |||||
| 2004 | ||||||
| 2005 | // ensur e a hooks for this q ueue | |||||
| 2006 | jQuery._ queueHooks ( this, ty pe ); | |||||
| 2007 | ||||||
| 2008 | if ( typ e === "fx" && queue[ 0] !== "in progress" ) { | |||||
| 2009 | jQuery.deq ueue( this , type ); | |||||
| 2010 | } | |||||
| 2011 | }); | |||||
| 2012 | }, | |||||
| 2013 | de queue: fun ction( typ e ) { | |||||
| 2014 | retu rn this.ea ch(functio n() { | |||||
| 2015 | jQuery .dequeue( this, type ); | |||||
| 2016 | }); | |||||
| 2017 | }, | |||||
| 2018 | // Based off of the pl ugin by Cl int Helfer s, with pe rmission. | |||||
| 2019 | // http://bl indsignals .com/index .php/2009/ 07/jquery- delay/ | |||||
| 2020 | de lay: funct ion( time, type ) { | |||||
| 2021 | time = jQuery. fx ? jQuer y.fx.speed s[ time ] || time : time; | |||||
| 2022 | type = type || "fx"; | |||||
| 2023 | ||||||
| 2024 | retu rn this.qu eue( type, function( next, hoo ks ) { | |||||
| 2025 | var ti meout = se tTimeout( next, time ); | |||||
| 2026 | hooks. stop = fun ction() { | |||||
| 2027 | clearTim eout( time out ); | |||||
| 2028 | }; | |||||
| 2029 | }); | |||||
| 2030 | }, | |||||
| 2031 | cl earQueue: function( type ) { | |||||
| 2032 | retu rn this.qu eue( type || "fx", [ ] ); | |||||
| 2033 | }, | |||||
| 2034 | // Get a pro mise resol ved when q ueues of a certain t ype | |||||
| 2035 | // are empti ed (fx is the type b y default) | |||||
| 2036 | pr omise: fun ction( typ e, obj ) { | |||||
| 2037 | var tmp, | |||||
| 2038 | count = 1, | |||||
| 2039 | defer = jQuery.D eferred(), | |||||
| 2040 | elemen ts = this, | |||||
| 2041 | i = th is.length, | |||||
| 2042 | resolv e = functi on() { | |||||
| 2043 | if ( !( --count ) ) { | |||||
| 2044 | defer.reso lveWith( e lements, [ elements ] ); | |||||
| 2045 | } | |||||
| 2046 | }; | |||||
| 2047 | ||||||
| 2048 | if ( typeof ty pe !== "st ring" ) { | |||||
| 2049 | obj = type; | |||||
| 2050 | type = undefined ; | |||||
| 2051 | } | |||||
| 2052 | type = type || "fx"; | |||||
| 2053 | ||||||
| 2054 | whil e( i-- ) { | |||||
| 2055 | tmp = jQuery._da ta( elemen ts[ i ], t ype + "que ueHooks" ) ; | |||||
| 2056 | if ( t mp && tmp. empty ) { | |||||
| 2057 | count++; | |||||
| 2058 | tmp.empt y.add( res olve ); | |||||
| 2059 | } | |||||
| 2060 | } | |||||
| 2061 | reso lve(); | |||||
| 2062 | retu rn defer.p romise( ob j ); | |||||
| 2063 | } | |||||
| 2064 | }); | |||||
| 2065 | var nodeHo ok, boolHo ok, | |||||
| 2066 | rc lass = /[\ t\r\n]/g, | |||||
| 2067 | rr eturn = /\ r/g, | |||||
| 2068 | rf ocusable = /^(?:inpu t|select|t extarea|bu tton|objec t)$/i, | |||||
| 2069 | rc lickable = /^(?:a|ar ea)$/i, | |||||
| 2070 | rb oolean = / ^(?:checke d|selected |autofocus |autoplay| async|cont rols|defer |disabled| hidden|loo p|multiple |open|read only|requi red|scoped )$/i, | |||||
| 2071 | ru seDefault = /^(?:che cked|selec ted)$/i, | |||||
| 2072 | ge tSetAttrib ute = jQue ry.support .getSetAtt ribute, | |||||
| 2073 | ge tSetInput = jQuery.s upport.inp ut; | |||||
| 2074 | ||||||
| 2075 | jQuery.fn. extend({ | |||||
| 2076 | at tr: functi on( name, value ) { | |||||
| 2077 | retu rn jQuery. access( th is, jQuery .attr, nam e, value, arguments. length > 1 ); | |||||
| 2078 | }, | |||||
| 2079 | ||||||
| 2080 | re moveAttr: function( name ) { | |||||
| 2081 | retu rn this.ea ch(functio n() { | |||||
| 2082 | jQuery .removeAtt r( this, n ame ); | |||||
| 2083 | }); | |||||
| 2084 | }, | |||||
| 2085 | ||||||
| 2086 | pr op: functi on( name, value ) { | |||||
| 2087 | retu rn jQuery. access( th is, jQuery .prop, nam e, value, arguments. length > 1 ); | |||||
| 2088 | }, | |||||
| 2089 | ||||||
| 2090 | re moveProp: function( name ) { | |||||
| 2091 | name = jQuery. propFix[ n ame ] || n ame; | |||||
| 2092 | retu rn this.ea ch(functio n() { | |||||
| 2093 | // try /catch han dles cases where IE balks (suc h as remov ing a prop erty on wi ndow) | |||||
| 2094 | try { | |||||
| 2095 | this[ na me ] = und efined; | |||||
| 2096 | delete t his[ name ]; | |||||
| 2097 | } catc h( e ) {} | |||||
| 2098 | }); | |||||
| 2099 | }, | |||||
| 2100 | ||||||
| 2101 | ad dClass: fu nction( va lue ) { | |||||
| 2102 | var classes, e lem, cur, clazz, j, | |||||
| 2103 | i = 0, | |||||
| 2104 | len = this.lengt h, | |||||
| 2105 | procee d = typeof value === "string" && value; | |||||
| 2106 | ||||||
| 2107 | if ( jQuery.is Function( value ) ) { | |||||
| 2108 | return this.each (function( j ) { | |||||
| 2109 | jQuery( this ).add Class( val ue.call( t his, j, th is.classNa me ) ); | |||||
| 2110 | }); | |||||
| 2111 | } | |||||
| 2112 | ||||||
| 2113 | if ( proceed ) { | |||||
| 2114 | // The disjuncti on here is for bette r compress ibility (s ee removeC lass) | |||||
| 2115 | classe s = ( valu e || "" ). match( cor e_rnotwhit e ) || []; | |||||
| 2116 | ||||||
| 2117 | for ( ; i < len; i++ ) { | |||||
| 2118 | elem = t his[ i ]; | |||||
| 2119 | cur = el em.nodeTyp e === 1 && ( elem.cl assName ? | |||||
| 2120 | ( " " + el em.classNa me + " " ) .replace( rclass, " " ) : | |||||
| 2121 | " " | |||||
| 2122 | ); | |||||
| 2123 | ||||||
| 2124 | if ( cur ) { | |||||
| 2125 | j = 0; | |||||
| 2126 | while ( (c lazz = cla sses[j++]) ) { | |||||
| 2127 | if ( cur.ind exOf( " " + clazz + " " ) < 0 ) { | |||||
| 2128 | cur += clazz + " "; | |||||
| 2129 | } | |||||
| 2130 | } | |||||
| 2131 | elem.class Name = jQu ery.trim( cur ); | |||||
| 2132 | ||||||
| 2133 | } | |||||
| 2134 | } | |||||
| 2135 | } | |||||
| 2136 | ||||||
| 2137 | retu rn this; | |||||
| 2138 | }, | |||||
| 2139 | ||||||
| 2140 | re moveClass: function( value ) { | |||||
| 2141 | var classes, e lem, cur, clazz, j, | |||||
| 2142 | i = 0, | |||||
| 2143 | len = this.lengt h, | |||||
| 2144 | procee d = argume nts.length === 0 || typeof val ue === "st ring" && v alue; | |||||
| 2145 | ||||||
| 2146 | if ( jQuery.is Function( value ) ) { | |||||
| 2147 | return this.each (function( j ) { | |||||
| 2148 | jQuery( this ).rem oveClass( value.call ( this, j, this.clas sName ) ); | |||||
| 2149 | }); | |||||
| 2150 | } | |||||
| 2151 | if ( proceed ) { | |||||
| 2152 | classe s = ( valu e || "" ). match( cor e_rnotwhit e ) || []; | |||||
| 2153 | ||||||
| 2154 | for ( ; i < len; i++ ) { | |||||
| 2155 | elem = t his[ i ]; | |||||
| 2156 | // This expression is here f or better compressib ility (see addClass) | |||||
| 2157 | cur = el em.nodeTyp e === 1 && ( elem.cl assName ? | |||||
| 2158 | ( " " + el em.classNa me + " " ) .replace( rclass, " " ) : | |||||
| 2159 | "" | |||||
| 2160 | ); | |||||
| 2161 | ||||||
| 2162 | if ( cur ) { | |||||
| 2163 | j = 0; | |||||
| 2164 | while ( (c lazz = cla sses[j++]) ) { | |||||
| 2165 | // Remove *a ll* instan ces | |||||
| 2166 | wh ile ( cur. indexOf( " " + clazz + " " ) > = 0 ) { | |||||
| 2167 | cur = cur.repl ace( " " + clazz + " ", " " ); | |||||
| 2168 | } | |||||
| 2169 | } | |||||
| 2170 | elem.class Name = val ue ? jQuer y.trim( cu r ) : ""; | |||||
| 2171 | } | |||||
| 2172 | } | |||||
| 2173 | } | |||||
| 2174 | ||||||
| 2175 | retu rn this; | |||||
| 2176 | }, | |||||
| 2177 | ||||||
| 2178 | to ggleClass: function( value, st ateVal ) { | |||||
| 2179 | var type = typ eof value, | |||||
| 2180 | isBool = typeof stateVal = == "boolea n"; | |||||
| 2181 | ||||||
| 2182 | if ( jQuery.is Function( value ) ) { | |||||
| 2183 | return this.each (function( i ) { | |||||
| 2184 | jQuery( this ).tog gleClass( value.call (this, i, this.class Name, stat eVal), sta teVal ); | |||||
| 2185 | }); | |||||
| 2186 | } | |||||
| 2187 | ||||||
| 2188 | retu rn this.ea ch(functio n() { | |||||
| 2189 | if ( t ype === "s tring" ) { | |||||
| 2190 | // toggl e individu al class n ames | |||||
| 2191 | var clas sName, | |||||
| 2192 | i = 0, | |||||
| 2193 | self = jQu ery( this ), | |||||
| 2194 | state = st ateVal, | |||||
| 2195 | classNames = value.m atch( core _rnotwhite ) || []; | |||||
| 2196 | ||||||
| 2197 | while ( (className = classNa mes[ i++ ] ) ) { | |||||
| 2198 | // check e ach classN ame given, space sep arated lis t | |||||
| 2199 | state = is Bool ? sta te : !self .hasClass( className ); | |||||
| 2200 | self[ stat e ? "addCl ass" : "re moveClass" ]( classN ame ); | |||||
| 2201 | } | |||||
| 2202 | ||||||
| 2203 | // Tog gle whole class name | |||||
| 2204 | } else if ( type === core_ strundefin ed || type === "bool ean" ) { | |||||
| 2205 | if ( thi s.classNam e ) { | |||||
| 2206 | // store c lassName i f set | |||||
| 2207 | jQuery._da ta( this, "__classNa me__", thi s.classNam e ); | |||||
| 2208 | } | |||||
| 2209 | ||||||
| 2210 | // If th e element has a clas s name or if we're p assed "fal se", | |||||
| 2211 | // then remove the whole cla ssname (if there was one, the above save d it). | |||||
| 2212 | // Other wise bring back what ever was p reviously saved (if anything), | |||||
| 2213 | // falli ng back to the empty string if nothing w as stored. | |||||
| 2214 | this.cla ssName = t his.classN ame || val ue === fal se ? "" : jQuery._da ta( this, "__classNa me__" ) || ""; | |||||
| 2215 | } | |||||
| 2216 | }); | |||||
| 2217 | }, | |||||
| 2218 | ||||||
| 2219 | ha sClass: fu nction( se lector ) { | |||||
| 2220 | var className = " " + se lector + " ", | |||||
| 2221 | i = 0, | |||||
| 2222 | l = th is.length; | |||||
| 2223 | for ( ; i < l; i++ ) { | |||||
| 2224 | if ( t his[i].nod eType === 1 && (" " + this[i]. className + " ").rep lace(rclas s, " ").in dexOf( cla ssName ) > = 0 ) { | |||||
| 2225 | return t rue; | |||||
| 2226 | } | |||||
| 2227 | } | |||||
| 2228 | ||||||
| 2229 | retu rn false; | |||||
| 2230 | }, | |||||
| 2231 | ||||||
| 2232 | va l: functio n( value ) { | |||||
| 2233 | var ret, hooks , isFuncti on, | |||||
| 2234 | elem = this[0]; | |||||
| 2235 | ||||||
| 2236 | if ( !argument s.length ) { | |||||
| 2237 | if ( e lem ) { | |||||
| 2238 | hooks = jQuery.val Hooks[ ele m.type ] | | jQuery.v alHooks[ e lem.nodeNa me.toLower Case() ]; | |||||
| 2239 | ||||||
| 2240 | if ( hoo ks && "get " in hooks && (ret = hooks.get ( elem, "v alue" )) ! == undefin ed ) { | |||||
| 2241 | return ret ; | |||||
| 2242 | } | |||||
| 2243 | ||||||
| 2244 | ret = el em.value; | |||||
| 2245 | ||||||
| 2246 | return t ypeof ret === "strin g" ? | |||||
| 2247 | // handle most commo n string c ases | |||||
| 2248 | ret.replac e(rreturn, "") : | |||||
| 2249 | // handle cases wher e value is null/unde f or numbe r | |||||
| 2250 | ret == nul l ? "" : r et; | |||||
| 2251 | } | |||||
| 2252 | ||||||
| 2253 | return ; | |||||
| 2254 | } | |||||
| 2255 | ||||||
| 2256 | isFu nction = j Query.isFu nction( va lue ); | |||||
| 2257 | ||||||
| 2258 | retu rn this.ea ch(functio n( i ) { | |||||
| 2259 | var va l, | |||||
| 2260 | self = j Query(this ); | |||||
| 2261 | ||||||
| 2262 | if ( t his.nodeTy pe !== 1 ) { | |||||
| 2263 | return; | |||||
| 2264 | } | |||||
| 2265 | ||||||
| 2266 | if ( i sFunction ) { | |||||
| 2267 | val = va lue.call( this, i, s elf.val() ); | |||||
| 2268 | } else { | |||||
| 2269 | val = va lue; | |||||
| 2270 | } | |||||
| 2271 | ||||||
| 2272 | // Tre at null/un defined as ""; conve rt numbers to string | |||||
| 2273 | if ( v al == null ) { | |||||
| 2274 | val = "" ; | |||||
| 2275 | } else if ( type of val === "number" ) { | |||||
| 2276 | val += " "; | |||||
| 2277 | } else if ( jQue ry.isArray ( val ) ) { | |||||
| 2278 | val = jQ uery.map(v al, functi on ( value ) { | |||||
| 2279 | return val ue == null ? "" : va lue + ""; | |||||
| 2280 | }); | |||||
| 2281 | } | |||||
| 2282 | ||||||
| 2283 | hooks = jQuery.v alHooks[ t his.type ] || jQuery .valHooks[ this.node Name.toLow erCase() ] ; | |||||
| 2284 | ||||||
| 2285 | // If set return s undefine d, fall ba ck to norm al setting | |||||
| 2286 | if ( ! hooks || ! ("set" in hooks) || hooks.set( this, val , "value" ) === unde fined ) { | |||||
| 2287 | this.val ue = val; | |||||
| 2288 | } | |||||
| 2289 | }); | |||||
| 2290 | } | |||||
| 2291 | }); | |||||
| 2292 | ||||||
| 2293 | jQuery.ext end({ | |||||
| 2294 | va lHooks: { | |||||
| 2295 | opti on: { | |||||
| 2296 | get: f unction( e lem ) { | |||||
| 2297 | // attri butes.valu e is undef ined in Bl ackberry 4 .7 but | |||||
| 2298 | // uses .value. Se e #6932 | |||||
| 2299 | var val = elem.att ributes.va lue; | |||||
| 2300 | return ! val || val .specified ? elem.va lue : elem .text; | |||||
| 2301 | } | |||||
| 2302 | }, | |||||
| 2303 | sele ct: { | |||||
| 2304 | get: f unction( e lem ) { | |||||
| 2305 | var valu e, option, | |||||
| 2306 | options = elem.optio ns, | |||||
| 2307 | index = el em.selecte dIndex, | |||||
| 2308 | one = elem .type === "select-on e" || inde x < 0, | |||||
| 2309 | values = o ne ? null : [], | |||||
| 2310 | max = one ? index + 1 : option s.length, | |||||
| 2311 | i = index < 0 ? | |||||
| 2312 | ma x : | |||||
| 2313 | on e ? index : 0; | |||||
| 2314 | ||||||
| 2315 | // Loop through al l the sele cted optio ns | |||||
| 2316 | for ( ; i < max; i ++ ) { | |||||
| 2317 | option = o ptions[ i ]; | |||||
| 2318 | ||||||
| 2319 | // oldIE d oesn't upd ate select ed after f orm reset (#2551) | |||||
| 2320 | if ( ( opt ion.select ed || i == = index ) && | |||||
| 2321 | // D on't retur n options that are d isabled or in a disa bled optgr oup | |||||
| 2322 | ( jQ uery.suppo rt.optDisa bled ? !op tion.disab led : opti on.getAttr ibute("dis abled") == = null ) & & | |||||
| 2323 | ( !o ption.pare ntNode.dis abled || ! jQuery.nod eName( opt ion.parent Node, "opt group" ) ) ) { | |||||
| 2324 | ||||||
| 2325 | // Get the s pecific va lue for th e option | |||||
| 2326 | va lue = jQue ry( option ).val(); | |||||
| 2327 | ||||||
| 2328 | // We don't need an ar ray for on e selects | |||||
| 2329 | if ( one ) { | |||||
| 2330 | retu rn value; | |||||
| 2331 | } | |||||
| 2332 | ||||||
| 2333 | // Multi-Sel ects retur n an array | |||||
| 2334 | va lues.push( value ); | |||||
| 2335 | } | |||||
| 2336 | } | |||||
| 2337 | ||||||
| 2338 | return v alues; | |||||
| 2339 | }, | |||||
| 2340 | ||||||
| 2341 | set: f unction( e lem, value ) { | |||||
| 2342 | var valu es = jQuer y.makeArra y( value ) ; | |||||
| 2343 | ||||||
| 2344 | jQuery(e lem).find( "option"). each(funct ion() { | |||||
| 2345 | this.selec ted = jQue ry.inArray ( jQuery(t his).val() , values ) >= 0; | |||||
| 2346 | }); | |||||
| 2347 | ||||||
| 2348 | if ( !va lues.lengt h ) { | |||||
| 2349 | elem.selec tedIndex = -1; | |||||
| 2350 | } | |||||
| 2351 | return v alues; | |||||
| 2352 | } | |||||
| 2353 | } | |||||
| 2354 | }, | |||||
| 2355 | ||||||
| 2356 | at tr: functi on( elem, name, valu e ) { | |||||
| 2357 | var hooks, not xml, ret, | |||||
| 2358 | nType = elem.nod eType; | |||||
| 2359 | ||||||
| 2360 | // d on't get/s et attribu tes on tex t, comment and attri bute nodes | |||||
| 2361 | if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { | |||||
| 2362 | return ; | |||||
| 2363 | } | |||||
| 2364 | ||||||
| 2365 | // F allback to prop when attribute s are not supported | |||||
| 2366 | if ( typeof el em.getAttr ibute === core_strun defined ) { | |||||
| 2367 | return jQuery.pr op( elem, name, valu e ); | |||||
| 2368 | } | |||||
| 2369 | ||||||
| 2370 | notx ml = nType !== 1 || !jQuery.is XMLDoc( el em ); | |||||
| 2371 | ||||||
| 2372 | // A ll attribu tes are lo wercase | |||||
| 2373 | // G rab necess ary hook i f one is d efined | |||||
| 2374 | if ( notxml ) { | |||||
| 2375 | name = name.toLo werCase(); | |||||
| 2376 | hooks = jQuery.a ttrHooks[ name ] || ( rboolean .test( nam e ) ? bool Hook : nod eHook ); | |||||
| 2377 | } | |||||
| 2378 | ||||||
| 2379 | if ( value !== undefined ) { | |||||
| 2380 | ||||||
| 2381 | if ( v alue === n ull ) { | |||||
| 2382 | jQuery.r emoveAttr( elem, nam e ); | |||||
| 2383 | ||||||
| 2384 | } else if ( hook s && notxm l && "set" in hooks && (ret = hooks.set( elem, val ue, name ) ) !== unde fined ) { | |||||
| 2385 | return r et; | |||||
| 2386 | ||||||
| 2387 | } else { | |||||
| 2388 | elem.set Attribute( name, val ue + "" ); | |||||
| 2389 | return v alue; | |||||
| 2390 | } | |||||
| 2391 | ||||||
| 2392 | } el se if ( ho oks && not xml && "ge t" in hook s && (ret = hooks.ge t( elem, n ame )) !== null ) { | |||||
| 2393 | return ret; | |||||
| 2394 | ||||||
| 2395 | } el se { | |||||
| 2396 | ||||||
| 2397 | // In IE9+, Flas h objects don't have .getAttri bute (#129 45) | |||||
| 2398 | // Sup port: IE9+ | |||||
| 2399 | if ( t ypeof elem .getAttrib ute !== co re_strunde fined ) { | |||||
| 2400 | ret = e lem.getAtt ribute( na me ); | |||||
| 2401 | } | |||||
| 2402 | ||||||
| 2403 | // Non -existent attributes return nu ll, we nor malize to undefined | |||||
| 2404 | return ret == nu ll ? | |||||
| 2405 | undefine d : | |||||
| 2406 | ret; | |||||
| 2407 | } | |||||
| 2408 | }, | |||||
| 2409 | ||||||
| 2410 | re moveAttr: function( elem, valu e ) { | |||||
| 2411 | var name, prop Name, | |||||
| 2412 | i = 0, | |||||
| 2413 | attrNa mes = valu e && value .match( co re_rnotwhi te ); | |||||
| 2414 | ||||||
| 2415 | if ( attrNames && elem.n odeType == = 1 ) { | |||||
| 2416 | while ( (name = attrNames[ i++]) ) { | |||||
| 2417 | propName = jQuery. propFix[ n ame ] || n ame; | |||||
| 2418 | ||||||
| 2419 | // Boole an attribu tes get sp ecial trea tment (#10 870) | |||||
| 2420 | if ( rbo olean.test ( name ) ) { | |||||
| 2421 | // Set cor responding property to false f or boolean attribute s | |||||
| 2422 | // Also cl ear defaul tChecked/d efaultSele cted (if a ppropriate ) for IE<8 | |||||
| 2423 | if ( !getS etAttribut e && ruseD efault.tes t( name ) ) { | |||||
| 2424 | el em[ jQuery .camelCase ( "default -" + name ) ] = | |||||
| 2425 | elem [ propName ] = false ; | |||||
| 2426 | } else { | |||||
| 2427 | el em[ propNa me ] = fal se; | |||||
| 2428 | } | |||||
| 2429 | ||||||
| 2430 | // See # 9699 for e xplanation of this a pproach (s etting fir st, then r emoval) | |||||
| 2431 | } else { | |||||
| 2432 | jQuery.att r( elem, n ame, "" ); | |||||
| 2433 | } | |||||
| 2434 | ||||||
| 2435 | elem.rem oveAttribu te( getSet Attribute ? name : p ropName ); | |||||
| 2436 | } | |||||
| 2437 | } | |||||
| 2438 | }, | |||||
| 2439 | ||||||
| 2440 | at trHooks: { | |||||
| 2441 | type : { | |||||
| 2442 | set: f unction( e lem, value ) { | |||||
| 2443 | if ( !jQ uery.suppo rt.radioVa lue && val ue === "ra dio" && jQ uery.nodeN ame(elem, "input") ) { | |||||
| 2444 | // Setting the type on a radio button af ter the va lue resets the value in IE6-9 | |||||
| 2445 | // Reset v alue to de fault in c ase type i s set afte r value du ring creat ion | |||||
| 2446 | var val = elem.value ; | |||||
| 2447 | elem.setAt tribute( " type", val ue ); | |||||
| 2448 | if ( val ) { | |||||
| 2449 | el em.value = val; | |||||
| 2450 | } | |||||
| 2451 | return val ue; | |||||
| 2452 | } | |||||
| 2453 | } | |||||
| 2454 | } | |||||
| 2455 | }, | |||||
| 2456 | ||||||
| 2457 | pr opFix: { | |||||
| 2458 | tabi ndex: "tab Index", | |||||
| 2459 | read only: "rea dOnly", | |||||
| 2460 | "for ": "htmlFo r", | |||||
| 2461 | "cla ss": "clas sName", | |||||
| 2462 | maxl ength: "ma xLength", | |||||
| 2463 | cell spacing: " cellSpacin g", | |||||
| 2464 | cell padding: " cellPaddin g", | |||||
| 2465 | rows pan: "rowS pan", | |||||
| 2466 | cols pan: "colS pan", | |||||
| 2467 | usem ap: "useMa p", | |||||
| 2468 | fram eborder: " frameBorde r", | |||||
| 2469 | cont enteditabl e: "conten tEditable" | |||||
| 2470 | }, | |||||
| 2471 | ||||||
| 2472 | pr op: functi on( elem, name, valu e ) { | |||||
| 2473 | var ret, hooks , notxml, | |||||
| 2474 | nType = elem.nod eType; | |||||
| 2475 | ||||||
| 2476 | // d on't get/s et propert ies on tex t, comment and attri bute nodes | |||||
| 2477 | if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { | |||||
| 2478 | return ; | |||||
| 2479 | } | |||||
| 2480 | ||||||
| 2481 | notx ml = nType !== 1 || !jQuery.is XMLDoc( el em ); | |||||
| 2482 | ||||||
| 2483 | if ( notxml ) { | |||||
| 2484 | // Fix name and attach hoo ks | |||||
| 2485 | name = jQuery.pr opFix[ nam e ] || nam e; | |||||
| 2486 | hooks = jQuery.p ropHooks[ name ]; | |||||
| 2487 | } | |||||
| 2488 | ||||||
| 2489 | if ( value !== undefined ) { | |||||
| 2490 | if ( h ooks && "s et" in hoo ks && (ret = hooks.s et( elem, value, nam e )) !== u ndefined ) { | |||||
| 2491 | return r et; | |||||
| 2492 | ||||||
| 2493 | } else { | |||||
| 2494 | return ( elem[ nam e ] = valu e ); | |||||
| 2495 | } | |||||
| 2496 | ||||||
| 2497 | } el se { | |||||
| 2498 | if ( h ooks && "g et" in hoo ks && (ret = hooks.g et( elem, name )) != = null ) { | |||||
| 2499 | return r et; | |||||
| 2500 | ||||||
| 2501 | } else { | |||||
| 2502 | return e lem[ name ]; | |||||
| 2503 | } | |||||
| 2504 | } | |||||
| 2505 | }, | |||||
| 2506 | ||||||
| 2507 | pr opHooks: { | |||||
| 2508 | tabI ndex: { | |||||
| 2509 | get: f unction( e lem ) { | |||||
| 2510 | // elem. tabIndex d oesn't alw ays return the corre ct value w hen it has n't been e xplicitly set | |||||
| 2511 | // http: //fluidpro ject.org/b log/2008/0 1/09/getti ng-setting -and-remov ing-tabind ex-values- with-javas cript/ | |||||
| 2512 | var attr ibuteNode = elem.get AttributeN ode("tabin dex"); | |||||
| 2513 | ||||||
| 2514 | return a ttributeNo de && attr ibuteNode. specified ? | |||||
| 2515 | parseInt( attributeN ode.value, 10 ) : | |||||
| 2516 | rfocusable .test( ele m.nodeName ) || rcli ckable.tes t( elem.no deName ) & & elem.hre f ? | |||||
| 2517 | 0 : | |||||
| 2518 | un defined; | |||||
| 2519 | } | |||||
| 2520 | } | |||||
| 2521 | } | |||||
| 2522 | }); | |||||
| 2523 | ||||||
| 2524 | // Hook fo r boolean attributes | |||||
| 2525 | boolHook = { | |||||
| 2526 | ge t: functio n( elem, n ame ) { | |||||
| 2527 | var | |||||
| 2528 | // Use .prop to determine if this at tribute is understoo d as boole an | |||||
| 2529 | prop = jQuery.pr op( elem, name ), | |||||
| 2530 | ||||||
| 2531 | // Fet ch it acco rdingly | |||||
| 2532 | attr = typeof pr op === "bo olean" && elem.getAt tribute( n ame ), | |||||
| 2533 | detail = typeof prop === " boolean" ? | |||||
| 2534 | ||||||
| 2535 | getSetIn put && get SetAttribu te ? | |||||
| 2536 | attr != nu ll : | |||||
| 2537 | // oldIE f abricates an empty s tring for missing bo olean attr ibutes | |||||
| 2538 | // and con flates che cked/selec ted into a ttropertie s | |||||
| 2539 | ruseDefaul t.test( na me ) ? | |||||
| 2540 | el em[ jQuery .camelCase ( "default -" + name ) ] : | |||||
| 2541 | !! attr : | |||||
| 2542 | ||||||
| 2543 | // fetch an attrib ute node f or propert ies not re cognized a s boolean | |||||
| 2544 | elem.get AttributeN ode( name ); | |||||
| 2545 | ||||||
| 2546 | retu rn detail && detail. value !== false ? | |||||
| 2547 | name.t oLowerCase () : | |||||
| 2548 | undefi ned; | |||||
| 2549 | }, | |||||
| 2550 | se t: functio n( elem, v alue, name ) { | |||||
| 2551 | if ( value === false ) { | |||||
| 2552 | // Rem ove boolea n attribut es when se t to false | |||||
| 2553 | jQuery .removeAtt r( elem, n ame ); | |||||
| 2554 | } el se if ( ge tSetInput && getSetA ttribute | | !ruseDef ault.test( name ) ) { | |||||
| 2555 | // IE< 8 needs th e *propert y* name | |||||
| 2556 | elem.s etAttribut e( !getSet Attribute && jQuery. propFix[ n ame ] || n ame, name ); | |||||
| 2557 | ||||||
| 2558 | // U se default Checked an d defaultS elected fo r oldIE | |||||
| 2559 | } el se { | |||||
| 2560 | elem[ jQuery.cam elCase( "d efault-" + name ) ] = elem[ na me ] = tru e; | |||||
| 2561 | } | |||||
| 2562 | ||||||
| 2563 | retu rn name; | |||||
| 2564 | } | |||||
| 2565 | }; | |||||
| 2566 | ||||||
| 2567 | // fix old IE value a ttroperty | |||||
| 2568 | if ( !getS etInput || !getSetAt tribute ) { | |||||
| 2569 | jQ uery.attrH ooks.value = { | |||||
| 2570 | get: function( elem, nam e ) { | |||||
| 2571 | var re t = elem.g etAttribut eNode( nam e ); | |||||
| 2572 | return jQuery.no deName( el em, "input " ) ? | |||||
| 2573 | ||||||
| 2574 | // Ignor e the valu e *propert y* by usin g defaultV alue | |||||
| 2575 | elem.def aultValue : | |||||
| 2576 | ||||||
| 2577 | ret && r et.specifi ed ? ret.v alue : und efined; | |||||
| 2578 | }, | |||||
| 2579 | set: function( elem, val ue, name ) { | |||||
| 2580 | if ( j Query.node Name( elem , "input" ) ) { | |||||
| 2581 | // Does not return so that s etAttribut e is also used | |||||
| 2582 | elem.def aultValue = value; | |||||
| 2583 | } else { | |||||
| 2584 | // Use n odeHook if defined ( #1954); ot herwise se tAttribute is fine | |||||
| 2585 | return n odeHook && nodeHook. set( elem, value, na me ); | |||||
| 2586 | } | |||||
| 2587 | } | |||||
| 2588 | }; | |||||
| 2589 | } | |||||
| 2590 | ||||||
| 2591 | // IE6/7 d o not supp ort gettin g/setting some attri butes with get/setAt tribute | |||||
| 2592 | if ( !getS etAttribut e ) { | |||||
| 2593 | ||||||
| 2594 | // Use this for any at tribute in IE6/7 | |||||
| 2595 | // This fixe s almost e very IE6/7 issue | |||||
| 2596 | no deHook = j Query.valH ooks.butto n = { | |||||
| 2597 | get: function( elem, nam e ) { | |||||
| 2598 | var re t = elem.g etAttribut eNode( nam e ); | |||||
| 2599 | return ret && ( name === " id" || nam e === "nam e" || name === "coor ds" ? ret. value !== "" : ret.s pecified ) ? | |||||
| 2600 | ret.valu e : | |||||
| 2601 | undefine d; | |||||
| 2602 | }, | |||||
| 2603 | set: function( elem, val ue, name ) { | |||||
| 2604 | // Set the exist ing or cre ate a new attribute node | |||||
| 2605 | var re t = elem.g etAttribut eNode( nam e ); | |||||
| 2606 | if ( ! ret ) { | |||||
| 2607 | elem.set AttributeN ode( | |||||
| 2608 | (ret = ele m.ownerDoc ument.crea teAttribut e( name )) | |||||
| 2609 | ); | |||||
| 2610 | } | |||||
| 2611 | ||||||
| 2612 | ret.va lue = valu e += ""; | |||||
| 2613 | ||||||
| 2614 | // Bre ak associa tion with cloned ele ments by a lso using setAttribu te (#9646) | |||||
| 2615 | return name === "value" || value === elem.getA ttribute( name ) ? | |||||
| 2616 | value : | |||||
| 2617 | undefine d; | |||||
| 2618 | } | |||||
| 2619 | }; | |||||
| 2620 | ||||||
| 2621 | // Set conte nteditable to false on removal s(#10429) | |||||
| 2622 | // Setting t o empty st ring throw s an error as an inv alid value | |||||
| 2623 | jQ uery.attrH ooks.conte nteditable = { | |||||
| 2624 | get: nodeHook. get, | |||||
| 2625 | set: function( elem, val ue, name ) { | |||||
| 2626 | nodeHo ok.set( el em, value === "" ? f alse : val ue, name ) ; | |||||
| 2627 | } | |||||
| 2628 | }; | |||||
| 2629 | ||||||
| 2630 | // Set width and heigh t to auto instead of 0 on empt y string( Bug #8150 ) | |||||
| 2631 | // This is f or removal s | |||||
| 2632 | jQ uery.each( [ "width", "height" ], functio n( i, name ) { | |||||
| 2633 | jQue ry.attrHoo ks[ name ] = jQuery. extend( jQ uery.attrH ooks[ name ], { | |||||
| 2634 | set: f unction( e lem, value ) { | |||||
| 2635 | if ( val ue === "" ) { | |||||
| 2636 | elem.setAt tribute( n ame, "auto " ); | |||||
| 2637 | return val ue; | |||||
| 2638 | } | |||||
| 2639 | } | |||||
| 2640 | }); | |||||
| 2641 | }) ; | |||||
| 2642 | } | |||||
| 2643 | ||||||
| 2644 | ||||||
| 2645 | // Some at tributes r equire a s pecial cal l on IE | |||||
| 2646 | // http:// msdn.micro soft.com/e n-us/libra ry/ms53642 9%28VS.85% 29.aspx | |||||
| 2647 | if ( !jQue ry.support .hrefNorma lized ) { | |||||
| 2648 | jQ uery.each( [ "href", "src", "wi dth", "hei ght" ], fu nction( i, name ) { | |||||
| 2649 | jQue ry.attrHoo ks[ name ] = jQuery. extend( jQ uery.attrH ooks[ name ], { | |||||
| 2650 | get: f unction( e lem ) { | |||||
| 2651 | var ret = elem.get Attribute( name, 2 ) ; | |||||
| 2652 | return r et == null ? undefin ed : ret; | |||||
| 2653 | } | |||||
| 2654 | }); | |||||
| 2655 | }) ; | |||||
| 2656 | ||||||
| 2657 | // href/src property s hould get the full n ormalized URL (#1029 9/#12915) | |||||
| 2658 | jQ uery.each( [ "href", "src" ], f unction( i , name ) { | |||||
| 2659 | jQue ry.propHoo ks[ name ] = { | |||||
| 2660 | get: f unction( e lem ) { | |||||
| 2661 | return e lem.getAtt ribute( na me, 4 ); | |||||
| 2662 | } | |||||
| 2663 | }; | |||||
| 2664 | }) ; | |||||
| 2665 | } | |||||
| 2666 | ||||||
| 2667 | if ( !jQue ry.support .style ) { | |||||
| 2668 | jQ uery.attrH ooks.style = { | |||||
| 2669 | get: function( elem ) { | |||||
| 2670 | // Ret urn undefi ned in the case of e mpty strin g | |||||
| 2671 | // Not e: IE uppe rcases css property names, but if we wer e to .toLo werCase() | |||||
| 2672 | // .cs sText, tha t would de stroy case senstitiv ity in URL 's, like i n "backgro und" | |||||
| 2673 | return elem.styl e.cssText || undefin ed; | |||||
| 2674 | }, | |||||
| 2675 | set: function( elem, val ue ) { | |||||
| 2676 | return ( elem.st yle.cssTex t = value + "" ); | |||||
| 2677 | } | |||||
| 2678 | }; | |||||
| 2679 | } | |||||
| 2680 | ||||||
| 2681 | // Safari mis-report s the defa ult select ed propert y of an op tion | |||||
| 2682 | // Accessi ng the par ent's sele ctedIndex property f ixes it | |||||
| 2683 | if ( !jQue ry.support .optSelect ed ) { | |||||
| 2684 | jQ uery.propH ooks.selec ted = jQue ry.extend( jQuery.pr opHooks.se lected, { | |||||
| 2685 | get: function( elem ) { | |||||
| 2686 | var pa rent = ele m.parentNo de; | |||||
| 2687 | ||||||
| 2688 | if ( p arent ) { | |||||
| 2689 | parent.s electedInd ex; | |||||
| 2690 | ||||||
| 2691 | // Make sure that it also wo rks with o ptgroups, see #5701 | |||||
| 2692 | if ( par ent.parent Node ) { | |||||
| 2693 | parent.par entNode.se lectedInde x; | |||||
| 2694 | } | |||||
| 2695 | } | |||||
| 2696 | return null; | |||||
| 2697 | } | |||||
| 2698 | }) ; | |||||
| 2699 | } | |||||
| 2700 | ||||||
| 2701 | // IE6/7 c all enctyp e encoding | |||||
| 2702 | if ( !jQue ry.support .enctype ) { | |||||
| 2703 | jQ uery.propF ix.enctype = "encodi ng"; | |||||
| 2704 | } | |||||
| 2705 | ||||||
| 2706 | // Radios and checkb oxes gette r/setter | |||||
| 2707 | if ( !jQue ry.support .checkOn ) { | |||||
| 2708 | jQ uery.each( [ "radio", "checkbox " ], funct ion() { | |||||
| 2709 | jQue ry.valHook s[ this ] = { | |||||
| 2710 | get: f unction( e lem ) { | |||||
| 2711 | // Handl e the case where in Webkit "" is returne d instead of "on" if a value i sn't speci fied | |||||
| 2712 | return e lem.getAtt ribute("va lue") === null ? "on " : elem.v alue; | |||||
| 2713 | } | |||||
| 2714 | }; | |||||
| 2715 | }) ; | |||||
| 2716 | } | |||||
| 2717 | jQuery.eac h([ "radio ", "checkb ox" ], fun ction() { | |||||
| 2718 | jQ uery.valHo oks[ this ] = jQuery .extend( j Query.valH ooks[ this ], { | |||||
| 2719 | set: function( elem, val ue ) { | |||||
| 2720 | if ( j Query.isAr ray( value ) ) { | |||||
| 2721 | return ( elem.chec ked = jQue ry.inArray ( jQuery(e lem).val() , value ) >= 0 ); | |||||
| 2722 | } | |||||
| 2723 | } | |||||
| 2724 | }) ; | |||||
| 2725 | }); | |||||
| 2726 | var rformE lems = /^( ?:input|se lect|texta rea)$/i, | |||||
| 2727 | rk eyEvent = /^key/, | |||||
| 2728 | rm ouseEvent = /^(?:mou se|context menu)|clic k/, | |||||
| 2729 | rf ocusMorph = /^(?:foc usinfocus| focusoutbl ur)$/, | |||||
| 2730 | rt ypenamespa ce = /^([^ .]*)(?:\.( .+)|)$/; | |||||
| 2731 | ||||||
| 2732 | function r eturnTrue( ) { | |||||
| 2733 | re turn true; | |||||
| 2734 | } | |||||
| 2735 | ||||||
| 2736 | function r eturnFalse () { | |||||
| 2737 | re turn false ; | |||||
| 2738 | } | |||||
| 2739 | ||||||
| 2740 | /* | |||||
| 2741 | * Helper functions for managi ng events -- not par t of the p ublic inte rface. | |||||
| 2742 | * Props t o Dean Edw ards' addE vent libra ry for man y of the i deas. | |||||
| 2743 | */ | |||||
| 2744 | jQuery.eve nt = { | |||||
| 2745 | ||||||
| 2746 | gl obal: {}, | |||||
| 2747 | ||||||
| 2748 | ad d: functio n( elem, t ypes, hand ler, data, selector ) { | |||||
| 2749 | var tmp, event s, t, hand leObjIn, | |||||
| 2750 | specia l, eventHa ndle, hand leObj, | |||||
| 2751 | handle rs, type, namespaces , origType , | |||||
| 2752 | elemDa ta = jQuer y._data( e lem ); | |||||
| 2753 | ||||||
| 2754 | // D on't attac h events t o noData o r text/com ment nodes (but allo w plain ob jects) | |||||
| 2755 | if ( !elemData ) { | |||||
| 2756 | return ; | |||||
| 2757 | } | |||||
| 2758 | ||||||
| 2759 | // C aller can pass in an object of custom da ta in lieu of the ha ndler | |||||
| 2760 | if ( handler.h andler ) { | |||||
| 2761 | handle ObjIn = ha ndler; | |||||
| 2762 | handle r = handle ObjIn.hand ler; | |||||
| 2763 | select or = handl eObjIn.sel ector; | |||||
| 2764 | } | |||||
| 2765 | ||||||
| 2766 | // M ake sure t hat the ha ndler has a unique I D, used to find/remo ve it late r | |||||
| 2767 | if ( !handler. guid ) { | |||||
| 2768 | handle r.guid = j Query.guid ++; | |||||
| 2769 | } | |||||
| 2770 | ||||||
| 2771 | // I nit the el ement's ev ent struct ure and ma in handler , if this is the fir st | |||||
| 2772 | if ( !(events = elemData .events) ) { | |||||
| 2773 | events = elemDat a.events = {}; | |||||
| 2774 | } | |||||
| 2775 | if ( !(eventHa ndle = ele mData.hand le) ) { | |||||
| 2776 | eventH andle = el emData.han dle = func tion( e ) { | |||||
| 2777 | // Disca rd the sec ond event of a jQuer y.event.tr igger() an d | |||||
| 2778 | // when an event i s called a fter a pag e has unlo aded | |||||
| 2779 | return t ypeof jQue ry !== cor e_strundef ined && (! e || jQuer y.event.tr iggered != = e.type) ? | |||||
| 2780 | jQuery.eve nt.dispatc h.apply( e ventHandle .elem, arg uments ) : | |||||
| 2781 | undefined; | |||||
| 2782 | }; | |||||
| 2783 | // Add elem as a property of the han dle fn to prevent a memory lea k with IE non-native events | |||||
| 2784 | eventH andle.elem = elem; | |||||
| 2785 | } | |||||
| 2786 | ||||||
| 2787 | // H andle mult iple event s separate d by a spa ce | |||||
| 2788 | // j Query(...) .bind("mou seover mou seout", fn ); | |||||
| 2789 | type s = ( type s || "" ). match( cor e_rnotwhit e ) || ["" ]; | |||||
| 2790 | t = types.leng th; | |||||
| 2791 | whil e ( t-- ) { | |||||
| 2792 | tmp = rtypenames pace.exec( types[t] ) || []; | |||||
| 2793 | type = origType = tmp[1]; | |||||
| 2794 | namesp aces = ( t mp[2] || " " ).split( "." ).sor t(); | |||||
| 2795 | ||||||
| 2796 | // If event chan ges its ty pe, use th e special event hand lers for t he changed type | |||||
| 2797 | specia l = jQuery .event.spe cial[ type ] || {}; | |||||
| 2798 | ||||||
| 2799 | // If selector d efined, de termine sp ecial even t api type , otherwis e given ty pe | |||||
| 2800 | type = ( selecto r ? specia l.delegate Type : spe cial.bindT ype ) || t ype; | |||||
| 2801 | ||||||
| 2802 | // Upd ate specia l based on newly res et type | |||||
| 2803 | specia l = jQuery .event.spe cial[ type ] || {}; | |||||
| 2804 | ||||||
| 2805 | // han dleObj is passed to all event handlers | |||||
| 2806 | handle Obj = jQue ry.extend( { | |||||
| 2807 | type: ty pe, | |||||
| 2808 | origType : origType , | |||||
| 2809 | data: da ta, | |||||
| 2810 | handler: handler, | |||||
| 2811 | guid: ha ndler.guid , | |||||
| 2812 | selector : selector , | |||||
| 2813 | needsCon text: sele ctor && jQ uery.expr. match.need sContext.t est( selec tor ), | |||||
| 2814 | namespac e: namespa ces.join(" .") | |||||
| 2815 | }, han dleObjIn ) ; | |||||
| 2816 | ||||||
| 2817 | // Ini t the even t handler queue if w e're the f irst | |||||
| 2818 | if ( ! (handlers = events[ type ]) ) { | |||||
| 2819 | handlers = events[ type ] = []; | |||||
| 2820 | handlers .delegateC ount = 0; | |||||
| 2821 | ||||||
| 2822 | // Only use addEve ntListener /attachEve nt if the special ev ents handl er returns false | |||||
| 2823 | if ( !sp ecial.setu p || speci al.setup.c all( elem, data, nam espaces, e ventHandle ) === fal se ) { | |||||
| 2824 | // Bind th e global e vent handl er to the element | |||||
| 2825 | if ( elem. addEventLi stener ) { | |||||
| 2826 | el em.addEven tListener( type, eve ntHandle, false ); | |||||
| 2827 | ||||||
| 2828 | } else if ( elem.att achEvent ) { | |||||
| 2829 | el em.attachE vent( "on" + type, e ventHandle ); | |||||
| 2830 | } | |||||
| 2831 | } | |||||
| 2832 | } | |||||
| 2833 | ||||||
| 2834 | if ( s pecial.add ) { | |||||
| 2835 | special. add.call( elem, hand leObj ); | |||||
| 2836 | ||||||
| 2837 | if ( !ha ndleObj.ha ndler.guid ) { | |||||
| 2838 | handleObj. handler.gu id = handl er.guid; | |||||
| 2839 | } | |||||
| 2840 | } | |||||
| 2841 | ||||||
| 2842 | // Add to the el ement's ha ndler list , delegate s in front | |||||
| 2843 | if ( s elector ) { | |||||
| 2844 | handlers .splice( h andlers.de legateCoun t++, 0, ha ndleObj ); | |||||
| 2845 | } else { | |||||
| 2846 | handlers .push( han dleObj ); | |||||
| 2847 | } | |||||
| 2848 | ||||||
| 2849 | // Kee p track of which eve nts have e ver been u sed, for e vent optim ization | |||||
| 2850 | jQuery .event.glo bal[ type ] = true; | |||||
| 2851 | } | |||||
| 2852 | ||||||
| 2853 | // N ullify ele m to preve nt memory leaks in I E | |||||
| 2854 | elem = null; | |||||
| 2855 | }, | |||||
| 2856 | ||||||
| 2857 | // Detach an event or set of eve nts from a n element | |||||
| 2858 | re move: func tion( elem , types, h andler, se lector, ma ppedTypes ) { | |||||
| 2859 | var j, handleO bj, tmp, | |||||
| 2860 | origCo unt, t, ev ents, | |||||
| 2861 | specia l, handler s, type, | |||||
| 2862 | namesp aces, orig Type, | |||||
| 2863 | elemDa ta = jQuer y.hasData( elem ) && jQuery._d ata( elem ); | |||||
| 2864 | ||||||
| 2865 | if ( !elemData || !(even ts = elemD ata.events ) ) { | |||||
| 2866 | return ; | |||||
| 2867 | } | |||||
| 2868 | ||||||
| 2869 | // O nce for ea ch type.na mespace in types; ty pe may be omitted | |||||
| 2870 | type s = ( type s || "" ). match( cor e_rnotwhit e ) || ["" ]; | |||||
| 2871 | t = types.leng th; | |||||
| 2872 | whil e ( t-- ) { | |||||
| 2873 | tmp = rtypenames pace.exec( types[t] ) || []; | |||||
| 2874 | type = origType = tmp[1]; | |||||
| 2875 | namesp aces = ( t mp[2] || " " ).split( "." ).sor t(); | |||||
| 2876 | ||||||
| 2877 | // Unb ind all ev ents (on t his namesp ace, if pr ovided) fo r the elem ent | |||||
| 2878 | if ( ! type ) { | |||||
| 2879 | for ( ty pe in even ts ) { | |||||
| 2880 | jQuery.eve nt.remove( elem, typ e + types[ t ], hand ler, selec tor, true ); | |||||
| 2881 | } | |||||
| 2882 | continue ; | |||||
| 2883 | } | |||||
| 2884 | ||||||
| 2885 | specia l = jQuery .event.spe cial[ type ] || {}; | |||||
| 2886 | type = ( selecto r ? specia l.delegate Type : spe cial.bindT ype ) || t ype; | |||||
| 2887 | handle rs = event s[ type ] || []; | |||||
| 2888 | tmp = tmp[2] && new RegExp ( "(^|\\.) " + namesp aces.join( "\\.(?:.*\ \.|)") + " (\\.|$)" ) ; | |||||
| 2889 | ||||||
| 2890 | // Rem ove matchi ng events | |||||
| 2891 | origCo unt = j = handlers.l ength; | |||||
| 2892 | while ( j-- ) { | |||||
| 2893 | handleOb j = handle rs[ j ]; | |||||
| 2894 | ||||||
| 2895 | if ( ( m appedTypes || origTy pe === han dleObj.ori gType ) && | |||||
| 2896 | ( !handler || handle r.guid === handleObj .guid ) && | |||||
| 2897 | ( !tmp || tmp.test( handleObj. namespace ) ) && | |||||
| 2898 | ( !selecto r || selec tor === ha ndleObj.se lector || selector = == "**" && handleObj .selector ) ) { | |||||
| 2899 | handlers.s plice( j, 1 ); | |||||
| 2900 | ||||||
| 2901 | if ( handl eObj.selec tor ) { | |||||
| 2902 | ha ndlers.del egateCount --; | |||||
| 2903 | } | |||||
| 2904 | if ( speci al.remove ) { | |||||
| 2905 | sp ecial.remo ve.call( e lem, handl eObj ); | |||||
| 2906 | } | |||||
| 2907 | } | |||||
| 2908 | } | |||||
| 2909 | ||||||
| 2910 | // Rem ove generi c event ha ndler if w e removed something and no mor e handlers exist | |||||
| 2911 | // (av oids poten tial for e ndless rec ursion dur ing remova l of speci al event h andlers) | |||||
| 2912 | if ( o rigCount & & !handler s.length ) { | |||||
| 2913 | if ( !sp ecial.tear down || sp ecial.tear down.call( elem, nam espaces, e lemData.ha ndle ) === false ) { | |||||
| 2914 | jQuery.rem oveEvent( elem, type , elemData .handle ); | |||||
| 2915 | } | |||||
| 2916 | ||||||
| 2917 | delete e vents[ typ e ]; | |||||
| 2918 | } | |||||
| 2919 | } | |||||
| 2920 | ||||||
| 2921 | // R emove the expando if it's no l onger used | |||||
| 2922 | if ( jQuery.is EmptyObjec t( events ) ) { | |||||
| 2923 | delete elemData. handle; | |||||
| 2924 | ||||||
| 2925 | // rem oveData al so checks for emptin ess and cl ears the e xpando if empty | |||||
| 2926 | // so use it ins tead of de lete | |||||
| 2927 | jQuery ._removeDa ta( elem, "events" ) ; | |||||
| 2928 | } | |||||
| 2929 | }, | |||||
| 2930 | ||||||
| 2931 | tr igger: fun ction( eve nt, data, elem, only Handlers ) { | |||||
| 2932 | var handle, on type, cur, | |||||
| 2933 | bubble Type, spec ial, tmp, i, | |||||
| 2934 | eventP ath = [ el em || docu ment ], | |||||
| 2935 | type = core_hasO wn.call( e vent, "typ e" ) ? eve nt.type : event, | |||||
| 2936 | namesp aces = cor e_hasOwn.c all( event , "namespa ce" ) ? ev ent.namesp ace.split( ".") : []; | |||||
| 2937 | ||||||
| 2938 | cur = tmp = el em = elem || documen t; | |||||
| 2939 | ||||||
| 2940 | // D on't do ev ents on te xt and com ment nodes | |||||
| 2941 | if ( elem.node Type === 3 || elem.n odeType == = 8 ) { | |||||
| 2942 | return ; | |||||
| 2943 | } | |||||
| 2944 | ||||||
| 2945 | // f ocus/blur morphs to focusin/ou t; ensure we're not firing the m right no w | |||||
| 2946 | if ( rfocusMor ph.test( t ype + jQue ry.event.t riggered ) ) { | |||||
| 2947 | return ; | |||||
| 2948 | } | |||||
| 2949 | ||||||
| 2950 | if ( type.inde xOf(".") > = 0 ) { | |||||
| 2951 | // Nam espaced tr igger; cre ate a rege xp to matc h event ty pe in hand le() | |||||
| 2952 | namesp aces = typ e.split(". "); | |||||
| 2953 | type = namespace s.shift(); | |||||
| 2954 | namesp aces.sort( ); | |||||
| 2955 | } | |||||
| 2956 | onty pe = type. indexOf(": ") < 0 && "on" + typ e; | |||||
| 2957 | ||||||
| 2958 | // C aller can pass in a jQuery.Eve nt object, Object, o r just an event type string | |||||
| 2959 | even t = event[ jQuery.ex pando ] ? | |||||
| 2960 | event : | |||||
| 2961 | new jQ uery.Event ( type, ty peof event === "obje ct" && eve nt ); | |||||
| 2962 | ||||||
| 2963 | even t.isTrigge r = true; | |||||
| 2964 | even t.namespac e = namesp aces.join( "."); | |||||
| 2965 | even t.namespac e_re = eve nt.namespa ce ? | |||||
| 2966 | new Re gExp( "(^| \\.)" + na mespaces.j oin("\\.(? :.*\\.|)") + "(\\.|$ )" ) : | |||||
| 2967 | null; | |||||
| 2968 | ||||||
| 2969 | // C lean up th e event in case it i s being re used | |||||
| 2970 | even t.result = undefined ; | |||||
| 2971 | if ( !event.ta rget ) { | |||||
| 2972 | event. target = e lem; | |||||
| 2973 | } | |||||
| 2974 | ||||||
| 2975 | // C lone any i ncoming da ta and pre pend the e vent, crea ting the h andler arg list | |||||
| 2976 | data = data == null ? | |||||
| 2977 | [ even t ] : | |||||
| 2978 | jQuery .makeArray ( data, [ event ] ); | |||||
| 2979 | ||||||
| 2980 | // A llow speci al events to draw ou tside the lines | |||||
| 2981 | spec ial = jQue ry.event.s pecial[ ty pe ] || {} ; | |||||
| 2982 | if ( !onlyHand lers && sp ecial.trig ger && spe cial.trigg er.apply( elem, data ) === fal se ) { | |||||
| 2983 | return ; | |||||
| 2984 | } | |||||
| 2985 | ||||||
| 2986 | // D etermine e vent propa gation pat h in advan ce, per W3 C events s pec (#9951 ) | |||||
| 2987 | // B ubble up t o document , then to window; wa tch for a global own erDocument var (#972 4) | |||||
| 2988 | if ( !onlyHand lers && !s pecial.noB ubble && ! jQuery.isW indow( ele m ) ) { | |||||
| 2989 | ||||||
| 2990 | bubble Type = spe cial.deleg ateType || type; | |||||
| 2991 | if ( ! rfocusMorp h.test( bu bbleType + type ) ) { | |||||
| 2992 | cur = cu r.parentNo de; | |||||
| 2993 | } | |||||
| 2994 | for ( ; cur; cur = cur.par entNode ) { | |||||
| 2995 | eventPat h.push( cu r ); | |||||
| 2996 | tmp = cu r; | |||||
| 2997 | } | |||||
| 2998 | ||||||
| 2999 | // Onl y add wind ow if we g ot to docu ment (e.g. , not plai n obj or d etached DO M) | |||||
| 3000 | if ( t mp === (el em.ownerDo cument || document) ) { | |||||
| 3001 | eventPat h.push( tm p.defaultV iew || tmp .parentWin dow || win dow ); | |||||
| 3002 | } | |||||
| 3003 | } | |||||
| 3004 | ||||||
| 3005 | // F ire handle rs on the event path | |||||
| 3006 | i = 0; | |||||
| 3007 | whil e ( (cur = eventPath [i++]) && !event.isP ropagation Stopped() ) { | |||||
| 3008 | ||||||
| 3009 | event. type = i > 1 ? | |||||
| 3010 | bubbleTy pe : | |||||
| 3011 | special. bindType | | type; | |||||
| 3012 | ||||||
| 3013 | // jQu ery handle r | |||||
| 3014 | handle = ( jQuer y._data( c ur, "event s" ) || {} )[ event. type ] && jQuery._da ta( cur, " handle" ); | |||||
| 3015 | if ( h andle ) { | |||||
| 3016 | handle.a pply( cur, data ); | |||||
| 3017 | } | |||||
| 3018 | ||||||
| 3019 | // Nat ive handle r | |||||
| 3020 | handle = ontype && cur[ on type ]; | |||||
| 3021 | if ( h andle && j Query.acce ptData( cu r ) && han dle.apply && handle. apply( cur , data ) = == false ) { | |||||
| 3022 | event.pr eventDefau lt(); | |||||
| 3023 | } | |||||
| 3024 | } | |||||
| 3025 | even t.type = t ype; | |||||
| 3026 | ||||||
| 3027 | // I f nobody p revented t he default action, d o it now | |||||
| 3028 | if ( !onlyHand lers && !e vent.isDef aultPreven ted() ) { | |||||
| 3029 | ||||||
| 3030 | if ( ( !special._ default || special._ default.ap ply( elem. ownerDocum ent, data ) === fals e) && | |||||
| 3031 | !(type = == "click" && jQuery .nodeName( elem, "a" )) && jQu ery.accept Data( elem ) ) { | |||||
| 3032 | ||||||
| 3033 | // Call a native D OM method on the tar get with t he same na me name as the event . | |||||
| 3034 | // Can't use an .i sFunction( ) check he re because IE6/7 fai ls that te st. | |||||
| 3035 | // Don't do defaul t actions on window, that's wh ere global variables be (#6170 ) | |||||
| 3036 | if ( ont ype && ele m[ type ] && !jQuery .isWindow( elem ) ) { | |||||
| 3037 | ||||||
| 3038 | // Don't r e-trigger an onFOO e vent when we call it s FOO() me thod | |||||
| 3039 | tmp = elem [ ontype ] ; | |||||
| 3040 | ||||||
| 3041 | if ( tmp ) { | |||||
| 3042 | el em[ ontype ] = null; | |||||
| 3043 | } | |||||
| 3044 | ||||||
| 3045 | // Prevent re-trigge ring of th e same eve nt, since we already bubbled i t above | |||||
| 3046 | jQuery.eve nt.trigger ed = type; | |||||
| 3047 | try { | |||||
| 3048 | el em[ type ] (); | |||||
| 3049 | } catch ( e ) { | |||||
| 3050 | // IE<9 dies on focus/ blur to hi dden eleme nt (#1486, #12518) | |||||
| 3051 | // only repr oducible o n winXP IE 8 native, not IE9 in IE8 mode | |||||
| 3052 | } | |||||
| 3053 | jQuery.eve nt.trigger ed = undef ined; | |||||
| 3054 | ||||||
| 3055 | if ( tmp ) { | |||||
| 3056 | el em[ ontype ] = tmp; | |||||
| 3057 | } | |||||
| 3058 | } | |||||
| 3059 | } | |||||
| 3060 | } | |||||
| 3061 | ||||||
| 3062 | retu rn event.r esult; | |||||
| 3063 | }, | |||||
| 3064 | ||||||
| 3065 | di spatch: fu nction( ev ent ) { | |||||
| 3066 | ||||||
| 3067 | // M ake a writ able jQuer y.Event fr om the nat ive event object | |||||
| 3068 | even t = jQuery .event.fix ( event ); | |||||
| 3069 | ||||||
| 3070 | var i, ret, ha ndleObj, m atched, j, | |||||
| 3071 | handle rQueue = [ ], | |||||
| 3072 | args = core_slic e.call( ar guments ), | |||||
| 3073 | handle rs = ( jQu ery._data( this, "ev ents" ) || {} )[ eve nt.type ] || [], | |||||
| 3074 | specia l = jQuery .event.spe cial[ even t.type ] | | {}; | |||||
| 3075 | ||||||
| 3076 | // U se the fix -ed jQuery .Event rat her than t he (read-o nly) nativ e event | |||||
| 3077 | args [0] = even t; | |||||
| 3078 | even t.delegate Target = t his; | |||||
| 3079 | ||||||
| 3080 | // C all the pr eDispatch hook for t he mapped type, and let it bai l if desir ed | |||||
| 3081 | if ( special.p reDispatch && specia l.preDispa tch.call( this, even t ) === fa lse ) { | |||||
| 3082 | return ; | |||||
| 3083 | } | |||||
| 3084 | ||||||
| 3085 | // D etermine h andlers | |||||
| 3086 | hand lerQueue = jQuery.ev ent.handle rs.call( t his, event , handlers ); | |||||
| 3087 | ||||||
| 3088 | // R un delegat es first; they may w ant to sto p propagat ion beneat h us | |||||
| 3089 | i = 0; | |||||
| 3090 | whil e ( (match ed = handl erQueue[ i ++ ]) && ! event.isPr opagationS topped() ) { | |||||
| 3091 | event. currentTar get = matc hed.elem; | |||||
| 3092 | ||||||
| 3093 | j = 0; | |||||
| 3094 | while ( (handleO bj = match ed.handler s[ j++ ]) && !event. isImmediat ePropagati onStopped( ) ) { | |||||
| 3095 | ||||||
| 3096 | // Trigg ered event must eith er 1) have no namesp ace, or | |||||
| 3097 | // 2) ha ve namespa ce(s) a su bset or eq ual to tho se in the bound even t (both ca n have no namespace) . | |||||
| 3098 | if ( !ev ent.namesp ace_re || event.name space_re.t est( handl eObj.names pace ) ) { | |||||
| 3099 | ||||||
| 3100 | event.hand leObj = ha ndleObj; | |||||
| 3101 | event.data = handleO bj.data; | |||||
| 3102 | ||||||
| 3103 | ret = ( (j Query.even t.special[ handleObj .origType ] || {}).h andle || h andleObj.h andler ) | |||||
| 3104 | .app ly( matche d.elem, ar gs ); | |||||
| 3105 | ||||||
| 3106 | if ( ret ! == undefin ed ) { | |||||
| 3107 | if ( (event. result = r et) === fa lse ) { | |||||
| 3108 | even t.preventD efault(); | |||||
| 3109 | even t.stopProp agation(); | |||||
| 3110 | } | |||||
| 3111 | } | |||||
| 3112 | } | |||||
| 3113 | } | |||||
| 3114 | } | |||||
| 3115 | ||||||
| 3116 | // C all the po stDispatch hook for the mapped type | |||||
| 3117 | if ( special.p ostDispatc h ) { | |||||
| 3118 | specia l.postDisp atch.call( this, eve nt ); | |||||
| 3119 | } | |||||
| 3120 | ||||||
| 3121 | retu rn event.r esult; | |||||
| 3122 | }, | |||||
| 3123 | ||||||
| 3124 | ha ndlers: fu nction( ev ent, handl ers ) { | |||||
| 3125 | var sel, handl eObj, matc hes, i, | |||||
| 3126 | handle rQueue = [ ], | |||||
| 3127 | delega teCount = handlers.d elegateCou nt, | |||||
| 3128 | cur = event.targ et; | |||||
| 3129 | ||||||
| 3130 | // F ind delega te handler s | |||||
| 3131 | // B lack-hole SVG <use> instance t rees (#131 80) | |||||
| 3132 | // A void non-l eft-click bubbling i n Firefox (#3861) | |||||
| 3133 | if ( delegateC ount && cu r.nodeType && (!even t.button | | event.ty pe !== "cl ick") ) { | |||||
| 3134 | ||||||
| 3135 | for ( ; cur != t his; cur = cur.paren tNode || t his ) { | |||||
| 3136 | ||||||
| 3137 | // Don't check non -elements (#13208) | |||||
| 3138 | // Don't process c licks on d isabled el ements (#6 911, #8165 , #11382, #11764) | |||||
| 3139 | if ( cur .nodeType === 1 && ( cur.disabl ed !== tru e || event .type !== "click") ) { | |||||
| 3140 | matches = []; | |||||
| 3141 | for ( i = 0; i < del egateCount ; i++ ) { | |||||
| 3142 | ha ndleObj = handlers[ i ]; | |||||
| 3143 | ||||||
| 3144 | // Don't con flict with Object.pr ototype pr operties ( #13203) | |||||
| 3145 | se l = handle Obj.select or + " "; | |||||
| 3146 | ||||||
| 3147 | if ( matches [ sel ] == = undefine d ) { | |||||
| 3148 | matc hes[ sel ] = handleO bj.needsCo ntext ? | |||||
| 3149 | jQuery ( sel, thi s ).index( cur ) >= 0 : | |||||
| 3150 | jQuery .find( sel , this, nu ll, [ cur ] ).length ; | |||||
| 3151 | } | |||||
| 3152 | if ( matches [ sel ] ) { | |||||
| 3153 | matc hes.push( handleObj ); | |||||
| 3154 | } | |||||
| 3155 | } | |||||
| 3156 | if ( match es.length ) { | |||||
| 3157 | ha ndlerQueue .push({ el em: cur, h andlers: m atches }); | |||||
| 3158 | } | |||||
| 3159 | } | |||||
| 3160 | } | |||||
| 3161 | } | |||||
| 3162 | ||||||
| 3163 | // A dd the rem aining (di rectly-bou nd) handle rs | |||||
| 3164 | if ( delegateC ount < han dlers.leng th ) { | |||||
| 3165 | handle rQueue.pus h({ elem: this, hand lers: hand lers.slice ( delegate Count ) }) ; | |||||
| 3166 | } | |||||
| 3167 | ||||||
| 3168 | retu rn handler Queue; | |||||
| 3169 | }, | |||||
| 3170 | ||||||
| 3171 | fi x: functio n( event ) { | |||||
| 3172 | if ( event[ jQ uery.expan do ] ) { | |||||
| 3173 | return event; | |||||
| 3174 | } | |||||
| 3175 | ||||||
| 3176 | // C reate a wr itable cop y of the e vent objec t and norm alize some propertie s | |||||
| 3177 | var i, prop, c opy, | |||||
| 3178 | type = event.typ e, | |||||
| 3179 | origin alEvent = event, | |||||
| 3180 | fixHoo k = this.f ixHooks[ t ype ]; | |||||
| 3181 | ||||||
| 3182 | if ( !fixHook ) { | |||||
| 3183 | this.f ixHooks[ t ype ] = fi xHook = | |||||
| 3184 | rmouseEv ent.test( type ) ? t his.mouseH ooks : | |||||
| 3185 | rkeyEven t.test( ty pe ) ? thi s.keyHooks : | |||||
| 3186 | {}; | |||||
| 3187 | } | |||||
| 3188 | copy = fixHook .props ? t his.props. concat( fi xHook.prop s ) : this .props; | |||||
| 3189 | ||||||
| 3190 | even t = new jQ uery.Event ( original Event ); | |||||
| 3191 | ||||||
| 3192 | i = copy.lengt h; | |||||
| 3193 | whil e ( i-- ) { | |||||
| 3194 | prop = copy[ i ] ; | |||||
| 3195 | event[ prop ] = originalEv ent[ prop ]; | |||||
| 3196 | } | |||||
| 3197 | ||||||
| 3198 | // S upport: IE <9 | |||||
| 3199 | // F ix target property ( #1925) | |||||
| 3200 | if ( !event.ta rget ) { | |||||
| 3201 | event. target = o riginalEve nt.srcElem ent || doc ument; | |||||
| 3202 | } | |||||
| 3203 | ||||||
| 3204 | // S upport: Ch rome 23+, Safari? | |||||
| 3205 | // T arget shou ld not be a text nod e (#504, # 13143) | |||||
| 3206 | if ( event.tar get.nodeTy pe === 3 ) { | |||||
| 3207 | event. target = e vent.targe t.parentNo de; | |||||
| 3208 | } | |||||
| 3209 | ||||||
| 3210 | // S upport: IE <9 | |||||
| 3211 | // F or mouse/k ey events, metaKey== false if i t's undefi ned (#3368 , #11328) | |||||
| 3212 | even t.metaKey = !!event. metaKey; | |||||
| 3213 | ||||||
| 3214 | retu rn fixHook .filter ? fixHook.fi lter( even t, origina lEvent ) : event; | |||||
| 3215 | }, | |||||
| 3216 | ||||||
| 3217 | // Includes some event props sha red by Key Event and MouseEvent | |||||
| 3218 | pr ops: "altK ey bubbles cancelabl e ctrlKey currentTar get eventP hase metaK ey related Target shi ftKey targ et timeSta mp view wh ich".split (" "), | |||||
| 3219 | ||||||
| 3220 | fi xHooks: {} , | |||||
| 3221 | ||||||
| 3222 | ke yHooks: { | |||||
| 3223 | prop s: "char c harCode ke y keyCode" .split(" " ), | |||||
| 3224 | filt er: functi on( event, original ) { | |||||
| 3225 | ||||||
| 3226 | // Add which for key event s | |||||
| 3227 | if ( e vent.which == null ) { | |||||
| 3228 | event.wh ich = orig inal.charC ode != nul l ? origin al.charCod e : origin al.keyCode ; | |||||
| 3229 | } | |||||
| 3230 | ||||||
| 3231 | return event; | |||||
| 3232 | } | |||||
| 3233 | }, | |||||
| 3234 | ||||||
| 3235 | mo useHooks: { | |||||
| 3236 | prop s: "button buttons c lientX cli entY fromE lement off setX offse tY pageX p ageY scree nX screenY toElement ".split(" "), | |||||
| 3237 | filt er: functi on( event, original ) { | |||||
| 3238 | var bo dy, eventD oc, doc, | |||||
| 3239 | button = original. button, | |||||
| 3240 | fromElem ent = orig inal.fromE lement; | |||||
| 3241 | ||||||
| 3242 | // Cal culate pag eX/Y if mi ssing and clientX/Y available | |||||
| 3243 | if ( e vent.pageX == null & & original .clientX ! = null ) { | |||||
| 3244 | eventDoc = event.t arget.owne rDocument || documen t; | |||||
| 3245 | doc = ev entDoc.doc umentEleme nt; | |||||
| 3246 | body = e ventDoc.bo dy; | |||||
| 3247 | ||||||
| 3248 | event.pa geX = orig inal.clien tX + ( doc && doc.sc rollLeft | | body && body.scrol lLeft || 0 ) - ( doc && doc.cl ientLeft | | body && body.clien tLeft || 0 ); | |||||
| 3249 | event.pa geY = orig inal.clien tY + ( doc && doc.sc rollTop | | body && body.scrol lTop || 0 ) - ( doc && doc.cl ientTop | | body && body.clien tTop || 0 ); | |||||
| 3250 | } | |||||
| 3251 | ||||||
| 3252 | // Add relatedTa rget, if n ecessary | |||||
| 3253 | if ( ! event.rela tedTarget && fromEle ment ) { | |||||
| 3254 | event.re latedTarge t = fromEl ement === event.targ et ? origi nal.toElem ent : from Element; | |||||
| 3255 | } | |||||
| 3256 | ||||||
| 3257 | // Add which for click: 1 === left; 2 === midd le; 3 === right | |||||
| 3258 | // Not e: button is not nor malized, s o don't us e it | |||||
| 3259 | if ( ! event.whic h && butto n !== unde fined ) { | |||||
| 3260 | event.wh ich = ( bu tton & 1 ? 1 : ( but ton & 2 ? 3 : ( butt on & 4 ? 2 : 0 ) ) ) ; | |||||
| 3261 | } | |||||
| 3262 | ||||||
| 3263 | return event; | |||||
| 3264 | } | |||||
| 3265 | }, | |||||
| 3266 | ||||||
| 3267 | sp ecial: { | |||||
| 3268 | load : { | |||||
| 3269 | // Pre vent trigg ered image .load even ts from bu bbling to window.loa d | |||||
| 3270 | noBubb le: true | |||||
| 3271 | }, | |||||
| 3272 | clic k: { | |||||
| 3273 | // For checkbox, fire nati ve event s o checked state will be right | |||||
| 3274 | trigge r: functio n() { | |||||
| 3275 | if ( jQu ery.nodeNa me( this, "input" ) && this.ty pe === "ch eckbox" && this.clic k ) { | |||||
| 3276 | this.click (); | |||||
| 3277 | return fal se; | |||||
| 3278 | } | |||||
| 3279 | } | |||||
| 3280 | }, | |||||
| 3281 | focu s: { | |||||
| 3282 | // Fir e native e vent if po ssible so blur/focus sequence is correct | |||||
| 3283 | trigge r: functio n() { | |||||
| 3284 | if ( thi s !== docu ment.activ eElement & & this.foc us ) { | |||||
| 3285 | try { | |||||
| 3286 | th is.focus() ; | |||||
| 3287 | re turn false ; | |||||
| 3288 | } catch ( e ) { | |||||
| 3289 | // Support: IE<9 | |||||
| 3290 | // If we err or on focu s to hidde n element (#1486, #1 2518), | |||||
| 3291 | // let .trig ger() run the handle rs | |||||
| 3292 | } | |||||
| 3293 | } | |||||
| 3294 | }, | |||||
| 3295 | delega teType: "f ocusin" | |||||
| 3296 | }, | |||||
| 3297 | blur : { | |||||
| 3298 | trigge r: functio n() { | |||||
| 3299 | if ( thi s === docu ment.activ eElement & & this.blu r ) { | |||||
| 3300 | this.blur( ); | |||||
| 3301 | return fal se; | |||||
| 3302 | } | |||||
| 3303 | }, | |||||
| 3304 | delega teType: "f ocusout" | |||||
| 3305 | }, | |||||
| 3306 | ||||||
| 3307 | befo reunload: { | |||||
| 3308 | postDi spatch: fu nction( ev ent ) { | |||||
| 3309 | ||||||
| 3310 | // Even when retur nValue equ als to und efined Fir efox will still show alert | |||||
| 3311 | if ( eve nt.result !== undefi ned ) { | |||||
| 3312 | event.orig inalEvent. returnValu e = event. result; | |||||
| 3313 | } | |||||
| 3314 | } | |||||
| 3315 | } | |||||
| 3316 | }, | |||||
| 3317 | ||||||
| 3318 | si mulate: fu nction( ty pe, elem, event, bub ble ) { | |||||
| 3319 | // P iggyback o n a donor event to s imulate a different one. | |||||
| 3320 | // F ake origin alEvent to avoid don or's stopP ropagation , but if t he | |||||
| 3321 | // s imulated e vent preve nts defaul t then we do the sam e on the d onor. | |||||
| 3322 | var e = jQuery .extend( | |||||
| 3323 | new jQ uery.Event (), | |||||
| 3324 | event, | |||||
| 3325 | { type : type, | |||||
| 3326 | isSimula ted: true, | |||||
| 3327 | original Event: {} | |||||
| 3328 | } | |||||
| 3329 | ); | |||||
| 3330 | if ( bubble ) { | |||||
| 3331 | jQuery .event.tri gger( e, n ull, elem ); | |||||
| 3332 | } el se { | |||||
| 3333 | jQuery .event.dis patch.call ( elem, e ); | |||||
| 3334 | } | |||||
| 3335 | if ( e.isDefau ltPrevente d() ) { | |||||
| 3336 | event. preventDef ault(); | |||||
| 3337 | } | |||||
| 3338 | } | |||||
| 3339 | }; | |||||
| 3340 | ||||||
| 3341 | jQuery.rem oveEvent = document. removeEven tListener ? | |||||
| 3342 | fu nction( el em, type, handle ) { | |||||
| 3343 | if ( elem.remo veEventLis tener ) { | |||||
| 3344 | elem.r emoveEvent Listener( type, hand le, false ); | |||||
| 3345 | } | |||||
| 3346 | } : | |||||
| 3347 | fu nction( el em, type, handle ) { | |||||
| 3348 | var name = "on " + type; | |||||
| 3349 | ||||||
| 3350 | if ( elem.deta chEvent ) { | |||||
| 3351 | ||||||
| 3352 | // #85 45, #7054, preventin g memory l eaks for c ustom even ts in IE6- 8 | |||||
| 3353 | // det achEvent n eeded prop erty on el ement, by name of th at event, to properl y expose i t to GC | |||||
| 3354 | if ( t ypeof elem [ name ] = == core_st rundefined ) { | |||||
| 3355 | elem[ na me ] = nul l; | |||||
| 3356 | } | |||||
| 3357 | ||||||
| 3358 | elem.d etachEvent ( name, ha ndle ); | |||||
| 3359 | } | |||||
| 3360 | }; | |||||
| 3361 | ||||||
| 3362 | jQuery.Eve nt = funct ion( src, props ) { | |||||
| 3363 | // Allow ins tantiation without t he 'new' k eyword | |||||
| 3364 | if ( !(this instanceof jQuery.Ev ent) ) { | |||||
| 3365 | retu rn new jQu ery.Event( src, prop s ); | |||||
| 3366 | } | |||||
| 3367 | ||||||
| 3368 | // Event obj ect | |||||
| 3369 | if ( src && src.type ) { | |||||
| 3370 | this .originalE vent = src ; | |||||
| 3371 | this .type = sr c.type; | |||||
| 3372 | ||||||
| 3373 | // E vents bubb ling up th e document may have been marke d as preve nted | |||||
| 3374 | // b y a handle r lower do wn the tre e; reflect the corre ct value. | |||||
| 3375 | this .isDefault Prevented = ( src.de faultPreve nted || sr c.returnVa lue === fa lse || | |||||
| 3376 | src.ge tPreventDe fault && s rc.getPrev entDefault () ) ? ret urnTrue : returnFals e; | |||||
| 3377 | ||||||
| 3378 | // Event typ e | |||||
| 3379 | } else { | |||||
| 3380 | this .type = sr c; | |||||
| 3381 | } | |||||
| 3382 | ||||||
| 3383 | // Put expli citly prov ided prope rties onto the event object | |||||
| 3384 | if ( props ) { | |||||
| 3385 | jQue ry.extend( this, pro ps ); | |||||
| 3386 | } | |||||
| 3387 | ||||||
| 3388 | // Create a timestamp if incomin g event do esn't have one | |||||
| 3389 | th is.timeSta mp = src & & src.time Stamp || j Query.now( ); | |||||
| 3390 | ||||||
| 3391 | // Mark it a s fixed | |||||
| 3392 | th is[ jQuery .expando ] = true; | |||||
| 3393 | }; | |||||
| 3394 | ||||||
| 3395 | // jQuery. Event is b ased on DO M3 Events as specifi ed by the ECMAScript Language Binding | |||||
| 3396 | // http:// www.w3.org /TR/2003/W D-DOM-Leve l-3-Events -20030331/ ecma-scrip t-binding. html | |||||
| 3397 | jQuery.Eve nt.prototy pe = { | |||||
| 3398 | is DefaultPre vented: re turnFalse, | |||||
| 3399 | is Propagatio nStopped: returnFals e, | |||||
| 3400 | is ImmediateP ropagation Stopped: r eturnFalse , | |||||
| 3401 | ||||||
| 3402 | pr eventDefau lt: functi on() { | |||||
| 3403 | var e = this.o riginalEve nt; | |||||
| 3404 | ||||||
| 3405 | this .isDefault Prevented = returnTr ue; | |||||
| 3406 | if ( !e ) { | |||||
| 3407 | return ; | |||||
| 3408 | } | |||||
| 3409 | ||||||
| 3410 | // I f preventD efault exi sts, run i t on the o riginal ev ent | |||||
| 3411 | if ( e.prevent Default ) { | |||||
| 3412 | e.prev entDefault (); | |||||
| 3413 | ||||||
| 3414 | // S upport: IE | |||||
| 3415 | // O therwise s et the ret urnValue p roperty of the origi nal event to false | |||||
| 3416 | } el se { | |||||
| 3417 | e.retu rnValue = false; | |||||
| 3418 | } | |||||
| 3419 | }, | |||||
| 3420 | st opPropagat ion: funct ion() { | |||||
| 3421 | var e = this.o riginalEve nt; | |||||
| 3422 | ||||||
| 3423 | this .isPropaga tionStoppe d = return True; | |||||
| 3424 | if ( !e ) { | |||||
| 3425 | return ; | |||||
| 3426 | } | |||||
| 3427 | // I f stopProp agation ex ists, run it on the original e vent | |||||
| 3428 | if ( e.stopPro pagation ) { | |||||
| 3429 | e.stop Propagatio n(); | |||||
| 3430 | } | |||||
| 3431 | ||||||
| 3432 | // S upport: IE | |||||
| 3433 | // S et the can celBubble property o f the orig inal event to true | |||||
| 3434 | e.ca ncelBubble = true; | |||||
| 3435 | }, | |||||
| 3436 | st opImmediat ePropagati on: functi on() { | |||||
| 3437 | this .isImmedia tePropagat ionStopped = returnT rue; | |||||
| 3438 | this .stopPropa gation(); | |||||
| 3439 | } | |||||
| 3440 | }; | |||||
| 3441 | ||||||
| 3442 | // Create mouseenter /leave eve nts using mouseover/ out and ev ent-time c hecks | |||||
| 3443 | jQuery.eac h({ | |||||
| 3444 | mo useenter: "mouseover ", | |||||
| 3445 | mo useleave: "mouseout" | |||||
| 3446 | }, functio n( orig, f ix ) { | |||||
| 3447 | jQ uery.event .special[ orig ] = { | |||||
| 3448 | dele gateType: fix, | |||||
| 3449 | bind Type: fix, | |||||
| 3450 | ||||||
| 3451 | hand le: functi on( event ) { | |||||
| 3452 | var re t, | |||||
| 3453 | target = this, | |||||
| 3454 | related = event.re latedTarge t, | |||||
| 3455 | handleOb j = event. handleObj; | |||||
| 3456 | ||||||
| 3457 | // For mousenter /leave cal l the hand ler if rel ated is ou tside the target. | |||||
| 3458 | // NB: No relate dTarget if the mouse left/ente red the br owser wind ow | |||||
| 3459 | if ( ! related || (related !== target && !jQuer y.contains ( target, related )) ) { | |||||
| 3460 | event.ty pe = handl eObj.origT ype; | |||||
| 3461 | ret = ha ndleObj.ha ndler.appl y( this, a rguments ) ; | |||||
| 3462 | event.ty pe = fix; | |||||
| 3463 | } | |||||
| 3464 | return ret; | |||||
| 3465 | } | |||||
| 3466 | }; | |||||
| 3467 | }); | |||||
| 3468 | ||||||
| 3469 | // IE subm it delegat ion | |||||
| 3470 | if ( !jQue ry.support .submitBub bles ) { | |||||
| 3471 | ||||||
| 3472 | jQ uery.event .special.s ubmit = { | |||||
| 3473 | setu p: functio n() { | |||||
| 3474 | // Onl y need thi s for dele gated form submit ev ents | |||||
| 3475 | if ( j Query.node Name( this , "form" ) ) { | |||||
| 3476 | return f alse; | |||||
| 3477 | } | |||||
| 3478 | ||||||
| 3479 | // Laz y-add a su bmit handl er when a descendant form may potentiall y be submi tted | |||||
| 3480 | jQuery .event.add ( this, "c lick._subm it keypres s._submit" , function ( e ) { | |||||
| 3481 | // Node name check avoids a VML-relate d crash in IE (#9807 ) | |||||
| 3482 | var elem = e.targe t, | |||||
| 3483 | form = jQu ery.nodeNa me( elem, "input" ) || jQuery. nodeName( elem, "but ton" ) ? e lem.form : undefined ; | |||||
| 3484 | if ( for m && !jQue ry._data( form, "sub mitBubbles " ) ) { | |||||
| 3485 | jQuery.eve nt.add( fo rm, "submi t._submit" , function ( event ) { | |||||
| 3486 | ev ent._submi t_bubble = true; | |||||
| 3487 | }); | |||||
| 3488 | jQuery._da ta( form, "submitBub bles", tru e ); | |||||
| 3489 | } | |||||
| 3490 | }); | |||||
| 3491 | // ret urn undefi ned since we don't n eed an eve nt listene r | |||||
| 3492 | }, | |||||
| 3493 | ||||||
| 3494 | post Dispatch: function( event ) { | |||||
| 3495 | // If form was s ubmitted b y the user , bubble t he event u p the tree | |||||
| 3496 | if ( e vent._subm it_bubble ) { | |||||
| 3497 | delete e vent._subm it_bubble; | |||||
| 3498 | if ( thi s.parentNo de && !eve nt.isTrigg er ) { | |||||
| 3499 | jQuery.eve nt.simulat e( "submit ", this.pa rentNode, event, tru e ); | |||||
| 3500 | } | |||||
| 3501 | } | |||||
| 3502 | }, | |||||
| 3503 | ||||||
| 3504 | tear down: func tion() { | |||||
| 3505 | // Onl y need thi s for dele gated form submit ev ents | |||||
| 3506 | if ( j Query.node Name( this , "form" ) ) { | |||||
| 3507 | return f alse; | |||||
| 3508 | } | |||||
| 3509 | ||||||
| 3510 | // Rem ove delega ted handle rs; cleanD ata eventu ally reaps submit ha ndlers att ached abov e | |||||
| 3511 | jQuery .event.rem ove( this, "._submit " ); | |||||
| 3512 | } | |||||
| 3513 | }; | |||||
| 3514 | } | |||||
| 3515 | ||||||
| 3516 | // IE chan ge delegat ion and ch eckbox/rad io fix | |||||
| 3517 | if ( !jQue ry.support .changeBub bles ) { | |||||
| 3518 | ||||||
| 3519 | jQ uery.event .special.c hange = { | |||||
| 3520 | ||||||
| 3521 | setu p: functio n() { | |||||
| 3522 | ||||||
| 3523 | if ( r formElems. test( this .nodeName ) ) { | |||||
| 3524 | // IE do esn't fire change on a check/r adio until blur; tri gger it on click | |||||
| 3525 | // after a propert ychange. E at the blu r-change i n special. change.han dle. | |||||
| 3526 | // This still fire s onchange a second time for c heck/radio after blu r. | |||||
| 3527 | if ( thi s.type === "checkbox " || this. type === " radio" ) { | |||||
| 3528 | jQuery.eve nt.add( th is, "prope rtychange. _change", function( event ) { | |||||
| 3529 | if ( event.o riginalEve nt.propert yName === "checked" ) { | |||||
| 3530 | this ._just_cha nged = tru e; | |||||
| 3531 | } | |||||
| 3532 | }); | |||||
| 3533 | jQuery.eve nt.add( th is, "click ._change", function( event ) { | |||||
| 3534 | if ( this._j ust_change d && !even t.isTrigge r ) { | |||||
| 3535 | this ._just_cha nged = fal se; | |||||
| 3536 | } | |||||
| 3537 | // Allow tri ggered, si mulated ch ange event s (#11500) | |||||
| 3538 | jQ uery.event .simulate( "change", this, eve nt, true ) ; | |||||
| 3539 | }); | |||||
| 3540 | } | |||||
| 3541 | return f alse; | |||||
| 3542 | } | |||||
| 3543 | // Del egated eve nt; lazy-a dd a chang e handler on descend ant inputs | |||||
| 3544 | jQuery .event.add ( this, "b eforeactiv ate._chang e", functi on( e ) { | |||||
| 3545 | var elem = e.targe t; | |||||
| 3546 | ||||||
| 3547 | if ( rfo rmElems.te st( elem.n odeName ) && !jQuery ._data( el em, "chang eBubbles" ) ) { | |||||
| 3548 | jQuery.eve nt.add( el em, "chang e._change" , function ( event ) { | |||||
| 3549 | if ( this.pa rentNode & & !event.i sSimulated && !event .isTrigger ) { | |||||
| 3550 | jQue ry.event.s imulate( " change", t his.parent Node, even t, true ); | |||||
| 3551 | } | |||||
| 3552 | }); | |||||
| 3553 | jQuery._da ta( elem, "changeBub bles", tru e ); | |||||
| 3554 | } | |||||
| 3555 | }); | |||||
| 3556 | }, | |||||
| 3557 | ||||||
| 3558 | hand le: functi on( event ) { | |||||
| 3559 | var el em = event .target; | |||||
| 3560 | ||||||
| 3561 | // Swa llow nativ e change e vents from checkbox/ radio, we already tr iggered th em above | |||||
| 3562 | if ( t his !== el em || even t.isSimula ted || eve nt.isTrigg er || (ele m.type !== "radio" & & elem.typ e !== "che ckbox") ) { | |||||
| 3563 | return e vent.handl eObj.handl er.apply( this, argu ments ); | |||||
| 3564 | } | |||||
| 3565 | }, | |||||
| 3566 | ||||||
| 3567 | tear down: func tion() { | |||||
| 3568 | jQuery .event.rem ove( this, "._change " ); | |||||
| 3569 | ||||||
| 3570 | return !rformEle ms.test( t his.nodeNa me ); | |||||
| 3571 | } | |||||
| 3572 | }; | |||||
| 3573 | } | |||||
| 3574 | ||||||
| 3575 | // Create "bubbling" focus and blur even ts | |||||
| 3576 | if ( !jQue ry.support .focusinBu bbles ) { | |||||
| 3577 | jQ uery.each( { focus: " focusin", blur: "foc usout" }, function( orig, fix ) { | |||||
| 3578 | ||||||
| 3579 | // A ttach a si ngle captu ring handl er while s omeone wan ts focusin /focusout | |||||
| 3580 | var attaches = 0, | |||||
| 3581 | handle r = functi on( event ) { | |||||
| 3582 | jQuery.e vent.simul ate( fix, event.targ et, jQuery .event.fix ( event ), true ); | |||||
| 3583 | }; | |||||
| 3584 | ||||||
| 3585 | jQue ry.event.s pecial[ fi x ] = { | |||||
| 3586 | setup: function( ) { | |||||
| 3587 | if ( att aches++ == = 0 ) { | |||||
| 3588 | document.a ddEventLis tener( ori g, handler , true ); | |||||
| 3589 | } | |||||
| 3590 | }, | |||||
| 3591 | teardo wn: functi on() { | |||||
| 3592 | if ( --a ttaches == = 0 ) { | |||||
| 3593 | document.r emoveEvent Listener( orig, hand ler, true ); | |||||
| 3594 | } | |||||
| 3595 | } | |||||
| 3596 | }; | |||||
| 3597 | }) ; | |||||
| 3598 | } | |||||
| 3599 | ||||||
| 3600 | jQuery.fn. extend({ | |||||
| 3601 | ||||||
| 3602 | on : function ( types, s elector, d ata, fn, / *INTERNAL* / one ) { | |||||
| 3603 | var type, orig Fn; | |||||
| 3604 | ||||||
| 3605 | // T ypes can b e a map of types/han dlers | |||||
| 3606 | if ( typeof ty pes === "o bject" ) { | |||||
| 3607 | // ( t ypes-Objec t, selecto r, data ) | |||||
| 3608 | if ( t ypeof sele ctor !== " string" ) { | |||||
| 3609 | // ( typ es-Object, data ) | |||||
| 3610 | data = d ata || sel ector; | |||||
| 3611 | selector = undefin ed; | |||||
| 3612 | } | |||||
| 3613 | for ( type in ty pes ) { | |||||
| 3614 | this.on( type, sel ector, dat a, types[ type ], on e ); | |||||
| 3615 | } | |||||
| 3616 | return this; | |||||
| 3617 | } | |||||
| 3618 | ||||||
| 3619 | if ( data == n ull && fn == null ) { | |||||
| 3620 | // ( t ypes, fn ) | |||||
| 3621 | fn = s elector; | |||||
| 3622 | data = selector = undefine d; | |||||
| 3623 | } el se if ( fn == null ) { | |||||
| 3624 | if ( t ypeof sele ctor === " string" ) { | |||||
| 3625 | // ( typ es, select or, fn ) | |||||
| 3626 | fn = dat a; | |||||
| 3627 | data = u ndefined; | |||||
| 3628 | } else { | |||||
| 3629 | // ( typ es, data, fn ) | |||||
| 3630 | fn = dat a; | |||||
| 3631 | data = s elector; | |||||
| 3632 | selector = undefin ed; | |||||
| 3633 | } | |||||
| 3634 | } | |||||
| 3635 | if ( fn === fa lse ) { | |||||
| 3636 | fn = r eturnFalse ; | |||||
| 3637 | } el se if ( !f n ) { | |||||
| 3638 | return this; | |||||
| 3639 | } | |||||
| 3640 | ||||||
| 3641 | if ( one === 1 ) { | |||||
| 3642 | origFn = fn; | |||||
| 3643 | fn = f unction( e vent ) { | |||||
| 3644 | // Can u se an empt y set, sin ce event c ontains th e info | |||||
| 3645 | jQuery() .off( even t ); | |||||
| 3646 | return o rigFn.appl y( this, a rguments ) ; | |||||
| 3647 | }; | |||||
| 3648 | // Use same guid so caller can remov e using or igFn | |||||
| 3649 | fn.gui d = origFn .guid || ( origFn.gu id = jQuer y.guid++ ) ; | |||||
| 3650 | } | |||||
| 3651 | retu rn this.ea ch( functi on() { | |||||
| 3652 | jQuery .event.add ( this, ty pes, fn, d ata, selec tor ); | |||||
| 3653 | }); | |||||
| 3654 | }, | |||||
| 3655 | on e: functio n( types, selector, data, fn ) { | |||||
| 3656 | retu rn this.on ( types, s elector, d ata, fn, 1 ); | |||||
| 3657 | }, | |||||
| 3658 | of f: functio n( types, selector, fn ) { | |||||
| 3659 | var handleObj, type; | |||||
| 3660 | if ( types && types.prev entDefault && types. handleObj ) { | |||||
| 3661 | // ( e vent ) di spatched j Query.Even t | |||||
| 3662 | handle Obj = type s.handleOb j; | |||||
| 3663 | jQuery ( types.de legateTarg et ).off( | |||||
| 3664 | handleOb j.namespac e ? handle Obj.origTy pe + "." + handleObj .namespace : handleO bj.origTyp e, | |||||
| 3665 | handleOb j.selector , | |||||
| 3666 | handleOb j.handler | |||||
| 3667 | ); | |||||
| 3668 | return this; | |||||
| 3669 | } | |||||
| 3670 | if ( typeof ty pes === "o bject" ) { | |||||
| 3671 | // ( t ypes-objec t [, selec tor] ) | |||||
| 3672 | for ( type in ty pes ) { | |||||
| 3673 | this.off ( type, se lector, ty pes[ type ] ); | |||||
| 3674 | } | |||||
| 3675 | return this; | |||||
| 3676 | } | |||||
| 3677 | if ( selector === false || typeof selector = == "functi on" ) { | |||||
| 3678 | // ( t ypes [, fn ] ) | |||||
| 3679 | fn = s elector; | |||||
| 3680 | select or = undef ined; | |||||
| 3681 | } | |||||
| 3682 | if ( fn === fa lse ) { | |||||
| 3683 | fn = r eturnFalse ; | |||||
| 3684 | } | |||||
| 3685 | retu rn this.ea ch(functio n() { | |||||
| 3686 | jQuery .event.rem ove( this, types, fn , selector ); | |||||
| 3687 | }); | |||||
| 3688 | }, | |||||
| 3689 | ||||||
| 3690 | bi nd: functi on( types, data, fn ) { | |||||
| 3691 | retu rn this.on ( types, n ull, data, fn ); | |||||
| 3692 | }, | |||||
| 3693 | un bind: func tion( type s, fn ) { | |||||
| 3694 | retu rn this.of f( types, null, fn ) ; | |||||
| 3695 | }, | |||||
| 3696 | ||||||
| 3697 | de legate: fu nction( se lector, ty pes, data, fn ) { | |||||
| 3698 | retu rn this.on ( types, s elector, d ata, fn ); | |||||
| 3699 | }, | |||||
| 3700 | un delegate: function( selector, types, fn ) { | |||||
| 3701 | // ( namespace ) or ( se lector, ty pes [, fn] ) | |||||
| 3702 | retu rn argumen ts.length === 1 ? th is.off( se lector, "* *" ) : thi s.off( typ es, select or || "**" , fn ); | |||||
| 3703 | }, | |||||
| 3704 | ||||||
| 3705 | tr igger: fun ction( typ e, data ) { | |||||
| 3706 | retu rn this.ea ch(functio n() { | |||||
| 3707 | jQuery .event.tri gger( type , data, th is ); | |||||
| 3708 | }); | |||||
| 3709 | }, | |||||
| 3710 | tr iggerHandl er: functi on( type, data ) { | |||||
| 3711 | var elem = thi s[0]; | |||||
| 3712 | if ( elem ) { | |||||
| 3713 | return jQuery.ev ent.trigge r( type, d ata, elem, true ); | |||||
| 3714 | } | |||||
| 3715 | } | |||||
| 3716 | }); | |||||
| 3717 | /*! | |||||
| 3718 | ||||||
| 3719 | * Sizz le CSS Sel ector Engi ne | |||||
| 3720 | * | |||||
| 3721 | * Micr osoft gran ts you the right to use these script fil es for the sole purp ose of eit her: (i) i nteracting through y our browse r with the Microsoft website, subject to the websi te’s terms of use; o r (ii) usi ng the fil es as incl uded with a Microsof t product subject to that prod uct’s lice nse terms. Microsoft reserves all other rights to the files not expres sly grante d by Micro soft, whet her by imp lication, estoppel o r otherwis e. The not ices and l icenses be low are fo r informat ional purp oses only. | |||||
| 3722 | ||||||
| 3723 | ------ ---------- ----Copyri ght Attrib utions---- ---------- ---------- --- | |||||
| 3724 | * Sizz le CSS Sel ector Engi ne | |||||
| 3725 | * Copy right 2012 jQuery Fo undation a nd other c ontributor s | |||||
| 3726 | * http ://sizzlej s.com/ | |||||
| 3727 | * | |||||
| 3728 | ---------- ------MIT License--- ---------- ---------- ---------- -------- | |||||
| 3729 | * | |||||
| 3730 | * Provided for Infor mational P urposes On ly | |||||
| 3731 | * MIT Lice nse | |||||
| 3732 | * | |||||
| 3733 | * Permissi on is here by granted , free of charge, to any perso n obtainin g | |||||
| 3734 | * a copy o f this sof tware and associated documenta tion files (the | |||||
| 3735 | * "Softwar e"), to de al in the Software w ithout res triction, including | |||||
| 3736 | * without limitation the right s to use, copy, modi fy, merge, publish, | |||||
| 3737 | * distribu te, sublic ense, and/ or sell co pies of th e Software , and to | |||||
| 3738 | * permit p ersons to whom the S oftware is furnished to do so, subject t o | |||||
| 3739 | * the foll owing cond itions: | |||||
| 3740 | * | |||||
| 3741 | * The copy right noti ce and thi s permissi on notice shall be | |||||
| 3742 | * included in all co pies or su bstantial portions o f the Soft ware. | |||||
| 3743 | * | |||||
| 3744 | * THE SOFT WARE IS PR OVIDED "AS IS", WITH OUT WARRAN TY OF ANY KIND, | |||||
| 3745 | * EXPRESS OR IMPLIED , INCLUDIN G BUT NOT LIMITED TO THE WARRA NTIES OF | |||||
| 3746 | * MERCHANT ABILITY, F ITNESS FOR A PARTICU LAR PURPOS E AND | |||||
| 3747 | * NONINFRI NGEMENT. I N NO EVENT SHALL THE AUTHORS O R COPYRIGH T HOLDERS BE | |||||
| 3748 | * LIABLE F OR ANY CLA IM, DAMAGE S OR OTHER LIABILITY , WHETHER IN AN ACTI ON | |||||
| 3749 | * OF CONTR ACT, TORT OR OTHERWI SE, ARISIN G FROM, OU T OF OR IN CONNECTIO N | |||||
| 3750 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS I N THE SOFT WARE. | |||||
| 3751 | * | |||||
| 3752 | */ | |||||
| 3753 | (function( window, u ndefined ) { | |||||
| 3754 | ||||||
| 3755 | var i, | |||||
| 3756 | ca chedruns, | |||||
| 3757 | Ex pr, | |||||
| 3758 | ge tText, | |||||
| 3759 | is XML, | |||||
| 3760 | co mpile, | |||||
| 3761 | ha sDuplicate , | |||||
| 3762 | ou termostCon text, | |||||
| 3763 | ||||||
| 3764 | // Local doc ument vars | |||||
| 3765 | se tDocument, | |||||
| 3766 | do cument, | |||||
| 3767 | do cElem, | |||||
| 3768 | do cumentIsXM L, | |||||
| 3769 | rb uggyQSA, | |||||
| 3770 | rb uggyMatche s, | |||||
| 3771 | ma tches, | |||||
| 3772 | co ntains, | |||||
| 3773 | so rtOrder, | |||||
| 3774 | ||||||
| 3775 | // Instance- specific d ata | |||||
| 3776 | ex pando = "s izzle" + - (new Date( )), | |||||
| 3777 | pr eferredDoc = window. document, | |||||
| 3778 | su pport = {} , | |||||
| 3779 | di rruns = 0, | |||||
| 3780 | do ne = 0, | |||||
| 3781 | cl assCache = createCac he(), | |||||
| 3782 | to kenCache = createCac he(), | |||||
| 3783 | co mpilerCach e = create Cache(), | |||||
| 3784 | ||||||
| 3785 | // General-p urpose con stants | |||||
| 3786 | st rundefined = typeof undefined, | |||||
| 3787 | MA X_NEGATIVE = 1 << 31 , | |||||
| 3788 | ||||||
| 3789 | // Array met hods | |||||
| 3790 | ar r = [], | |||||
| 3791 | po p = arr.po p, | |||||
| 3792 | pu sh = arr.p ush, | |||||
| 3793 | sl ice = arr. slice, | |||||
| 3794 | // Use a str ipped-down indexOf i f we can't use a nat ive one | |||||
| 3795 | in dexOf = ar r.indexOf || functio n( elem ) { | |||||
| 3796 | var i = 0, | |||||
| 3797 | len = this.lengt h; | |||||
| 3798 | for ( ; i < le n; i++ ) { | |||||
| 3799 | if ( t his[i] === elem ) { | |||||
| 3800 | return i ; | |||||
| 3801 | } | |||||
| 3802 | } | |||||
| 3803 | retu rn -1; | |||||
| 3804 | }, | |||||
| 3805 | ||||||
| 3806 | ||||||
| 3807 | // Regular e xpressions | |||||
| 3808 | ||||||
| 3809 | // Whitespac e characte rs http:// www.w3.org /TR/css3-s electors/# whitespace | |||||
| 3810 | wh itespace = "[\\x20\\ t\\r\\n\\f ]", | |||||
| 3811 | // http://ww w.w3.org/T R/css3-syn tax/#chara cters | |||||
| 3812 | ch aracterEnc oding = "( ?:\\\\.|[\ \w-]|[^\\x 00-\\xa0]) +", | |||||
| 3813 | ||||||
| 3814 | // Loosely m odeled on CSS identi fier chara cters | |||||
| 3815 | // An unquot ed value s hould be a CSS ident ifier http ://www.w3. org/TR/css 3-selector s/#attribu te-selecto rs | |||||
| 3816 | // Proper sy ntax: http ://www.w3. org/TR/CSS 21/syndata .html#valu e-def-iden tifier | |||||
| 3817 | id entifier = character Encoding.r eplace( "w ", "w#" ), | |||||
| 3818 | ||||||
| 3819 | // Acceptabl e operator s http://w ww.w3.org/ TR/selecto rs/#attrib ute-select ors | |||||
| 3820 | op erators = "([*^$|!~] ?=)", | |||||
| 3821 | at tributes = "\\[" + w hitespace + "*(" + c haracterEn coding + " )" + white space + | |||||
| 3822 | "*(? :" + opera tors + whi tespace + "*(?:(['\" ])((?:\\\\ .|[^\\\\]) *?)\\3|(" + identifi er + ")|)| )" + white space + "* \\]", | |||||
| 3823 | ||||||
| 3824 | // Prefer ar guments qu oted, | |||||
| 3825 | // then no t containi ng pseudos /brackets, | |||||
| 3826 | // then at tribute se lectors/no n-parenthe tical expr essions, | |||||
| 3827 | // then an ything els e | |||||
| 3828 | // These pre ferences a re here to reduce th e number o f selector s | |||||
| 3829 | // needing tokenize in the PSE UDO preFil ter | |||||
| 3830 | ps eudos = ": (" + chara cterEncodi ng + ")(?: \\(((['\"] )((?:\\\\. |[^\\\\])* ?)\\3|((?: \\\\.|[^\\ \\()[\\]]| " + attrib utes.repla ce( 3, 8 ) + ")*)|.* )\\)|)", | |||||
| 3831 | ||||||
| 3832 | // Leading a nd non-esc aped trail ing whites pace, capt uring some non-white space char acters pre ceding the latter | |||||
| 3833 | rt rim = new RegExp( "^ " + whites pace + "+| ((?:^|[^\\ \\])(?:\\\ \.)*)" + w hitespace + "+$", "g " ), | |||||
| 3834 | ||||||
| 3835 | rc omma = new RegExp( " ^" + white space + "* ," + white space + "* " ), | |||||
| 3836 | rc ombinators = new Reg Exp( "^" + whitespac e + "*([\\ x20\\t\\r\ \n\\f>+~]) " + whites pace + "*" ), | |||||
| 3837 | rp seudo = ne w RegExp( pseudos ), | |||||
| 3838 | ri dentifier = new RegE xp( "^" + identifier + "$" ), | |||||
| 3839 | ||||||
| 3840 | ma tchExpr = { | |||||
| 3841 | "ID" : new RegE xp( "^#(" + characte rEncoding + ")" ), | |||||
| 3842 | "CLA SS": new R egExp( "^\ \.(" + cha racterEnco ding + ")" ), | |||||
| 3843 | "NAM E": new Re gExp( "^\\ [name=['\" ]?(" + cha racterEnco ding + ")[ '\"]?\\]" ), | |||||
| 3844 | "TAG ": new Reg Exp( "^(" + characte rEncoding. replace( " w", "w*" ) + ")" ), | |||||
| 3845 | "ATT R": new Re gExp( "^" + attribut es ), | |||||
| 3846 | "PSE UDO": new RegExp( "^ " + pseudo s ), | |||||
| 3847 | "CHI LD": new R egExp( "^: (only|firs t|last|nth |nth-last) -(child|of -type)(?:\ \(" + whit espace + | |||||
| 3848 | "*(eve n|odd|(([+ -]|)(\\d*) n|)" + whi tespace + "*(?:([+-] |)" + whit espace + | |||||
| 3849 | "*(\\d +)|))" + w hitespace + "*\\)|)" , "i" ), | |||||
| 3850 | // F or use in libraries implementi ng .is() | |||||
| 3851 | // W e use this for POS m atching in `select` | |||||
| 3852 | "nee dsContext" : new RegE xp( "^" + whitespace + "*[>+~] |:(even|od d|eq|gt|lt |nth|first |last)(?:\ \(" + | |||||
| 3853 | whites pace + "*( (?:-\\d)?\ \d*)" + wh itespace + "*\\)|)(? =[^-]|$)", "i" ) | |||||
| 3854 | }, | |||||
| 3855 | ||||||
| 3856 | rs ibling = / [\x20\t\r\ n\f]*[+~]/ , | |||||
| 3857 | ||||||
| 3858 | rn ative = /^ [^{]+\{\s* \[native c ode/, | |||||
| 3859 | ||||||
| 3860 | // Easily-pa rseable/re trievable ID or TAG or CLASS s electors | |||||
| 3861 | rq uickExpr = /^(?:#([\ w-]+)|(\w+ )|\.([\w-] +))$/, | |||||
| 3862 | ||||||
| 3863 | ri nputs = /^ (?:input|s elect|text area|butto n)$/i, | |||||
| 3864 | rh eader = /^ h\d$/i, | |||||
| 3865 | ||||||
| 3866 | re scape = /' |\\/g, | |||||
| 3867 | ra ttributeQu otes = /\= [\x20\t\r\ n\f]*([^'" \]]*)[\x20 \t\r\n\f]* \]/g, | |||||
| 3868 | ||||||
| 3869 | // CSS escap es http:// www.w3.org /TR/CSS21/ syndata.ht ml#escaped -character s | |||||
| 3870 | ru nescape = /\\([\da-f A-F]{1,6}[ \x20\t\r\n \f]?|.)/g, | |||||
| 3871 | fu nescape = function( _, escaped ) { | |||||
| 3872 | var high = "0x " + escape d - 0x1000 0; | |||||
| 3873 | // N aN means n on-codepoi nt | |||||
| 3874 | retu rn high != = high ? | |||||
| 3875 | escape d : | |||||
| 3876 | // BMP codepoint | |||||
| 3877 | high < 0 ? | |||||
| 3878 | String.f romCharCod e( high + 0x10000 ) : | |||||
| 3879 | // Suppl emental Pl ane codepo int (surro gate pair) | |||||
| 3880 | String.f romCharCod e( high >> 10 | 0xD8 00, high & 0x3FF | 0 xDC00 ); | |||||
| 3881 | }; | |||||
| 3882 | ||||||
| 3883 | // Use a s tripped-do wn slice i f we can't use a nat ive one | |||||
| 3884 | try { | |||||
| 3885 | sl ice.call( preferredD oc.documen tElement.c hildNodes, 0 )[0].no deType; | |||||
| 3886 | } catch ( e ) { | |||||
| 3887 | sl ice = func tion( i ) { | |||||
| 3888 | var elem, | |||||
| 3889 | result s = []; | |||||
| 3890 | whil e ( (elem = this[i++ ]) ) { | |||||
| 3891 | result s.push( el em ); | |||||
| 3892 | } | |||||
| 3893 | retu rn results ; | |||||
| 3894 | }; | |||||
| 3895 | } | |||||
| 3896 | ||||||
| 3897 | /** | |||||
| 3898 | * For fea ture detec tion | |||||
| 3899 | * @param {Function} fn The fu nction to test for n ative supp ort | |||||
| 3900 | */ | |||||
| 3901 | function i sNative( f n ) { | |||||
| 3902 | re turn rnati ve.test( f n + "" ); | |||||
| 3903 | } | |||||
| 3904 | ||||||
| 3905 | /** | |||||
| 3906 | * Create key-value caches of limited si ze | |||||
| 3907 | * @return s {Functio n(string, Object)} R eturns the Object da ta after s toring it on itself with | |||||
| 3908 | * pr operty nam e the (spa ce-suffixe d) string and (if th e cache is larger th an Expr.ca cheLength) | |||||
| 3909 | * de leting the oldest en try | |||||
| 3910 | */ | |||||
| 3911 | function c reateCache () { | |||||
| 3912 | va r cache, | |||||
| 3913 | keys = []; | |||||
| 3914 | ||||||
| 3915 | re turn (cach e = functi on( key, v alue ) { | |||||
| 3916 | // U se (key + " ") to av oid collis ion with n ative prot otype prop erties (se e Issue #1 57) | |||||
| 3917 | if ( keys.push ( key += " " ) > Exp r.cacheLen gth ) { | |||||
| 3918 | // Onl y keep the most rece nt entries | |||||
| 3919 | delete cache[ ke ys.shift() ]; | |||||
| 3920 | } | |||||
| 3921 | retu rn (cache[ key ] = v alue); | |||||
| 3922 | }) ; | |||||
| 3923 | } | |||||
| 3924 | ||||||
| 3925 | /** | |||||
| 3926 | * Mark a function f or special use by Si zzle | |||||
| 3927 | * @param {Function} fn The fu nction to mark | |||||
| 3928 | */ | |||||
| 3929 | function m arkFunctio n( fn ) { | |||||
| 3930 | fn [ expando ] = true; | |||||
| 3931 | re turn fn; | |||||
| 3932 | } | |||||
| 3933 | ||||||
| 3934 | /** | |||||
| 3935 | * Support testing u sing an el ement | |||||
| 3936 | * @param {Function} fn Passed the creat ed div and expects a boolean r esult | |||||
| 3937 | */ | |||||
| 3938 | function a ssert( fn ) { | |||||
| 3939 | va r div = do cument.cre ateElement ("div"); | |||||
| 3940 | ||||||
| 3941 | tr y { | |||||
| 3942 | retu rn fn( div ); | |||||
| 3943 | } catch (e) { | |||||
| 3944 | retu rn false; | |||||
| 3945 | } finally { | |||||
| 3946 | // r elease mem ory in IE | |||||
| 3947 | div = null; | |||||
| 3948 | } | |||||
| 3949 | } | |||||
| 3950 | ||||||
| 3951 | function S izzle( sel ector, con text, resu lts, seed ) { | |||||
| 3952 | va r match, e lem, m, no deType, | |||||
| 3953 | // Q SA vars | |||||
| 3954 | i, g roups, old , nid, new Context, n ewSelector ; | |||||
| 3955 | ||||||
| 3956 | if ( ( conte xt ? conte xt.ownerDo cument || context : preferredD oc ) !== d ocument ) { | |||||
| 3957 | setD ocument( c ontext ); | |||||
| 3958 | } | |||||
| 3959 | ||||||
| 3960 | co ntext = co ntext || d ocument; | |||||
| 3961 | re sults = re sults || [ ]; | |||||
| 3962 | ||||||
| 3963 | if ( !select or || type of selecto r !== "str ing" ) { | |||||
| 3964 | retu rn results ; | |||||
| 3965 | } | |||||
| 3966 | ||||||
| 3967 | if ( (nodeTy pe = conte xt.nodeTyp e) !== 1 & & nodeType !== 9 ) { | |||||
| 3968 | retu rn []; | |||||
| 3969 | } | |||||
| 3970 | ||||||
| 3971 | if ( !docume ntIsXML && !seed ) { | |||||
| 3972 | ||||||
| 3973 | // S hortcuts | |||||
| 3974 | if ( (match = rquickExpr .exec( sel ector )) ) { | |||||
| 3975 | // Spe ed-up: Siz zle("#ID") | |||||
| 3976 | if ( ( m = match[ 1]) ) { | |||||
| 3977 | if ( nod eType === 9 ) { | |||||
| 3978 | elem = con text.getEl ementById( m ); | |||||
| 3979 | // Check p arentNode to catch w hen Blackb erry 4.6 r eturns | |||||
| 3980 | // nodes t hat are no longer in the docum ent #6963 | |||||
| 3981 | if ( elem && elem.pa rentNode ) { | |||||
| 3982 | // Handle th e case whe re IE, Ope ra, and We bkit retur n items | |||||
| 3983 | // by name i nstead of ID | |||||
| 3984 | if ( elem.id === m ) { | |||||
| 3985 | resu lts.push( elem ); | |||||
| 3986 | retu rn results ; | |||||
| 3987 | } | |||||
| 3988 | } else { | |||||
| 3989 | re turn resul ts; | |||||
| 3990 | } | |||||
| 3991 | } else { | |||||
| 3992 | // Context is not a document | |||||
| 3993 | if ( conte xt.ownerDo cument && (elem = co ntext.owne rDocument. getElement ById( m )) && | |||||
| 3994 | co ntains( co ntext, ele m ) && ele m.id === m ) { | |||||
| 3995 | re sults.push ( elem ); | |||||
| 3996 | re turn resul ts; | |||||
| 3997 | } | |||||
| 3998 | } | |||||
| 3999 | ||||||
| 4000 | // Spe ed-up: Siz zle("TAG") | |||||
| 4001 | } else if ( matc h[2] ) { | |||||
| 4002 | push.app ly( result s, slice.c all(contex t.getEleme ntsByTagNa me( select or ), 0) ) ; | |||||
| 4003 | return r esults; | |||||
| 4004 | ||||||
| 4005 | // Spe ed-up: Siz zle(".CLAS S") | |||||
| 4006 | } else if ( (m = match[3]) && suppor t.getByCla ssName && context.ge tElementsB yClassName ) { | |||||
| 4007 | push.app ly( result s, slice.c all(contex t.getEleme ntsByClass Name( m ), 0) ); | |||||
| 4008 | return r esults; | |||||
| 4009 | } | |||||
| 4010 | } | |||||
| 4011 | ||||||
| 4012 | // Q SA path | |||||
| 4013 | if ( support.q sa && !rbu ggyQSA.tes t(selector ) ) { | |||||
| 4014 | old = true; | |||||
| 4015 | nid = expando; | |||||
| 4016 | newCon text = con text; | |||||
| 4017 | newSel ector = no deType === 9 && sele ctor; | |||||
| 4018 | ||||||
| 4019 | // qSA works str angely on Element-ro oted queri es | |||||
| 4020 | // We can work a round this by specif ying an ex tra ID on the root | |||||
| 4021 | // and working u p from the re (Thanks to Andrew Dupont fo r the tech nique) | |||||
| 4022 | // IE 8 doesn't work on ob ject eleme nts | |||||
| 4023 | if ( n odeType == = 1 && con text.nodeN ame.toLowe rCase() != = "object" ) { | |||||
| 4024 | groups = tokenize( selector ); | |||||
| 4025 | ||||||
| 4026 | if ( (ol d = contex t.getAttri bute("id") ) ) { | |||||
| 4027 | nid = old. replace( r escape, "\ \$&" ); | |||||
| 4028 | } else { | |||||
| 4029 | context.se tAttribute ( "id", ni d ); | |||||
| 4030 | } | |||||
| 4031 | nid = "[ id='" + ni d + "'] "; | |||||
| 4032 | ||||||
| 4033 | i = grou ps.length; | |||||
| 4034 | while ( i-- ) { | |||||
| 4035 | groups[i] = nid + to Selector( groups[i] ); | |||||
| 4036 | } | |||||
| 4037 | newConte xt = rsibl ing.test( selector ) && contex t.parentNo de || cont ext; | |||||
| 4038 | newSelec tor = grou ps.join(", "); | |||||
| 4039 | } | |||||
| 4040 | ||||||
| 4041 | if ( n ewSelector ) { | |||||
| 4042 | try { | |||||
| 4043 | push.apply ( results, slice.cal l( newCont ext.queryS electorAll ( | |||||
| 4044 | ne wSelector | |||||
| 4045 | ), 0 ) ); | |||||
| 4046 | return res ults; | |||||
| 4047 | } catch( qsaError) { | |||||
| 4048 | } finall y { | |||||
| 4049 | if ( !old ) { | |||||
| 4050 | co ntext.remo veAttribut e("id"); | |||||
| 4051 | } | |||||
| 4052 | } | |||||
| 4053 | } | |||||
| 4054 | } | |||||
| 4055 | } | |||||
| 4056 | ||||||
| 4057 | // All other s | |||||
| 4058 | re turn selec t( selecto r.replace( rtrim, "$ 1" ), cont ext, resul ts, seed ) ; | |||||
| 4059 | } | |||||
| 4060 | ||||||
| 4061 | /** | |||||
| 4062 | * Detect xml | |||||
| 4063 | * @param {Element|O bject} ele m An eleme nt or a do cument | |||||
| 4064 | */ | |||||
| 4065 | isXML = Si zzle.isXML = functio n( elem ) { | |||||
| 4066 | // documentE lement is verified f or cases w here it do esn't yet exist | |||||
| 4067 | // (such as loading if rames in I E - #4833) | |||||
| 4068 | va r document Element = elem && (e lem.ownerD ocument || elem).doc umentEleme nt; | |||||
| 4069 | re turn docum entElement ? documen tElement.n odeName != = "HTML" : false; | |||||
| 4070 | }; | |||||
| 4071 | ||||||
| 4072 | /** | |||||
| 4073 | * Sets do cument-rel ated varia bles once based on t he current document | |||||
| 4074 | * @param {Element|O bject} [do c] An elem ent or doc ument obje ct to use to set the document | |||||
| 4075 | * @return s {Object} Returns t he current document | |||||
| 4076 | */ | |||||
| 4077 | setDocumen t = Sizzle .setDocume nt = funct ion( node ) { | |||||
| 4078 | va r doc = no de ? node. ownerDocum ent || nod e : prefer redDoc; | |||||
| 4079 | ||||||
| 4080 | // If no doc ument and documentEl ement is a vailable, return | |||||
| 4081 | if ( doc === document || doc.nod eType !== 9 || !doc. documentEl ement ) { | |||||
| 4082 | retu rn documen t; | |||||
| 4083 | } | |||||
| 4084 | ||||||
| 4085 | // Set our d ocument | |||||
| 4086 | do cument = d oc; | |||||
| 4087 | do cElem = do c.document Element; | |||||
| 4088 | ||||||
| 4089 | // Support t ests | |||||
| 4090 | do cumentIsXM L = isXML( doc ); | |||||
| 4091 | ||||||
| 4092 | // Check if getElement sByTagName ("*") retu rns only e lements | |||||
| 4093 | su pport.tagN ameNoComme nts = asse rt(functio n( div ) { | |||||
| 4094 | div. appendChil d( doc.cre ateComment ("") ); | |||||
| 4095 | retu rn !div.ge tElementsB yTagName(" *").length ; | |||||
| 4096 | }) ; | |||||
| 4097 | ||||||
| 4098 | // Check if attributes should be retrieved by attrib ute nodes | |||||
| 4099 | su pport.attr ibutes = a ssert(func tion( div ) { | |||||
| 4100 | div. innerHTML = "<select ></select> "; | |||||
| 4101 | var type = typ eof div.la stChild.ge tAttribute ("multiple "); | |||||
| 4102 | // I E8 returns a string for some a ttributes even when not presen t | |||||
| 4103 | retu rn type != = "boolean " && type !== "strin g"; | |||||
| 4104 | }) ; | |||||
| 4105 | ||||||
| 4106 | // Check if getElement sByClassNa me can be trusted | |||||
| 4107 | su pport.getB yClassName = assert( function( div ) { | |||||
| 4108 | // O pera can't find a se cond class name (in 9 .6) | |||||
| 4109 | div. innerHTML = "<div cl ass='hidde n e'></div ><div clas s='hidden' ></div>"; | |||||
| 4110 | if ( !div.getE lementsByC lassName | | !div.get ElementsBy ClassName( "e").lengt h ) { | |||||
| 4111 | return false; | |||||
| 4112 | } | |||||
| 4113 | ||||||
| 4114 | // S afari 3.2 caches cla ss attribu tes and do esn't catc h changes | |||||
| 4115 | div. lastChild. className = "e"; | |||||
| 4116 | retu rn div.get ElementsBy ClassName( "e").lengt h === 2; | |||||
| 4117 | }) ; | |||||
| 4118 | ||||||
| 4119 | // Check if getElement ById retur ns element s by name | |||||
| 4120 | // Check if getElement sByName pr ivileges f orm contro ls or retu rns elemen ts by ID | |||||
| 4121 | su pport.getB yName = as sert(funct ion( div ) { | |||||
| 4122 | // I nject cont ent | |||||
| 4123 | div. id = expan do + 0; | |||||
| 4124 | div. innerHTML = "<a name ='" + expa ndo + "'>< /a><div na me='" + ex pando + "' ></div>"; | |||||
| 4125 | docE lem.insert Before( di v, docElem .firstChil d ); | |||||
| 4126 | ||||||
| 4127 | // T est | |||||
| 4128 | var pass = doc .getElemen tsByName & & | |||||
| 4129 | // bug gy browser s will ret urn fewer than the c orrect 2 | |||||
| 4130 | doc.ge tElementsB yName( exp ando ).len gth === 2 + | |||||
| 4131 | // bug gy browser s will ret urn more t han the co rrect 0 | |||||
| 4132 | doc.ge tElementsB yName( exp ando + 0 ) .length; | |||||
| 4133 | supp ort.getIdN otName = ! doc.getEle mentById( expando ); | |||||
| 4134 | ||||||
| 4135 | // C leanup | |||||
| 4136 | docE lem.remove Child( div ); | |||||
| 4137 | ||||||
| 4138 | retu rn pass; | |||||
| 4139 | }) ; | |||||
| 4140 | ||||||
| 4141 | // IE6/7 ret urn modifi ed attribu tes | |||||
| 4142 | Ex pr.attrHan dle = asse rt(functio n( div ) { | |||||
| 4143 | div. innerHTML = "<a href ='#'></a>" ; | |||||
| 4144 | retu rn div.fir stChild && typeof di v.firstChi ld.getAttr ibute !== strundefin ed && | |||||
| 4145 | div.fi rstChild.g etAttribut e("href") === "#"; | |||||
| 4146 | }) ? | |||||
| 4147 | {} : | |||||
| 4148 | { | |||||
| 4149 | "href" : function ( elem ) { | |||||
| 4150 | return e lem.getAtt ribute( "h ref", 2 ); | |||||
| 4151 | }, | |||||
| 4152 | "type" : function ( elem ) { | |||||
| 4153 | return e lem.getAtt ribute("ty pe"); | |||||
| 4154 | } | |||||
| 4155 | }; | |||||
| 4156 | ||||||
| 4157 | // ID find a nd filter | |||||
| 4158 | if ( support .getIdNotN ame ) { | |||||
| 4159 | Expr .find["ID" ] = functi on( id, co ntext ) { | |||||
| 4160 | if ( t ypeof cont ext.getEle mentById ! == strunde fined && ! documentIs XML ) { | |||||
| 4161 | var m = context.ge tElementBy Id( id ); | |||||
| 4162 | // Check parentNod e to catch when Blac kberry 4.6 returns | |||||
| 4163 | // nodes that are no longer in the doc ument #696 3 | |||||
| 4164 | return m && m.pare ntNode ? [ m] : []; | |||||
| 4165 | } | |||||
| 4166 | }; | |||||
| 4167 | Expr .filter["I D"] = func tion( id ) { | |||||
| 4168 | var at trId = id. replace( r unescape, funescape ); | |||||
| 4169 | return function( elem ) { | |||||
| 4170 | return e lem.getAtt ribute("id ") === att rId; | |||||
| 4171 | }; | |||||
| 4172 | }; | |||||
| 4173 | } else { | |||||
| 4174 | Expr .find["ID" ] = functi on( id, co ntext ) { | |||||
| 4175 | if ( t ypeof cont ext.getEle mentById ! == strunde fined && ! documentIs XML ) { | |||||
| 4176 | var m = context.ge tElementBy Id( id ); | |||||
| 4177 | ||||||
| 4178 | return m ? | |||||
| 4179 | m.id === i d || typeo f m.getAtt ributeNode !== strun defined && m.getAttr ibuteNode( "id").valu e === id ? | |||||
| 4180 | [m ] : | |||||
| 4181 | un defined : | |||||
| 4182 | []; | |||||
| 4183 | } | |||||
| 4184 | }; | |||||
| 4185 | Expr .filter["I D"] = fun ction( id ) { | |||||
| 4186 | var at trId = id. replace( r unescape, funescape ); | |||||
| 4187 | return function( elem ) { | |||||
| 4188 | var node = typeof elem.getAt tributeNod e !== stru ndefined & & elem.get AttributeN ode("id"); | |||||
| 4189 | return n ode && nod e.value == = attrId; | |||||
| 4190 | }; | |||||
| 4191 | }; | |||||
| 4192 | } | |||||
| 4193 | ||||||
| 4194 | // Tag | |||||
| 4195 | Ex pr.find["T AG"] = sup port.tagNa meNoCommen ts ? | |||||
| 4196 | func tion( tag, context ) { | |||||
| 4197 | if ( t ypeof cont ext.getEle mentsByTag Name !== s trundefine d ) { | |||||
| 4198 | return c ontext.get ElementsBy TagName( t ag ); | |||||
| 4199 | } | |||||
| 4200 | } : | |||||
| 4201 | func tion( tag, context ) { | |||||
| 4202 | var el em, | |||||
| 4203 | tmp = [] , | |||||
| 4204 | i = 0, | |||||
| 4205 | results = context. getElement sByTagName ( tag ); | |||||
| 4206 | ||||||
| 4207 | // Fil ter out po ssible com ments | |||||
| 4208 | if ( t ag === "*" ) { | |||||
| 4209 | while ( (elem = re sults[i++] ) ) { | |||||
| 4210 | if ( elem. nodeType = == 1 ) { | |||||
| 4211 | tm p.push( el em ); | |||||
| 4212 | } | |||||
| 4213 | } | |||||
| 4214 | ||||||
| 4215 | return t mp; | |||||
| 4216 | } | |||||
| 4217 | return results; | |||||
| 4218 | }; | |||||
| 4219 | ||||||
| 4220 | // Name | |||||
| 4221 | Ex pr.find["N AME"] = su pport.getB yName && f unction( t ag, contex t ) { | |||||
| 4222 | if ( typeof co ntext.getE lementsByN ame !== st rundefined ) { | |||||
| 4223 | return context.g etElements ByName( na me ); | |||||
| 4224 | } | |||||
| 4225 | }; | |||||
| 4226 | ||||||
| 4227 | // Class | |||||
| 4228 | Ex pr.find["C LASS"] = s upport.get ByClassNam e && funct ion( class Name, cont ext ) { | |||||
| 4229 | if ( typeof co ntext.getE lementsByC lassName ! == strunde fined && ! documentIs XML ) { | |||||
| 4230 | return context.g etElements ByClassNam e( classNa me ); | |||||
| 4231 | } | |||||
| 4232 | }; | |||||
| 4233 | ||||||
| 4234 | // QSA and m atchesSele ctor suppo rt | |||||
| 4235 | ||||||
| 4236 | // matchesSe lector(:ac tive) repo rts false when true (IE9/Opera 11.5) | |||||
| 4237 | rb uggyMatche s = []; | |||||
| 4238 | ||||||
| 4239 | // qSa(:focu s) reports false whe n true (Ch rome 21), | |||||
| 4240 | // no need t o also add to buggyM atches sin ce matches checks bu ggyQSA | |||||
| 4241 | // A support test woul d require too much c ode (would include d ocument re ady) | |||||
| 4242 | rb uggyQSA = [ ":focus" ]; | |||||
| 4243 | ||||||
| 4244 | if ( (suppor t.qsa = is Native(doc .querySele ctorAll)) ) { | |||||
| 4245 | // B uild QSA r egex | |||||
| 4246 | // R egex strat egy adopte d from Die go Perini | |||||
| 4247 | asse rt(functio n( div ) { | |||||
| 4248 | // Sel ect is set to empty string on purpose | |||||
| 4249 | // Thi s is to te st IE's tr eatment of not expli ctly | |||||
| 4250 | // set ting a boo lean conte nt attribu te, | |||||
| 4251 | // sin ce its pre sence shou ld be enou gh | |||||
| 4252 | // htt p://bugs.j query.com/ ticket/123 59 | |||||
| 4253 | div.in nerHTML = "<select>< option sel ected=''>< /option></ select>"; | |||||
| 4254 | ||||||
| 4255 | // IE8 - Some bo olean attr ibutes are not treat ed correct ly | |||||
| 4256 | if ( ! div.queryS electorAll ("[selecte d]").lengt h ) { | |||||
| 4257 | rbuggyQS A.push( "\ \[" + whit espace + " *(?:checke d|disabled |ismap|mul tiple|read only|selec ted|value) " ); | |||||
| 4258 | } | |||||
| 4259 | ||||||
| 4260 | // Web kit/Opera - :checked should re turn selec ted option elements | |||||
| 4261 | // htt p://www.w3 .org/TR/20 11/REC-css 3-selector s-20110929 /#checked | |||||
| 4262 | // IE8 throws er ror here a nd will no t see late r tests | |||||
| 4263 | if ( ! div.queryS electorAll (":checked ").length ) { | |||||
| 4264 | rbuggyQS A.push(":c hecked"); | |||||
| 4265 | } | |||||
| 4266 | }); | |||||
| 4267 | ||||||
| 4268 | asse rt(functio n( div ) { | |||||
| 4269 | ||||||
| 4270 | // Ope ra 10-12/I E8 - ^= $= *= and em pty values | |||||
| 4271 | // Sho uld not se lect anyth ing | |||||
| 4272 | div.in nerHTML = "<input ty pe='hidden ' i=''/>"; | |||||
| 4273 | if ( d iv.querySe lectorAll( "[i^='']") .length ) { | |||||
| 4274 | rbuggyQS A.push( "[ *^$]=" + w hitespace + "*(?:\"\ "|'')" ); | |||||
| 4275 | } | |||||
| 4276 | ||||||
| 4277 | // FF 3.5 - :ena bled/:disa bled and h idden elem ents (hidd en element s are stil l enabled) | |||||
| 4278 | // IE8 throws er ror here a nd will no t see late r tests | |||||
| 4279 | if ( ! div.queryS electorAll (":enabled ").length ) { | |||||
| 4280 | rbuggyQS A.push( ": enabled", ":disabled " ); | |||||
| 4281 | } | |||||
| 4282 | ||||||
| 4283 | // Ope ra 10-11 d oes not th row on pos t-comma in valid pseu dos | |||||
| 4284 | div.qu erySelecto rAll("*,:x "); | |||||
| 4285 | rbuggy QSA.push(" ,.*:"); | |||||
| 4286 | }); | |||||
| 4287 | } | |||||
| 4288 | ||||||
| 4289 | if ( (suppor t.matchesS elector = isNative( (matches = docElem.m atchesSele ctor || | |||||
| 4290 | docE lem.mozMat chesSelect or || | |||||
| 4291 | docE lem.webkit MatchesSel ector || | |||||
| 4292 | docE lem.oMatch esSelector || | |||||
| 4293 | docE lem.msMatc hesSelecto r) )) ) { | |||||
| 4294 | ||||||
| 4295 | asse rt(functio n( div ) { | |||||
| 4296 | // Che ck to see if it's po ssible to do matches Selector | |||||
| 4297 | // on a disconne cted node (IE 9) | |||||
| 4298 | suppor t.disconne ctedMatch = matches. call( div, "div" ); | |||||
| 4299 | ||||||
| 4300 | // Thi s should f ail with a n exceptio n | |||||
| 4301 | // Gec ko does no t error, r eturns fal se instead | |||||
| 4302 | matche s.call( di v, "[s!='' ]:x" ); | |||||
| 4303 | rbuggy Matches.pu sh( "!=", pseudos ); | |||||
| 4304 | }); | |||||
| 4305 | } | |||||
| 4306 | ||||||
| 4307 | rb uggyQSA = new RegExp ( rbuggyQS A.join("|" ) ); | |||||
| 4308 | rb uggyMatche s = new Re gExp( rbug gyMatches. join("|") ); | |||||
| 4309 | ||||||
| 4310 | // Element c ontains an other | |||||
| 4311 | // Purposefu lly does n ot impleme nt inclusi ve descend ent | |||||
| 4312 | // As in, an element d oes not co ntain itse lf | |||||
| 4313 | co ntains = i sNative(do cElem.cont ains) || d ocElem.com pareDocume ntPosition ? | |||||
| 4314 | func tion( a, b ) { | |||||
| 4315 | var ad own = a.no deType === 9 ? a.doc umentEleme nt : a, | |||||
| 4316 | bup = b && b.paren tNode; | |||||
| 4317 | return a === bup || !!( bu p && bup.n odeType == = 1 && ( | |||||
| 4318 | adown.co ntains ? | |||||
| 4319 | adown.cont ains( bup ) : | |||||
| 4320 | a.compareD ocumentPos ition && a .compareDo cumentPosi tion( bup ) & 16 | |||||
| 4321 | )); | |||||
| 4322 | } : | |||||
| 4323 | func tion( a, b ) { | |||||
| 4324 | if ( b ) { | |||||
| 4325 | while ( (b = b.par entNode) ) { | |||||
| 4326 | if ( b === a ) { | |||||
| 4327 | re turn true; | |||||
| 4328 | } | |||||
| 4329 | } | |||||
| 4330 | } | |||||
| 4331 | return false; | |||||
| 4332 | }; | |||||
| 4333 | ||||||
| 4334 | // Document order sort ing | |||||
| 4335 | so rtOrder = docElem.co mpareDocum entPositio n ? | |||||
| 4336 | fu nction( a, b ) { | |||||
| 4337 | var compare; | |||||
| 4338 | ||||||
| 4339 | if ( a === b ) { | |||||
| 4340 | hasDup licate = t rue; | |||||
| 4341 | return 0; | |||||
| 4342 | } | |||||
| 4343 | ||||||
| 4344 | if ( (compare = b.compar eDocumentP osition && a.compare DocumentPo sition && a.compareD ocumentPos ition( b ) ) ) { | |||||
| 4345 | if ( c ompare & 1 || a.pare ntNode && a.parentNo de.nodeTyp e === 11 ) { | |||||
| 4346 | if ( a = == doc || contains( preferredD oc, a ) ) { | |||||
| 4347 | return -1; | |||||
| 4348 | } | |||||
| 4349 | if ( b = == doc || contains( preferredD oc, b ) ) { | |||||
| 4350 | return 1; | |||||
| 4351 | } | |||||
| 4352 | return 0 ; | |||||
| 4353 | } | |||||
| 4354 | return compare & 4 ? -1 : 1; | |||||
| 4355 | } | |||||
| 4356 | ||||||
| 4357 | retu rn a.compa reDocument Position ? -1 : 1; | |||||
| 4358 | } : | |||||
| 4359 | fu nction( a, b ) { | |||||
| 4360 | var cur, | |||||
| 4361 | i = 0, | |||||
| 4362 | aup = a.parentNo de, | |||||
| 4363 | bup = b.parentNo de, | |||||
| 4364 | ap = [ a ], | |||||
| 4365 | bp = [ b ]; | |||||
| 4366 | ||||||
| 4367 | // E xit early if the nod es are ide ntical | |||||
| 4368 | if ( a === b ) { | |||||
| 4369 | hasDup licate = t rue; | |||||
| 4370 | return 0; | |||||
| 4371 | ||||||
| 4372 | // P arentless nodes are either doc uments or disconnect ed | |||||
| 4373 | } el se if ( !a up || !bup ) { | |||||
| 4374 | return a === doc ? -1 : | |||||
| 4375 | b === do c ? 1 : | |||||
| 4376 | aup ? -1 : | |||||
| 4377 | bup ? 1 : | |||||
| 4378 | 0; | |||||
| 4379 | ||||||
| 4380 | // I f the node s are sibl ings, we c an do a qu ick check | |||||
| 4381 | } el se if ( au p === bup ) { | |||||
| 4382 | return siblingCh eck( a, b ); | |||||
| 4383 | } | |||||
| 4384 | ||||||
| 4385 | // O therwise w e need ful l lists of their anc estors for compariso n | |||||
| 4386 | cur = a; | |||||
| 4387 | whil e ( (cur = cur.paren tNode) ) { | |||||
| 4388 | ap.uns hift( cur ); | |||||
| 4389 | } | |||||
| 4390 | cur = b; | |||||
| 4391 | whil e ( (cur = cur.paren tNode) ) { | |||||
| 4392 | bp.uns hift( cur ); | |||||
| 4393 | } | |||||
| 4394 | ||||||
| 4395 | // W alk down t he tree lo oking for a discrepa ncy | |||||
| 4396 | whil e ( ap[i] === bp[i] ) { | |||||
| 4397 | i++; | |||||
| 4398 | } | |||||
| 4399 | ||||||
| 4400 | retu rn i ? | |||||
| 4401 | // Do a sibling check if t he nodes h ave a comm on ancesto r | |||||
| 4402 | siblin gCheck( ap [i], bp[i] ) : | |||||
| 4403 | ||||||
| 4404 | // Oth erwise nod es in our document s ort first | |||||
| 4405 | ap[i] === prefer redDoc ? - 1 : | |||||
| 4406 | bp[i] === prefer redDoc ? 1 : | |||||
| 4407 | 0; | |||||
| 4408 | }; | |||||
| 4409 | ||||||
| 4410 | // Always as sume the p resence of duplicate s if sort doesn't | |||||
| 4411 | // pass them to our co mparison f unction (a s in Googl e Chrome). | |||||
| 4412 | ha sDuplicate = false; | |||||
| 4413 | [0 , 0].sort( sortOrder ); | |||||
| 4414 | su pport.dete ctDuplicat es = hasDu plicate; | |||||
| 4415 | ||||||
| 4416 | re turn docum ent; | |||||
| 4417 | }; | |||||
| 4418 | ||||||
| 4419 | Sizzle.mat ches = fun ction( exp r, element s ) { | |||||
| 4420 | re turn Sizzl e( expr, n ull, null, elements ); | |||||
| 4421 | }; | |||||
| 4422 | ||||||
| 4423 | Sizzle.mat chesSelect or = funct ion( elem, expr ) { | |||||
| 4424 | // Set docum ent vars i f needed | |||||
| 4425 | if ( ( elem. ownerDocum ent || ele m ) !== do cument ) { | |||||
| 4426 | setD ocument( e lem ); | |||||
| 4427 | } | |||||
| 4428 | ||||||
| 4429 | // Make sure that attr ibute sele ctors are quoted | |||||
| 4430 | ex pr = expr. replace( r attributeQ uotes, "=' $1']" ); | |||||
| 4431 | ||||||
| 4432 | // rbuggyQSA always co ntains :fo cus, so no need for an existen ce check | |||||
| 4433 | if ( support .matchesSe lector && !documentI sXML && (! rbuggyMatc hes || !rb uggyMatche s.test(exp r)) && !rb uggyQSA.te st(expr) ) { | |||||
| 4434 | try { | |||||
| 4435 | var re t = matche s.call( el em, expr ) ; | |||||
| 4436 | ||||||
| 4437 | // IE 9's matche sSelector returns fa lse on dis connected nodes | |||||
| 4438 | if ( r et || supp ort.discon nectedMatc h || | |||||
| 4439 | // As well , disconne cted nodes are said to be in a document | |||||
| 4440 | // fragmen t in IE 9 | |||||
| 4441 | elem.docum ent && ele m.document .nodeType !== 11 ) { | |||||
| 4442 | return r et; | |||||
| 4443 | } | |||||
| 4444 | } ca tch(e) {} | |||||
| 4445 | } | |||||
| 4446 | ||||||
| 4447 | re turn Sizzl e( expr, d ocument, n ull, [elem ] ).length > 0; | |||||
| 4448 | }; | |||||
| 4449 | ||||||
| 4450 | Sizzle.con tains = fu nction( co ntext, ele m ) { | |||||
| 4451 | // Set docum ent vars i f needed | |||||
| 4452 | if ( ( conte xt.ownerDo cument || context ) !== docume nt ) { | |||||
| 4453 | setD ocument( c ontext ); | |||||
| 4454 | } | |||||
| 4455 | re turn conta ins( conte xt, elem ) ; | |||||
| 4456 | }; | |||||
| 4457 | ||||||
| 4458 | Sizzle.att r = functi on( elem, name ) { | |||||
| 4459 | va r val; | |||||
| 4460 | ||||||
| 4461 | // Set docum ent vars i f needed | |||||
| 4462 | if ( ( elem. ownerDocum ent || ele m ) !== do cument ) { | |||||
| 4463 | setD ocument( e lem ); | |||||
| 4464 | } | |||||
| 4465 | ||||||
| 4466 | if ( !docume ntIsXML ) { | |||||
| 4467 | name = name.to LowerCase( ); | |||||
| 4468 | } | |||||
| 4469 | if ( (val = Expr.attrH andle[ nam e ]) ) { | |||||
| 4470 | retu rn val( el em ); | |||||
| 4471 | } | |||||
| 4472 | if ( documen tIsXML || support.at tributes ) { | |||||
| 4473 | retu rn elem.ge tAttribute ( name ); | |||||
| 4474 | } | |||||
| 4475 | re turn ( (va l = elem.g etAttribut eNode( nam e )) || el em.getAttr ibute( nam e ) ) && e lem[ name ] === true ? | |||||
| 4476 | name : | |||||
| 4477 | val && val.spe cified ? v al.value : null; | |||||
| 4478 | }; | |||||
| 4479 | ||||||
| 4480 | Sizzle.err or = funct ion( msg ) { | |||||
| 4481 | th row new Er ror( "Synt ax error, unrecogniz ed express ion: " + m sg ); | |||||
| 4482 | }; | |||||
| 4483 | ||||||
| 4484 | // Documen t sorting and removi ng duplica tes | |||||
| 4485 | Sizzle.uni queSort = function( results ) { | |||||
| 4486 | va r elem, | |||||
| 4487 | dupl icates = [ ], | |||||
| 4488 | i = 1, | |||||
| 4489 | j = 0; | |||||
| 4490 | ||||||
| 4491 | // Unless we *know* we can detec t duplicat es, assume their pre sence | |||||
| 4492 | ha sDuplicate = !suppor t.detectDu plicates; | |||||
| 4493 | re sults.sort ( sortOrde r ); | |||||
| 4494 | ||||||
| 4495 | if ( hasDupl icate ) { | |||||
| 4496 | for ( ; (elem = results[ i]); i++ ) { | |||||
| 4497 | if ( e lem === re sults[ i - 1 ] ) { | |||||
| 4498 | j = dupl icates.pus h( i ); | |||||
| 4499 | } | |||||
| 4500 | } | |||||
| 4501 | whil e ( j-- ) { | |||||
| 4502 | result s.splice( duplicates [ j ], 1 ) ; | |||||
| 4503 | } | |||||
| 4504 | } | |||||
| 4505 | ||||||
| 4506 | re turn resul ts; | |||||
| 4507 | }; | |||||
| 4508 | ||||||
| 4509 | function s iblingChec k( a, b ) { | |||||
| 4510 | va r cur = b && a, | |||||
| 4511 | diff = cur && ( ~b.sourc eIndex || MAX_NEGATI VE ) - ( ~ a.sourceIn dex || MAX _NEGATIVE ); | |||||
| 4512 | ||||||
| 4513 | // Use IE so urceIndex if availab le on both nodes | |||||
| 4514 | if ( diff ) { | |||||
| 4515 | retu rn diff; | |||||
| 4516 | } | |||||
| 4517 | ||||||
| 4518 | // Check if b follows a | |||||
| 4519 | if ( cur ) { | |||||
| 4520 | whil e ( (cur = cur.nextS ibling) ) { | |||||
| 4521 | if ( c ur === b ) { | |||||
| 4522 | return - 1; | |||||
| 4523 | } | |||||
| 4524 | } | |||||
| 4525 | } | |||||
| 4526 | ||||||
| 4527 | re turn a ? 1 : -1; | |||||
| 4528 | } | |||||
| 4529 | ||||||
| 4530 | // Returns a functio n to use i n pseudos for input types | |||||
| 4531 | function c reateInput Pseudo( ty pe ) { | |||||
| 4532 | re turn funct ion( elem ) { | |||||
| 4533 | var name = ele m.nodeName .toLowerCa se(); | |||||
| 4534 | retu rn name == = "input" && elem.ty pe === typ e; | |||||
| 4535 | }; | |||||
| 4536 | } | |||||
| 4537 | ||||||
| 4538 | // Returns a functio n to use i n pseudos for button s | |||||
| 4539 | function c reateButto nPseudo( t ype ) { | |||||
| 4540 | re turn funct ion( elem ) { | |||||
| 4541 | var name = ele m.nodeName .toLowerCa se(); | |||||
| 4542 | retu rn (name = == "input" || name = == "button ") && elem .type === type; | |||||
| 4543 | }; | |||||
| 4544 | } | |||||
| 4545 | ||||||
| 4546 | // Returns a functio n to use i n pseudos for positi onals | |||||
| 4547 | function c reatePosit ionalPseud o( fn ) { | |||||
| 4548 | re turn markF unction(fu nction( ar gument ) { | |||||
| 4549 | argu ment = +ar gument; | |||||
| 4550 | retu rn markFun ction(func tion( seed , matches ) { | |||||
| 4551 | var j, | |||||
| 4552 | matchInd exes = fn( [], seed. length, ar gument ), | |||||
| 4553 | i = matc hIndexes.l ength; | |||||
| 4554 | ||||||
| 4555 | // Mat ch element s found at the speci fied index es | |||||
| 4556 | while ( i-- ) { | |||||
| 4557 | if ( see d[ (j = ma tchIndexes [i]) ] ) { | |||||
| 4558 | seed[j] = !(matches[ j] = seed[ j]); | |||||
| 4559 | } | |||||
| 4560 | } | |||||
| 4561 | }); | |||||
| 4562 | }) ; | |||||
| 4563 | } | |||||
| 4564 | ||||||
| 4565 | /** | |||||
| 4566 | * Utility function for retrie ving the t ext value of an arra y of DOM n odes | |||||
| 4567 | * @param {Array|Ele ment} elem | |||||
| 4568 | */ | |||||
| 4569 | getText = Sizzle.get Text = fun ction( ele m ) { | |||||
| 4570 | va r node, | |||||
| 4571 | ret = "", | |||||
| 4572 | i = 0, | |||||
| 4573 | node Type = ele m.nodeType ; | |||||
| 4574 | ||||||
| 4575 | if ( !nodeTy pe ) { | |||||
| 4576 | // I f no nodeT ype, this is expecte d to be an array | |||||
| 4577 | for ( ; (node = elem[i]) ; i++ ) { | |||||
| 4578 | // Do not traver se comment nodes | |||||
| 4579 | ret += getText( node ); | |||||
| 4580 | } | |||||
| 4581 | } else if ( nodeType = == 1 || no deType === 9 || node Type === 1 1 ) { | |||||
| 4582 | // U se textCon tent for e lements | |||||
| 4583 | // i nnerText u sage remov ed for con sistency o f new line s (see #11 153) | |||||
| 4584 | if ( typeof el em.textCon tent === " string" ) { | |||||
| 4585 | return elem.text Content; | |||||
| 4586 | } el se { | |||||
| 4587 | // Tra verse its children | |||||
| 4588 | for ( elem = ele m.firstChi ld; elem; elem = ele m.nextSibl ing ) { | |||||
| 4589 | ret += g etText( el em ); | |||||
| 4590 | } | |||||
| 4591 | } | |||||
| 4592 | } else if ( nodeType = == 3 || no deType === 4 ) { | |||||
| 4593 | retu rn elem.no deValue; | |||||
| 4594 | } | |||||
| 4595 | // Do not in clude comm ent or pro cessing in struction nodes | |||||
| 4596 | ||||||
| 4597 | re turn ret; | |||||
| 4598 | }; | |||||
| 4599 | ||||||
| 4600 | Expr = Siz zle.select ors = { | |||||
| 4601 | ||||||
| 4602 | // Can be ad justed by the user | |||||
| 4603 | ca cheLength: 50, | |||||
| 4604 | ||||||
| 4605 | cr eatePseudo : markFunc tion, | |||||
| 4606 | ||||||
| 4607 | ma tch: match Expr, | |||||
| 4608 | ||||||
| 4609 | fi nd: {}, | |||||
| 4610 | ||||||
| 4611 | re lative: { | |||||
| 4612 | ">": { dir: "p arentNode" , first: t rue }, | |||||
| 4613 | " ": { dir: "p arentNode" }, | |||||
| 4614 | "+": { dir: "p reviousSib ling", fir st: true } , | |||||
| 4615 | "~": { dir: "p reviousSib ling" } | |||||
| 4616 | }, | |||||
| 4617 | ||||||
| 4618 | pr eFilter: { | |||||
| 4619 | "ATT R": functi on( match ) { | |||||
| 4620 | match[ 1] = match [1].replac e( runesca pe, funesc ape ); | |||||
| 4621 | ||||||
| 4622 | // Mov e the give n value to match[3] whether qu oted or un quoted | |||||
| 4623 | match[ 3] = ( mat ch[4] || m atch[5] || "" ).repl ace( runes cape, fune scape ); | |||||
| 4624 | ||||||
| 4625 | if ( m atch[2] == = "~=" ) { | |||||
| 4626 | match[3] = " " + m atch[3] + " "; | |||||
| 4627 | } | |||||
| 4628 | ||||||
| 4629 | return match.sli ce( 0, 4 ) ; | |||||
| 4630 | }, | |||||
| 4631 | ||||||
| 4632 | "CHI LD": funct ion( match ) { | |||||
| 4633 | /* mat ches from matchExpr[ "CHILD"] | |||||
| 4634 | 1 type ( only|nth|. ..) | |||||
| 4635 | 2 what ( child|of-t ype) | |||||
| 4636 | 3 argume nt (even|o dd|\d*|\d* n([+-]\d+) ?|...) | |||||
| 4637 | 4 xn-com ponent of xn+y argum ent ([+-]? \d*n|) | |||||
| 4638 | 5 sign o f xn-compo nent | |||||
| 4639 | 6 x of x n-componen t | |||||
| 4640 | 7 sign o f y-compon ent | |||||
| 4641 | 8 y of y -component | |||||
| 4642 | */ | |||||
| 4643 | match[ 1] = match [1].toLowe rCase(); | |||||
| 4644 | ||||||
| 4645 | if ( m atch[1].sl ice( 0, 3 ) === "nth " ) { | |||||
| 4646 | // nth-* requires argument | |||||
| 4647 | if ( !ma tch[3] ) { | |||||
| 4648 | Sizzle.err or( match[ 0] ); | |||||
| 4649 | } | |||||
| 4650 | ||||||
| 4651 | // numer ic x and y parameter s for Expr .filter.CH ILD | |||||
| 4652 | // remem ber that f alse/true cast respe ctively to 0/1 | |||||
| 4653 | match[4] = +( matc h[4] ? mat ch[5] + (m atch[6] || 1) : 2 * ( match[3] === "even " || match [3] === "o dd" ) ); | |||||
| 4654 | match[5] = +( ( ma tch[7] + m atch[8] ) || match[3 ] === "odd " ); | |||||
| 4655 | ||||||
| 4656 | // oth er types p rohibit ar guments | |||||
| 4657 | } else if ( matc h[3] ) { | |||||
| 4658 | Sizzle.e rror( matc h[0] ); | |||||
| 4659 | } | |||||
| 4660 | ||||||
| 4661 | return match; | |||||
| 4662 | }, | |||||
| 4663 | ||||||
| 4664 | "PSE UDO": func tion( matc h ) { | |||||
| 4665 | var ex cess, | |||||
| 4666 | unquoted = !match[ 5] && matc h[2]; | |||||
| 4667 | ||||||
| 4668 | if ( m atchExpr[" CHILD"].te st( match[ 0] ) ) { | |||||
| 4669 | return n ull; | |||||
| 4670 | } | |||||
| 4671 | ||||||
| 4672 | // Acc ept quoted arguments as-is | |||||
| 4673 | if ( m atch[4] ) { | |||||
| 4674 | match[2] = match[4 ]; | |||||
| 4675 | ||||||
| 4676 | // Str ip excess characters from unqu oted argum ents | |||||
| 4677 | } else if ( unqu oted && rp seudo.test ( unquoted ) && | |||||
| 4678 | // Get e xcess from tokenize (recursive ly) | |||||
| 4679 | (excess = tokenize ( unquoted , true )) && | |||||
| 4680 | // advan ce to the next closi ng parenth esis | |||||
| 4681 | (excess = unquoted .indexOf( ")", unquo ted.length - excess ) - unquot ed.length) ) { | |||||
| 4682 | ||||||
| 4683 | // exces s is a neg ative inde x | |||||
| 4684 | match[0] = match[0 ].slice( 0 , excess ) ; | |||||
| 4685 | match[2] = unquote d.slice( 0 , excess ) ; | |||||
| 4686 | } | |||||
| 4687 | ||||||
| 4688 | // Ret urn only c aptures ne eded by th e pseudo f ilter meth od (type a nd argumen t) | |||||
| 4689 | return match.sli ce( 0, 3 ) ; | |||||
| 4690 | } | |||||
| 4691 | }, | |||||
| 4692 | ||||||
| 4693 | fi lter: { | |||||
| 4694 | ||||||
| 4695 | "TAG ": functio n( nodeNam e ) { | |||||
| 4696 | if ( n odeName == = "*" ) { | |||||
| 4697 | return f unction() { return t rue; }; | |||||
| 4698 | } | |||||
| 4699 | ||||||
| 4700 | nodeNa me = nodeN ame.replac e( runesca pe, funesc ape ).toLo werCase(); | |||||
| 4701 | return function( elem ) { | |||||
| 4702 | return e lem.nodeNa me && elem .nodeName. toLowerCas e() === no deName; | |||||
| 4703 | }; | |||||
| 4704 | }, | |||||
| 4705 | ||||||
| 4706 | "CLA SS": funct ion( class Name ) { | |||||
| 4707 | var pa ttern = cl assCache[ className + " " ]; | |||||
| 4708 | ||||||
| 4709 | return pattern | | | |||||
| 4710 | (pattern = new Reg Exp( "(^|" + whitesp ace + ")" + classNam e + "(" + whitespace + "|$)" ) ) && | |||||
| 4711 | classCac he( classN ame, funct ion( elem ) { | |||||
| 4712 | return pat tern.test( elem.clas sName || ( typeof ele m.getAttri bute !== s trundefine d && elem. getAttribu te("class" )) || "" ) ; | |||||
| 4713 | }); | |||||
| 4714 | }, | |||||
| 4715 | ||||||
| 4716 | "ATT R": functi on( name, operator, check ) { | |||||
| 4717 | return function( elem ) { | |||||
| 4718 | var resu lt = Sizzl e.attr( el em, name ) ; | |||||
| 4719 | ||||||
| 4720 | if ( res ult == nul l ) { | |||||
| 4721 | return ope rator === "!="; | |||||
| 4722 | } | |||||
| 4723 | if ( !op erator ) { | |||||
| 4724 | return tru e; | |||||
| 4725 | } | |||||
| 4726 | ||||||
| 4727 | result + = ""; | |||||
| 4728 | ||||||
| 4729 | return o perator == = "=" ? re sult === c heck : | |||||
| 4730 | operator = == "!=" ? result !== check : | |||||
| 4731 | operator = == "^=" ? check && r esult.inde xOf( check ) === 0 : | |||||
| 4732 | operator = == "*=" ? check && r esult.inde xOf( check ) > -1 : | |||||
| 4733 | operator = == "$=" ? check && r esult.slic e( -check. length ) = == check : | |||||
| 4734 | operator = == "~=" ? ( " " + re sult + " " ).indexOf ( check ) > -1 : | |||||
| 4735 | operator = == "|=" ? result === check || result.sli ce( 0, che ck.length + 1 ) === check + "- " : | |||||
| 4736 | false; | |||||
| 4737 | }; | |||||
| 4738 | }, | |||||
| 4739 | ||||||
| 4740 | "CHI LD": funct ion( type, what, arg ument, fir st, last ) { | |||||
| 4741 | var si mple = typ e.slice( 0 , 3 ) !== "nth", | |||||
| 4742 | forward = type.sli ce( -4 ) ! == "last", | |||||
| 4743 | ofType = what === "of-type"; | |||||
| 4744 | ||||||
| 4745 | return first === 1 && last === 0 ? | |||||
| 4746 | ||||||
| 4747 | // Short cut for :n th-*(n) | |||||
| 4748 | function ( elem ) { | |||||
| 4749 | return !!e lem.parent Node; | |||||
| 4750 | } : | |||||
| 4751 | ||||||
| 4752 | function ( elem, co ntext, xml ) { | |||||
| 4753 | var cache, outerCach e, node, d iff, nodeI ndex, star t, | |||||
| 4754 | di r = simple !== forwa rd ? "next Sibling" : "previous Sibling", | |||||
| 4755 | pa rent = ele m.parentNo de, | |||||
| 4756 | na me = ofTyp e && elem. nodeName.t oLowerCase (), | |||||
| 4757 | us eCache = ! xml && !of Type; | |||||
| 4758 | ||||||
| 4759 | if ( paren t ) { | |||||
| 4760 | ||||||
| 4761 | // :(first|l ast|only)- (child|of- type) | |||||
| 4762 | if ( simple ) { | |||||
| 4763 | whil e ( dir ) { | |||||
| 4764 | node = elem; | |||||
| 4765 | while ( (node = node[ dir ]) ) { | |||||
| 4766 | if ( ofT ype ? node .nodeName. toLowerCas e() === na me : node. nodeType = == 1 ) { | |||||
| 4767 | return fal se; | |||||
| 4768 | } | |||||
| 4769 | } | |||||
| 4770 | // Rev erse direc tion for : only-* (if we haven' t yet done so) | |||||
| 4771 | start = dir = ty pe === "on ly" && !st art && "ne xtSibling" ; | |||||
| 4772 | } | |||||
| 4773 | retu rn true; | |||||
| 4774 | } | |||||
| 4775 | ||||||
| 4776 | st art = [ fo rward ? pa rent.first Child : pa rent.lastC hild ]; | |||||
| 4777 | ||||||
| 4778 | // non-xml : nth-child( ...) store s cache da ta on `par ent` | |||||
| 4779 | if ( forward && useCac he ) { | |||||
| 4780 | // S eek `elem` from a pr eviously-c ached inde x | |||||
| 4781 | oute rCache = p arent[ exp ando ] || (parent[ e xpando ] = {}); | |||||
| 4782 | cach e = outerC ache[ type ] || []; | |||||
| 4783 | node Index = ca che[0] === dirruns & & cache[1] ; | |||||
| 4784 | diff = cache[0 ] === dirr uns && cac he[2]; | |||||
| 4785 | node = nodeInd ex && pare nt.childNo des[ nodeI ndex ]; | |||||
| 4786 | ||||||
| 4787 | whil e ( (node = ++nodeIn dex && nod e && node[ dir ] || | |||||
| 4788 | ||||||
| 4789 | // Fal lback to s eeking `el em` from t he start | |||||
| 4790 | (diff = nodeInde x = 0) || start.pop( )) ) { | |||||
| 4791 | ||||||
| 4792 | // Whe n found, c ache index es on `par ent` and b reak | |||||
| 4793 | if ( n ode.nodeTy pe === 1 & & ++diff & & node === elem ) { | |||||
| 4794 | outerCac he[ type ] = [ dirru ns, nodeIn dex, diff ]; | |||||
| 4795 | break; | |||||
| 4796 | } | |||||
| 4797 | } | |||||
| 4798 | ||||||
| 4799 | // Use previ ously-cach ed element index if available | |||||
| 4800 | } else if ( useCache & & (cache = (elem[ ex pando ] || (elem[ ex pando ] = {}))[ type ]) && cac he[0] === dirruns ) { | |||||
| 4801 | diff = cache[1 ]; | |||||
| 4802 | ||||||
| 4803 | // xml :nth- child(...) or :nth-l ast-child( ...) or :n th(-last)? -of-type(. ..) | |||||
| 4804 | } else { | |||||
| 4805 | // U se the sam e loop as above to s eek `elem` from the start | |||||
| 4806 | whil e ( (node = ++nodeIn dex && nod e && node[ dir ] || | |||||
| 4807 | (diff = nodeInde x = 0) || start.pop( )) ) { | |||||
| 4808 | ||||||
| 4809 | if ( ( ofType ? node.nodeN ame.toLowe rCase() == = name : n ode.nodeTy pe === 1 ) && ++diff ) { | |||||
| 4810 | // Cache the index of each e ncountered element | |||||
| 4811 | if ( use Cache ) { | |||||
| 4812 | (node[ exp ando ] || (node[ exp ando ] = { }))[ type ] = [ dirr uns, diff ]; | |||||
| 4813 | } | |||||
| 4814 | ||||||
| 4815 | if ( nod e === elem ) { | |||||
| 4816 | break; | |||||
| 4817 | } | |||||
| 4818 | } | |||||
| 4819 | } | |||||
| 4820 | } | |||||
| 4821 | ||||||
| 4822 | // Incorpora te the off set, then check agai nst cycle size | |||||
| 4823 | di ff -= last ; | |||||
| 4824 | re turn diff === first || ( diff % first == = 0 && dif f / first >= 0 ); | |||||
| 4825 | } | |||||
| 4826 | }; | |||||
| 4827 | }, | |||||
| 4828 | ||||||
| 4829 | "PSE UDO": func tion( pseu do, argume nt ) { | |||||
| 4830 | // pse udo-class names are case-insen sitive | |||||
| 4831 | // htt p://www.w3 .org/TR/se lectors/#p seudo-clas ses | |||||
| 4832 | // Pri oritize by case sens itivity in case cust om pseudos are added with uppe rcase lett ers | |||||
| 4833 | // Rem ember that setFilter s inherits from pseu dos | |||||
| 4834 | var ar gs, | |||||
| 4835 | fn = Exp r.pseudos[ pseudo ] || Expr.se tFilters[ pseudo.toL owerCase() ] || | |||||
| 4836 | Sizzle.err or( "unsup ported pse udo: " + p seudo ); | |||||
| 4837 | ||||||
| 4838 | // The user may use create Pseudo to indicate t hat | |||||
| 4839 | // arg uments are needed to create th e filter f unction | |||||
| 4840 | // jus t as Sizzl e does | |||||
| 4841 | if ( f n[ expando ] ) { | |||||
| 4842 | return f n( argumen t ); | |||||
| 4843 | } | |||||
| 4844 | ||||||
| 4845 | // But maintain support fo r old sign atures | |||||
| 4846 | if ( f n.length > 1 ) { | |||||
| 4847 | args = [ pseudo, p seudo, "", argument ]; | |||||
| 4848 | return E xpr.setFil ters.hasOw nProperty( pseudo.to LowerCase( ) ) ? | |||||
| 4849 | markFuncti on(functio n( seed, m atches ) { | |||||
| 4850 | va r idx, | |||||
| 4851 | matc hed = fn( seed, argu ment ), | |||||
| 4852 | i = matched.le ngth; | |||||
| 4853 | wh ile ( i-- ) { | |||||
| 4854 | idx = indexOf. call( seed , matched[ i] ); | |||||
| 4855 | seed [ idx ] = !( matches [ idx ] = matched[i] ); | |||||
| 4856 | } | |||||
| 4857 | }) : | |||||
| 4858 | function( elem ) { | |||||
| 4859 | re turn fn( e lem, 0, ar gs ); | |||||
| 4860 | }; | |||||
| 4861 | } | |||||
| 4862 | ||||||
| 4863 | return fn; | |||||
| 4864 | } | |||||
| 4865 | }, | |||||
| 4866 | ||||||
| 4867 | ps eudos: { | |||||
| 4868 | // P otentially complex p seudos | |||||
| 4869 | "not ": markFun ction(func tion( sele ctor ) { | |||||
| 4870 | // Tri m the sele ctor passe d to compi le | |||||
| 4871 | // to avoid trea ting leadi ng and tra iling | |||||
| 4872 | // spa ces as com binators | |||||
| 4873 | var in put = [], | |||||
| 4874 | results = [], | |||||
| 4875 | matcher = compile( selector. replace( r trim, "$1" ) ); | |||||
| 4876 | ||||||
| 4877 | return matcher[ expando ] ? | |||||
| 4878 | markFunc tion(funct ion( seed, matches, context, x ml ) { | |||||
| 4879 | var elem, | |||||
| 4880 | un matched = matcher( s eed, null, xml, [] ) , | |||||
| 4881 | i = seed.len gth; | |||||
| 4882 | ||||||
| 4883 | // Match e lements un matched by `matcher` | |||||
| 4884 | while ( i- - ) { | |||||
| 4885 | if ( (elem = unmatched [i]) ) { | |||||
| 4886 | seed [i] = !(ma tches[i] = elem); | |||||
| 4887 | } | |||||
| 4888 | } | |||||
| 4889 | }) : | |||||
| 4890 | function ( elem, co ntext, xml ) { | |||||
| 4891 | input[0] = elem; | |||||
| 4892 | matcher( i nput, null , xml, res ults ); | |||||
| 4893 | return !re sults.pop( ); | |||||
| 4894 | }; | |||||
| 4895 | }), | |||||
| 4896 | ||||||
| 4897 | "has ": markFun ction(func tion( sele ctor ) { | |||||
| 4898 | return function( elem ) { | |||||
| 4899 | return S izzle( sel ector, ele m ).length > 0; | |||||
| 4900 | }; | |||||
| 4901 | }), | |||||
| 4902 | ||||||
| 4903 | "con tains": ma rkFunction (function( text ) { | |||||
| 4904 | return function( elem ) { | |||||
| 4905 | return ( elem.text Content || elem.inne rText || g etText( el em ) ).ind exOf( text ) > -1; | |||||
| 4906 | }; | |||||
| 4907 | }), | |||||
| 4908 | ||||||
| 4909 | // " Whether an element i s represen ted by a : lang() sel ector | |||||
| 4910 | // i s based so lely on th e element' s language value | |||||
| 4911 | // b eing equal to the id entifier C , | |||||
| 4912 | // o r beginnin g with the identifie r C immedi ately foll owed by "- ". | |||||
| 4913 | // T he matchin g of C aga inst the e lement's l anguage va lue is per formed cas e-insensit ively. | |||||
| 4914 | // T he identif ier C does not have to be a va lid langua ge name." | |||||
| 4915 | // h ttp://www. w3.org/TR/ selectors/ #lang-pseu do | |||||
| 4916 | "lan g": markFu nction( fu nction( la ng ) { | |||||
| 4917 | // lan g value mu st be a va lid identi fider | |||||
| 4918 | if ( ! ridentifie r.test(lan g || "") ) { | |||||
| 4919 | Sizzle.e rror( "uns upported l ang: " + l ang ); | |||||
| 4920 | } | |||||
| 4921 | lang = lang.repl ace( runes cape, fune scape ).to LowerCase( ); | |||||
| 4922 | return function( elem ) { | |||||
| 4923 | var elem Lang; | |||||
| 4924 | do { | |||||
| 4925 | if ( (elem Lang = doc umentIsXML ? | |||||
| 4926 | el em.getAttr ibute("xml :lang") || elem.getA ttribute(" lang") : | |||||
| 4927 | el em.lang) ) { | |||||
| 4928 | ||||||
| 4929 | el emLang = e lemLang.to LowerCase( ); | |||||
| 4930 | re turn elemL ang === la ng || elem Lang.index Of( lang + "-" ) === 0; | |||||
| 4931 | } | |||||
| 4932 | } while ( (elem = elem.paren tNode) && elem.nodeT ype === 1 ); | |||||
| 4933 | return f alse; | |||||
| 4934 | }; | |||||
| 4935 | }), | |||||
| 4936 | ||||||
| 4937 | // M iscellaneo us | |||||
| 4938 | "tar get": func tion( elem ) { | |||||
| 4939 | var ha sh = windo w.location && window .location. hash; | |||||
| 4940 | return hash && h ash.slice( 1 ) === e lem.id; | |||||
| 4941 | }, | |||||
| 4942 | ||||||
| 4943 | "roo t": functi on( elem ) { | |||||
| 4944 | return elem === docElem; | |||||
| 4945 | }, | |||||
| 4946 | ||||||
| 4947 | "foc us": funct ion( elem ) { | |||||
| 4948 | return elem === document.a ctiveEleme nt && (!do cument.has Focus || d ocument.ha sFocus()) && !!(elem .type || e lem.href | | ~elem.ta bIndex); | |||||
| 4949 | }, | |||||
| 4950 | ||||||
| 4951 | // B oolean pro perties | |||||
| 4952 | "ena bled": fun ction( ele m ) { | |||||
| 4953 | return elem.disa bled === f alse; | |||||
| 4954 | }, | |||||
| 4955 | ||||||
| 4956 | "dis abled": fu nction( el em ) { | |||||
| 4957 | return elem.disa bled === t rue; | |||||
| 4958 | }, | |||||
| 4959 | ||||||
| 4960 | "che cked": fun ction( ele m ) { | |||||
| 4961 | // In CSS3, :che cked shoul d return b oth checke d and sele cted eleme nts | |||||
| 4962 | // htt p://www.w3 .org/TR/20 11/REC-css 3-selector s-20110929 /#checked | |||||
| 4963 | var no deName = e lem.nodeNa me.toLower Case(); | |||||
| 4964 | return (nodeName === "inpu t" && !!el em.checked ) || (node Name === " option" && !!elem.se lected); | |||||
| 4965 | }, | |||||
| 4966 | ||||||
| 4967 | "sel ected": fu nction( el em ) { | |||||
| 4968 | // Acc essing thi s property makes sel ected-by-d efault | |||||
| 4969 | // opt ions in Sa fari work properly | |||||
| 4970 | if ( e lem.parent Node ) { | |||||
| 4971 | elem.par entNode.se lectedInde x; | |||||
| 4972 | } | |||||
| 4973 | ||||||
| 4974 | return elem.sele cted === t rue; | |||||
| 4975 | }, | |||||
| 4976 | ||||||
| 4977 | // C ontents | |||||
| 4978 | "emp ty": funct ion( elem ) { | |||||
| 4979 | // htt p://www.w3 .org/TR/se lectors/#e mpty-pseud o | |||||
| 4980 | // :em pty is onl y affected by elemen t nodes an d content nodes(incl uding text (3), cdata (4)), | |||||
| 4981 | // n ot comment , processi ng instruc tions, or others | |||||
| 4982 | // Tha nks to Die go Perini for the no deName sho rtcut | |||||
| 4983 | // G reater tha n "@" mean s alpha ch aracters ( specifical ly not sta rting with "#" or "? ") | |||||
| 4984 | for ( elem = ele m.firstChi ld; elem; elem = ele m.nextSibl ing ) { | |||||
| 4985 | if ( ele m.nodeName > "@" || elem.nodeT ype === 3 || elem.no deType === 4 ) { | |||||
| 4986 | return fal se; | |||||
| 4987 | } | |||||
| 4988 | } | |||||
| 4989 | return true; | |||||
| 4990 | }, | |||||
| 4991 | ||||||
| 4992 | "par ent": func tion( elem ) { | |||||
| 4993 | return !Expr.pse udos["empt y"]( elem ); | |||||
| 4994 | }, | |||||
| 4995 | ||||||
| 4996 | // E lement/inp ut types | |||||
| 4997 | "hea der": func tion( elem ) { | |||||
| 4998 | return rheader.t est( elem. nodeName ) ; | |||||
| 4999 | }, | |||||
| 5000 | ||||||
| 5001 | "inp ut": funct ion( elem ) { | |||||
| 5002 | return rinputs.t est( elem. nodeName ) ; | |||||
| 5003 | }, | |||||
| 5004 | ||||||
| 5005 | "but ton": func tion( elem ) { | |||||
| 5006 | var na me = elem. nodeName.t oLowerCase (); | |||||
| 5007 | return name === "input" && elem.type === "butt on" || nam e === "but ton"; | |||||
| 5008 | }, | |||||
| 5009 | ||||||
| 5010 | "tex t": functi on( elem ) { | |||||
| 5011 | var at tr; | |||||
| 5012 | // IE6 and 7 wil l map elem .type to ' text' for new HTML5 types (sea rch, etc) | |||||
| 5013 | // use getAttrib ute instea d to test this case | |||||
| 5014 | return elem.node Name.toLow erCase() = == "input" && | |||||
| 5015 | elem.typ e === "tex t" && | |||||
| 5016 | ( (attr = elem.get Attribute( "type")) = = null || attr.toLow erCase() = == elem.ty pe ); | |||||
| 5017 | }, | |||||
| 5018 | ||||||
| 5019 | // P osition-in -collectio n | |||||
| 5020 | "fir st": creat ePositiona lPseudo(fu nction() { | |||||
| 5021 | return [ 0 ]; | |||||
| 5022 | }), | |||||
| 5023 | ||||||
| 5024 | "las t": create Positional Pseudo(fun ction( mat chIndexes, length ) { | |||||
| 5025 | return [ length - 1 ]; | |||||
| 5026 | }), | |||||
| 5027 | ||||||
| 5028 | "eq" : createPo sitionalPs eudo(funct ion( match Indexes, l ength, arg ument ) { | |||||
| 5029 | return [ argumen t < 0 ? ar gument + l ength : ar gument ]; | |||||
| 5030 | }), | |||||
| 5031 | ||||||
| 5032 | "eve n": create Positional Pseudo(fun ction( mat chIndexes, length ) { | |||||
| 5033 | var i = 0; | |||||
| 5034 | for ( ; i < leng th; i += 2 ) { | |||||
| 5035 | matchInd exes.push( i ); | |||||
| 5036 | } | |||||
| 5037 | return matchInde xes; | |||||
| 5038 | }), | |||||
| 5039 | ||||||
| 5040 | "odd ": createP ositionalP seudo(func tion( matc hIndexes, length ) { | |||||
| 5041 | var i = 1; | |||||
| 5042 | for ( ; i < leng th; i += 2 ) { | |||||
| 5043 | matchInd exes.push( i ); | |||||
| 5044 | } | |||||
| 5045 | return matchInde xes; | |||||
| 5046 | }), | |||||
| 5047 | ||||||
| 5048 | "lt" : createPo sitionalPs eudo(funct ion( match Indexes, l ength, arg ument ) { | |||||
| 5049 | var i = argument < 0 ? arg ument + le ngth : arg ument; | |||||
| 5050 | for ( ; --i >= 0 ; ) { | |||||
| 5051 | matchInd exes.push( i ); | |||||
| 5052 | } | |||||
| 5053 | return matchInde xes; | |||||
| 5054 | }), | |||||
| 5055 | ||||||
| 5056 | "gt" : createPo sitionalPs eudo(funct ion( match Indexes, l ength, arg ument ) { | |||||
| 5057 | var i = argument < 0 ? arg ument + le ngth : arg ument; | |||||
| 5058 | for ( ; ++i < le ngth; ) { | |||||
| 5059 | matchInd exes.push( i ); | |||||
| 5060 | } | |||||
| 5061 | return matchInde xes; | |||||
| 5062 | }) | |||||
| 5063 | } | |||||
| 5064 | }; | |||||
| 5065 | ||||||
| 5066 | // Add but ton/input type pseud os | |||||
| 5067 | for ( i in { radio: true, chec kbox: true , file: tr ue, passwo rd: true, image: tru e } ) { | |||||
| 5068 | Ex pr.pseudos [ i ] = cr eateInputP seudo( i ) ; | |||||
| 5069 | } | |||||
| 5070 | for ( i in { submit: true, res et: true } ) { | |||||
| 5071 | Ex pr.pseudos [ i ] = cr eateButton Pseudo( i ); | |||||
| 5072 | } | |||||
| 5073 | ||||||
| 5074 | function t okenize( s elector, p arseOnly ) { | |||||
| 5075 | va r matched, match, to kens, type , | |||||
| 5076 | soFa r, groups, preFilter s, | |||||
| 5077 | cach ed = token Cache[ sel ector + " " ]; | |||||
| 5078 | ||||||
| 5079 | if ( cached ) { | |||||
| 5080 | retu rn parseOn ly ? 0 : c ached.slic e( 0 ); | |||||
| 5081 | } | |||||
| 5082 | ||||||
| 5083 | so Far = sele ctor; | |||||
| 5084 | gr oups = []; | |||||
| 5085 | pr eFilters = Expr.preF ilter; | |||||
| 5086 | ||||||
| 5087 | wh ile ( soFa r ) { | |||||
| 5088 | ||||||
| 5089 | // C omma and f irst run | |||||
| 5090 | if ( !matched || (match = rcomma.e xec( soFar )) ) { | |||||
| 5091 | if ( m atch ) { | |||||
| 5092 | // Don't consume t railing co mmas as va lid | |||||
| 5093 | soFar = soFar.slic e( match[0 ].length ) || soFar; | |||||
| 5094 | } | |||||
| 5095 | groups .push( tok ens = [] ) ; | |||||
| 5096 | } | |||||
| 5097 | ||||||
| 5098 | matc hed = fals e; | |||||
| 5099 | ||||||
| 5100 | // C ombinators | |||||
| 5101 | if ( (match = rcombinato rs.exec( s oFar )) ) { | |||||
| 5102 | matche d = match. shift(); | |||||
| 5103 | tokens .push( { | |||||
| 5104 | value: m atched, | |||||
| 5105 | // Cast descendant combinato rs to spac e | |||||
| 5106 | type: ma tch[0].rep lace( rtri m, " " ) | |||||
| 5107 | } ); | |||||
| 5108 | soFar = soFar.sl ice( match ed.length ); | |||||
| 5109 | } | |||||
| 5110 | ||||||
| 5111 | // F ilters | |||||
| 5112 | for ( type in Expr.filte r ) { | |||||
| 5113 | if ( ( match = ma tchExpr[ t ype ].exec ( soFar )) && (!preF ilters[ ty pe ] || | |||||
| 5114 | (match = preFilter s[ type ]( match ))) ) { | |||||
| 5115 | matched = match.sh ift(); | |||||
| 5116 | tokens.p ush( { | |||||
| 5117 | value: mat ched, | |||||
| 5118 | type: type , | |||||
| 5119 | matches: m atch | |||||
| 5120 | } ); | |||||
| 5121 | soFar = soFar.slic e( matched .length ); | |||||
| 5122 | } | |||||
| 5123 | } | |||||
| 5124 | ||||||
| 5125 | if ( !matched ) { | |||||
| 5126 | break; | |||||
| 5127 | } | |||||
| 5128 | } | |||||
| 5129 | ||||||
| 5130 | // Return th e length o f the inva lid excess | |||||
| 5131 | // if we're just parsi ng | |||||
| 5132 | // Otherwise , throw an error or return tok ens | |||||
| 5133 | re turn parse Only ? | |||||
| 5134 | soFa r.length : | |||||
| 5135 | soFa r ? | |||||
| 5136 | Sizzle .error( se lector ) : | |||||
| 5137 | // Cac he the tok ens | |||||
| 5138 | tokenC ache( sele ctor, grou ps ).slice ( 0 ); | |||||
| 5139 | } | |||||
| 5140 | ||||||
| 5141 | function t oSelector( tokens ) { | |||||
| 5142 | va r i = 0, | |||||
| 5143 | len = tokens.l ength, | |||||
| 5144 | sele ctor = ""; | |||||
| 5145 | fo r ( ; i < len; i++ ) { | |||||
| 5146 | sele ctor += to kens[i].va lue; | |||||
| 5147 | } | |||||
| 5148 | re turn selec tor; | |||||
| 5149 | } | |||||
| 5150 | ||||||
| 5151 | function a ddCombinat or( matche r, combina tor, base ) { | |||||
| 5152 | va r dir = co mbinator.d ir, | |||||
| 5153 | chec kNonElemen ts = base && dir === "parentNo de", | |||||
| 5154 | done Name = don e++; | |||||
| 5155 | ||||||
| 5156 | re turn combi nator.firs t ? | |||||
| 5157 | // C heck again st closest ancestor/ preceding element | |||||
| 5158 | func tion( elem , context, xml ) { | |||||
| 5159 | while ( (elem = elem[ dir ]) ) { | |||||
| 5160 | if ( ele m.nodeType === 1 || checkNonEl ements ) { | |||||
| 5161 | return mat cher( elem , context, xml ); | |||||
| 5162 | } | |||||
| 5163 | } | |||||
| 5164 | } : | |||||
| 5165 | ||||||
| 5166 | // C heck again st all anc estor/prec eding elem ents | |||||
| 5167 | func tion( elem , context, xml ) { | |||||
| 5168 | var da ta, cache, outerCach e, | |||||
| 5169 | dirkey = dirruns + " " + don eName; | |||||
| 5170 | ||||||
| 5171 | // We can't set arbitrary data on XM L nodes, s o they don 't benefit from dir caching | |||||
| 5172 | if ( x ml ) { | |||||
| 5173 | while ( (elem = el em[ dir ]) ) { | |||||
| 5174 | if ( elem. nodeType = == 1 || ch eckNonElem ents ) { | |||||
| 5175 | if ( matcher ( elem, co ntext, xml ) ) { | |||||
| 5176 | retu rn true; | |||||
| 5177 | } | |||||
| 5178 | } | |||||
| 5179 | } | |||||
| 5180 | } else { | |||||
| 5181 | while ( (elem = el em[ dir ]) ) { | |||||
| 5182 | if ( elem. nodeType = == 1 || ch eckNonElem ents ) { | |||||
| 5183 | ou terCache = elem[ exp ando ] || (elem[ exp ando ] = { }); | |||||
| 5184 | if ( (cache = outerCac he[ dir ]) && cache[ 0] === dir key ) { | |||||
| 5185 | if ( (data = c ache[1]) = == true || data === cachedruns ) { | |||||
| 5186 | return data === true; | |||||
| 5187 | } | |||||
| 5188 | } else { | |||||
| 5189 | cach e = outerC ache[ dir ] = [ dirk ey ]; | |||||
| 5190 | cach e[1] = mat cher( elem , context, xml ) || cachedruns ; | |||||
| 5191 | if ( cache[1] === true ) { | |||||
| 5192 | return true; | |||||
| 5193 | } | |||||
| 5194 | } | |||||
| 5195 | } | |||||
| 5196 | } | |||||
| 5197 | } | |||||
| 5198 | }; | |||||
| 5199 | } | |||||
| 5200 | ||||||
| 5201 | function e lementMatc her( match ers ) { | |||||
| 5202 | re turn match ers.length > 1 ? | |||||
| 5203 | func tion( elem , context, xml ) { | |||||
| 5204 | var i = matchers .length; | |||||
| 5205 | while ( i-- ) { | |||||
| 5206 | if ( !ma tchers[i]( elem, con text, xml ) ) { | |||||
| 5207 | return fal se; | |||||
| 5208 | } | |||||
| 5209 | } | |||||
| 5210 | return true; | |||||
| 5211 | } : | |||||
| 5212 | matc hers[0]; | |||||
| 5213 | } | |||||
| 5214 | ||||||
| 5215 | function c ondense( u nmatched, map, filte r, context , xml ) { | |||||
| 5216 | va r elem, | |||||
| 5217 | newU nmatched = [], | |||||
| 5218 | i = 0, | |||||
| 5219 | len = unmatche d.length, | |||||
| 5220 | mapp ed = map ! = null; | |||||
| 5221 | ||||||
| 5222 | fo r ( ; i < len; i++ ) { | |||||
| 5223 | if ( (elem = u nmatched[i ]) ) { | |||||
| 5224 | if ( ! filter || filter( el em, contex t, xml ) ) { | |||||
| 5225 | newUnmat ched.push( elem ); | |||||
| 5226 | if ( map ped ) { | |||||
| 5227 | map.push( i ); | |||||
| 5228 | } | |||||
| 5229 | } | |||||
| 5230 | } | |||||
| 5231 | } | |||||
| 5232 | ||||||
| 5233 | re turn newUn matched; | |||||
| 5234 | } | |||||
| 5235 | ||||||
| 5236 | function s etMatcher( preFilter , selector , matcher, postFilte r, postFin der, postS elector ) { | |||||
| 5237 | if ( postFil ter && !po stFilter[ expando ] ) { | |||||
| 5238 | post Filter = s etMatcher( postFilte r ); | |||||
| 5239 | } | |||||
| 5240 | if ( postFin der && !po stFinder[ expando ] ) { | |||||
| 5241 | post Finder = s etMatcher( postFinde r, postSel ector ); | |||||
| 5242 | } | |||||
| 5243 | re turn markF unction(fu nction( se ed, result s, context , xml ) { | |||||
| 5244 | var temp, i, e lem, | |||||
| 5245 | preMap = [], | |||||
| 5246 | postMa p = [], | |||||
| 5247 | preexi sting = re sults.leng th, | |||||
| 5248 | ||||||
| 5249 | // Get initial e lements fr om seed or context | |||||
| 5250 | elems = seed || multipleCo ntexts( se lector || "*", conte xt.nodeTyp e ? [ cont ext ] : co ntext, [] ), | |||||
| 5251 | ||||||
| 5252 | // Pre filter to get matche r input, p reserving a map for seed-resul ts synchro nization | |||||
| 5253 | matche rIn = preF ilter && ( seed || ! selector ) ? | |||||
| 5254 | condense ( elems, p reMap, pre Filter, co ntext, xml ) : | |||||
| 5255 | elems, | |||||
| 5256 | ||||||
| 5257 | matche rOut = mat cher ? | |||||
| 5258 | // If we have a po stFinder, or filtere d seed, or non-seed postFilter or preexi sting resu lts, | |||||
| 5259 | postFind er || ( se ed ? preFi lter : pre existing | | postFilt er ) ? | |||||
| 5260 | ||||||
| 5261 | // ...inte rmediate p rocessing is necessa ry | |||||
| 5262 | [] : | |||||
| 5263 | ||||||
| 5264 | // ...othe rwise use results di rectly | |||||
| 5265 | results : | |||||
| 5266 | matcherI n; | |||||
| 5267 | ||||||
| 5268 | // F ind primar y matches | |||||
| 5269 | if ( matcher ) { | |||||
| 5270 | matche r( matcher In, matche rOut, cont ext, xml ) ; | |||||
| 5271 | } | |||||
| 5272 | ||||||
| 5273 | // A pply postF ilter | |||||
| 5274 | if ( postFilte r ) { | |||||
| 5275 | temp = condense( matcherOu t, postMap ); | |||||
| 5276 | postFi lter( temp , [], cont ext, xml ) ; | |||||
| 5277 | ||||||
| 5278 | // Un- match fail ing elemen ts by movi ng them ba ck to matc herIn | |||||
| 5279 | i = te mp.length; | |||||
| 5280 | while ( i-- ) { | |||||
| 5281 | if ( (el em = temp[ i]) ) { | |||||
| 5282 | matcherOut [ postMap[ i] ] = !(m atcherIn[ postMap[i] ] = elem) ; | |||||
| 5283 | } | |||||
| 5284 | } | |||||
| 5285 | } | |||||
| 5286 | ||||||
| 5287 | if ( seed ) { | |||||
| 5288 | if ( p ostFinder || preFilt er ) { | |||||
| 5289 | if ( pos tFinder ) { | |||||
| 5290 | // Get the final mat cherOut by condensin g this int ermediate into postF inder cont exts | |||||
| 5291 | temp = []; | |||||
| 5292 | i = matche rOut.lengt h; | |||||
| 5293 | while ( i- - ) { | |||||
| 5294 | if ( (elem = matcherOu t[i]) ) { | |||||
| 5295 | // R estore mat cherIn sin ce elem is not yet a final mat ch | |||||
| 5296 | temp .push( (ma tcherIn[i] = elem) ) ; | |||||
| 5297 | } | |||||
| 5298 | } | |||||
| 5299 | postFinder ( null, (m atcherOut = []), tem p, xml ); | |||||
| 5300 | } | |||||
| 5301 | ||||||
| 5302 | // Move matched el ements fro m seed to results to keep them synchroni zed | |||||
| 5303 | i = matc herOut.len gth; | |||||
| 5304 | while ( i-- ) { | |||||
| 5305 | if ( (elem = matcher Out[i]) && | |||||
| 5306 | (t emp = post Finder ? i ndexOf.cal l( seed, e lem ) : pr eMap[i]) > -1 ) { | |||||
| 5307 | ||||||
| 5308 | se ed[temp] = !(results [temp] = e lem); | |||||
| 5309 | } | |||||
| 5310 | } | |||||
| 5311 | } | |||||
| 5312 | ||||||
| 5313 | // A dd element s to resul ts, throug h postFind er if defi ned | |||||
| 5314 | } el se { | |||||
| 5315 | matche rOut = con dense( | |||||
| 5316 | matcherO ut === res ults ? | |||||
| 5317 | matcherOut .splice( p reexisting , matcherO ut.length ) : | |||||
| 5318 | matcherOut | |||||
| 5319 | ); | |||||
| 5320 | if ( p ostFinder ) { | |||||
| 5321 | postFind er( null, results, m atcherOut, xml ); | |||||
| 5322 | } else { | |||||
| 5323 | push.app ly( result s, matcher Out ); | |||||
| 5324 | } | |||||
| 5325 | } | |||||
| 5326 | }) ; | |||||
| 5327 | } | |||||
| 5328 | ||||||
| 5329 | function m atcherFrom Tokens( to kens ) { | |||||
| 5330 | va r checkCon text, matc her, j, | |||||
| 5331 | len = tokens.l ength, | |||||
| 5332 | lead ingRelativ e = Expr.r elative[ t okens[0].t ype ], | |||||
| 5333 | impl icitRelati ve = leadi ngRelative || Expr.r elative[" "], | |||||
| 5334 | i = leadingRel ative ? 1 : 0, | |||||
| 5335 | ||||||
| 5336 | // T he foundat ional matc her ensure s that ele ments are reachable from top-l evel conte xt(s) | |||||
| 5337 | matc hContext = addCombin ator( func tion( elem ) { | |||||
| 5338 | return elem === checkConte xt; | |||||
| 5339 | }, i mplicitRel ative, tru e ), | |||||
| 5340 | matc hAnyContex t = addCom binator( f unction( e lem ) { | |||||
| 5341 | return indexOf.c all( check Context, e lem ) > -1 ; | |||||
| 5342 | }, i mplicitRel ative, tru e ), | |||||
| 5343 | matc hers = [ f unction( e lem, conte xt, xml ) { | |||||
| 5344 | return ( !leadin gRelative && ( xml | | context !== outerm ostContext ) ) || ( | |||||
| 5345 | (checkCo ntext = co ntext).nod eType ? | |||||
| 5346 | matchConte xt( elem, context, x ml ) : | |||||
| 5347 | matchAnyCo ntext( ele m, context , xml ) ); | |||||
| 5348 | } ]; | |||||
| 5349 | ||||||
| 5350 | fo r ( ; i < len; i++ ) { | |||||
| 5351 | if ( (matcher = Expr.rel ative[ tok ens[i].typ e ]) ) { | |||||
| 5352 | matche rs = [ add Combinator (elementMa tcher( mat chers ), m atcher) ]; | |||||
| 5353 | } el se { | |||||
| 5354 | matche r = Expr.f ilter[ tok ens[i].typ e ].apply( null, tok ens[i].mat ches ); | |||||
| 5355 | ||||||
| 5356 | // Ret urn specia l upon see ing a posi tional mat cher | |||||
| 5357 | if ( m atcher[ ex pando ] ) { | |||||
| 5358 | // Find the next r elative op erator (if any) for proper han dling | |||||
| 5359 | j = ++i; | |||||
| 5360 | for ( ; j < len; j ++ ) { | |||||
| 5361 | if ( Expr. relative[ tokens[j]. type ] ) { | |||||
| 5362 | br eak; | |||||
| 5363 | } | |||||
| 5364 | } | |||||
| 5365 | return s etMatcher( | |||||
| 5366 | i > 1 && e lementMatc her( match ers ), | |||||
| 5367 | i > 1 && t oSelector( tokens.sl ice( 0, i - 1 ) ).re place( rtr im, "$1" ) , | |||||
| 5368 | matcher, | |||||
| 5369 | i < j && m atcherFrom Tokens( to kens.slice ( i, j ) ) , | |||||
| 5370 | j < len && matcherFr omTokens( (tokens = tokens.sli ce( j )) ) , | |||||
| 5371 | j < len && toSelecto r( tokens ) | |||||
| 5372 | ); | |||||
| 5373 | } | |||||
| 5374 | matche rs.push( m atcher ); | |||||
| 5375 | } | |||||
| 5376 | } | |||||
| 5377 | ||||||
| 5378 | re turn eleme ntMatcher( matchers ); | |||||
| 5379 | } | |||||
| 5380 | ||||||
| 5381 | function m atcherFrom GroupMatch ers( eleme ntMatchers , setMatch ers ) { | |||||
| 5382 | // A counter to specif y which el ement is c urrently b eing match ed | |||||
| 5383 | va r matcherC achedRuns = 0, | |||||
| 5384 | bySe t = setMat chers.leng th > 0, | |||||
| 5385 | byEl ement = el ementMatch ers.length > 0, | |||||
| 5386 | supe rMatcher = function( seed, con text, xml, results, expandCont ext ) { | |||||
| 5387 | var el em, j, mat cher, | |||||
| 5388 | setMatch ed = [], | |||||
| 5389 | matchedC ount = 0, | |||||
| 5390 | i = "0", | |||||
| 5391 | unmatche d = seed & & [], | |||||
| 5392 | outermos t = expand Context != null, | |||||
| 5393 | contextB ackup = ou termostCon text, | |||||
| 5394 | // We mu st always have eithe r seed ele ments or c ontext | |||||
| 5395 | elems = seed || by Element && Expr.find ["TAG"]( " *", expand Context && context.p arentNode || context ), | |||||
| 5396 | // Use i nteger dir runs iff t his is the outermost matcher | |||||
| 5397 | dirrunsU nique = (d irruns += contextBac kup == nul l ? 1 : Ma th.random( ) || 0.1); | |||||
| 5398 | ||||||
| 5399 | if ( o utermost ) { | |||||
| 5400 | outermos tContext = context ! == documen t && conte xt; | |||||
| 5401 | cachedru ns = match erCachedRu ns; | |||||
| 5402 | } | |||||
| 5403 | ||||||
| 5404 | // Add elements passing el ementMatch ers direct ly to resu lts | |||||
| 5405 | // Kee p `i` a st ring if th ere are no elements so `matche dCount` wi ll be "00" below | |||||
| 5406 | for ( ; (elem = elems[i]) != null; i ++ ) { | |||||
| 5407 | if ( byE lement && elem ) { | |||||
| 5408 | j = 0; | |||||
| 5409 | while ( (m atcher = e lementMatc hers[j++]) ) { | |||||
| 5410 | if ( matcher ( elem, co ntext, xml ) ) { | |||||
| 5411 | resu lts.push( elem ); | |||||
| 5412 | brea k; | |||||
| 5413 | } | |||||
| 5414 | } | |||||
| 5415 | if ( outer most ) { | |||||
| 5416 | di rruns = di rrunsUniqu e; | |||||
| 5417 | ca chedruns = ++matcher CachedRuns ; | |||||
| 5418 | } | |||||
| 5419 | } | |||||
| 5420 | ||||||
| 5421 | // Track unmatched elements for set fi lters | |||||
| 5422 | if ( byS et ) { | |||||
| 5423 | // They wi ll have go ne through all possi ble matche rs | |||||
| 5424 | if ( (elem = !matche r && elem) ) { | |||||
| 5425 | ma tchedCount --; | |||||
| 5426 | } | |||||
| 5427 | ||||||
| 5428 | // Lengthe n the arra y for ever y element, matched o r not | |||||
| 5429 | if ( seed ) { | |||||
| 5430 | un matched.pu sh( elem ) ; | |||||
| 5431 | } | |||||
| 5432 | } | |||||
| 5433 | } | |||||
| 5434 | ||||||
| 5435 | // App ly set fil ters to un matched el ements | |||||
| 5436 | matche dCount += i; | |||||
| 5437 | if ( b ySet && i !== matche dCount ) { | |||||
| 5438 | j = 0; | |||||
| 5439 | while ( (matcher = setMatche rs[j++]) ) { | |||||
| 5440 | matcher( u nmatched, setMatched , context, xml ); | |||||
| 5441 | } | |||||
| 5442 | ||||||
| 5443 | if ( see d ) { | |||||
| 5444 | // Reinteg rate eleme nt matches to elimin ate the ne ed for sor ting | |||||
| 5445 | if ( match edCount > 0 ) { | |||||
| 5446 | wh ile ( i-- ) { | |||||
| 5447 | if ( !(unmatch ed[i] || s etMatched[ i]) ) { | |||||
| 5448 | setMat ched[i] = pop.call( results ); | |||||
| 5449 | } | |||||
| 5450 | } | |||||
| 5451 | } | |||||
| 5452 | ||||||
| 5453 | // Discard index pla ceholder v alues to g et only ac tual match es | |||||
| 5454 | setMatched = condens e( setMatc hed ); | |||||
| 5455 | } | |||||
| 5456 | ||||||
| 5457 | // Add m atches to results | |||||
| 5458 | push.app ly( result s, setMatc hed ); | |||||
| 5459 | ||||||
| 5460 | // Seedl ess set ma tches succ eeding mul tiple succ essful mat chers stip ulate sort ing | |||||
| 5461 | if ( out ermost && !seed && s etMatched. length > 0 && | |||||
| 5462 | ( matchedC ount + set Matchers.l ength ) > 1 ) { | |||||
| 5463 | ||||||
| 5464 | Sizzle.uni queSort( r esults ); | |||||
| 5465 | } | |||||
| 5466 | } | |||||
| 5467 | ||||||
| 5468 | // Ove rride mani pulation o f globals by nested matchers | |||||
| 5469 | if ( o utermost ) { | |||||
| 5470 | dirruns = dirrunsU nique; | |||||
| 5471 | outermos tContext = contextBa ckup; | |||||
| 5472 | } | |||||
| 5473 | ||||||
| 5474 | return unmatched ; | |||||
| 5475 | }; | |||||
| 5476 | ||||||
| 5477 | re turn bySet ? | |||||
| 5478 | mark Function( superMatch er ) : | |||||
| 5479 | supe rMatcher; | |||||
| 5480 | } | |||||
| 5481 | ||||||
| 5482 | compile = Sizzle.com pile = fun ction( sel ector, gro up /* Inte rnal Use O nly */ ) { | |||||
| 5483 | va r i, | |||||
| 5484 | setM atchers = [], | |||||
| 5485 | elem entMatcher s = [], | |||||
| 5486 | cach ed = compi lerCache[ selector + " " ]; | |||||
| 5487 | ||||||
| 5488 | if ( !cached ) { | |||||
| 5489 | // G enerate a function o f recursiv e function s that can be used t o check ea ch element | |||||
| 5490 | if ( !group ) { | |||||
| 5491 | group = tokenize ( selector ); | |||||
| 5492 | } | |||||
| 5493 | i = group.leng th; | |||||
| 5494 | whil e ( i-- ) { | |||||
| 5495 | cached = matcher FromTokens ( group[i] ); | |||||
| 5496 | if ( c ached[ exp ando ] ) { | |||||
| 5497 | setMatch ers.push( cached ); | |||||
| 5498 | } else { | |||||
| 5499 | elementM atchers.pu sh( cached ); | |||||
| 5500 | } | |||||
| 5501 | } | |||||
| 5502 | ||||||
| 5503 | // C ache the c ompiled fu nction | |||||
| 5504 | cach ed = compi lerCache( selector, matcherFro mGroupMatc hers( elem entMatcher s, setMatc hers ) ); | |||||
| 5505 | } | |||||
| 5506 | re turn cache d; | |||||
| 5507 | }; | |||||
| 5508 | ||||||
| 5509 | function m ultipleCon texts( sel ector, con texts, res ults ) { | |||||
| 5510 | va r i = 0, | |||||
| 5511 | len = contexts .length; | |||||
| 5512 | fo r ( ; i < len; i++ ) { | |||||
| 5513 | Sizz le( select or, contex ts[i], res ults ); | |||||
| 5514 | } | |||||
| 5515 | re turn resul ts; | |||||
| 5516 | } | |||||
| 5517 | ||||||
| 5518 | function s elect( sel ector, con text, resu lts, seed ) { | |||||
| 5519 | va r i, token s, token, type, find , | |||||
| 5520 | matc h = tokeni ze( select or ); | |||||
| 5521 | ||||||
| 5522 | if ( !seed ) { | |||||
| 5523 | // T ry to mini mize opera tions if t here is on ly one gro up | |||||
| 5524 | if ( match.len gth === 1 ) { | |||||
| 5525 | ||||||
| 5526 | // Tak e a shortc ut and set the conte xt if the root selec tor is an ID | |||||
| 5527 | tokens = match[0 ] = match[ 0].slice( 0 ); | |||||
| 5528 | if ( t okens.leng th > 2 && (token = t okens[0]). type === " ID" && | |||||
| 5529 | context.no deType === 9 && !doc umentIsXML && | |||||
| 5530 | Expr.relat ive[ token s[1].type ] ) { | |||||
| 5531 | ||||||
| 5532 | context = Expr.fin d["ID"]( t oken.match es[0].repl ace( runes cape, fune scape ), c ontext )[0 ]; | |||||
| 5533 | if ( !co ntext ) { | |||||
| 5534 | return res ults; | |||||
| 5535 | } | |||||
| 5536 | ||||||
| 5537 | selector = selecto r.slice( t okens.shif t().value. length ); | |||||
| 5538 | } | |||||
| 5539 | ||||||
| 5540 | // Fet ch a seed set for ri ght-to-lef t matching | |||||
| 5541 | i = ma tchExpr["n eedsContex t"].test( selector ) ? 0 : tok ens.length ; | |||||
| 5542 | while ( i-- ) { | |||||
| 5543 | token = tokens[i]; | |||||
| 5544 | ||||||
| 5545 | // Abort if we hit a combina tor | |||||
| 5546 | if ( Exp r.relative [ (type = token.type ) ] ) { | |||||
| 5547 | break; | |||||
| 5548 | } | |||||
| 5549 | if ( (fi nd = Expr. find[ type ]) ) { | |||||
| 5550 | // Search, expanding context f or leading sibling c ombinators | |||||
| 5551 | if ( (seed = find( | |||||
| 5552 | to ken.matche s[0].repla ce( runesc ape, funes cape ), | |||||
| 5553 | rs ibling.tes t( tokens[ 0].type ) && context .parentNod e || conte xt | |||||
| 5554 | )) ) { | |||||
| 5555 | ||||||
| 5556 | // If seed i s empty or no tokens remain, w e can retu rn early | |||||
| 5557 | to kens.splic e( i, 1 ); | |||||
| 5558 | se lector = s eed.length && toSele ctor( toke ns ); | |||||
| 5559 | if ( !select or ) { | |||||
| 5560 | push .apply( re sults, sli ce.call( s eed, 0 ) ) ; | |||||
| 5561 | retu rn results ; | |||||
| 5562 | } | |||||
| 5563 | ||||||
| 5564 | br eak; | |||||
| 5565 | } | |||||
| 5566 | } | |||||
| 5567 | } | |||||
| 5568 | } | |||||
| 5569 | } | |||||
| 5570 | ||||||
| 5571 | // Compile a nd execute a filteri ng functio n | |||||
| 5572 | // Provide ` match` to avoid reto kenization if we mod ified the selector a bove | |||||
| 5573 | co mpile( sel ector, mat ch )( | |||||
| 5574 | seed , | |||||
| 5575 | cont ext, | |||||
| 5576 | docu mentIsXML, | |||||
| 5577 | resu lts, | |||||
| 5578 | rsib ling.test( selector ) | |||||
| 5579 | ); | |||||
| 5580 | re turn resul ts; | |||||
| 5581 | } | |||||
| 5582 | ||||||
| 5583 | // Depreca ted | |||||
| 5584 | Expr.pseud os["nth"] = Expr.pse udos["eq"] ; | |||||
| 5585 | ||||||
| 5586 | // Easy AP I for crea ting new s etFilters | |||||
| 5587 | function s etFilters( ) {} | |||||
| 5588 | Expr.filte rs = setFi lters.prot otype = Ex pr.pseudos ; | |||||
| 5589 | Expr.setFi lters = ne w setFilte rs(); | |||||
| 5590 | ||||||
| 5591 | // Initial ize with t he default document | |||||
| 5592 | setDocumen t(); | |||||
| 5593 | ||||||
| 5594 | // Overrid e sizzle a ttribute r etrieval | |||||
| 5595 | Sizzle.att r = jQuery .attr; | |||||
| 5596 | jQuery.fin d = Sizzle ; | |||||
| 5597 | jQuery.exp r = Sizzle .selectors ; | |||||
| 5598 | jQuery.exp r[":"] = j Query.expr .pseudos; | |||||
| 5599 | jQuery.uni que = Sizz le.uniqueS ort; | |||||
| 5600 | jQuery.tex t = Sizzle .getText; | |||||
| 5601 | jQuery.isX MLDoc = Si zzle.isXML ; | |||||
| 5602 | jQuery.con tains = Si zzle.conta ins; | |||||
| 5603 | ||||||
| 5604 | ||||||
| 5605 | })( window ); | |||||
| 5606 | var runtil = /Until$ /, | |||||
| 5607 | rp arentsprev = /^(?:pa rents|prev (?:Until|A ll))/, | |||||
| 5608 | is Simple = / ^.[^:#\[\. ,]*$/, | |||||
| 5609 | rn eedsContex t = jQuery .expr.matc h.needsCon text, | |||||
| 5610 | // methods g uaranteed to produce a unique set when s tarting fr om a uniqu e set | |||||
| 5611 | gu aranteedUn ique = { | |||||
| 5612 | chil dren: true , | |||||
| 5613 | cont ents: true , | |||||
| 5614 | next : true, | |||||
| 5615 | prev : true | |||||
| 5616 | }; | |||||
| 5617 | ||||||
| 5618 | jQuery.fn. extend({ | |||||
| 5619 | fi nd: functi on( select or ) { | |||||
| 5620 | var i, ret, se lf, | |||||
| 5621 | len = this.lengt h; | |||||
| 5622 | ||||||
| 5623 | if ( typeof se lector !== "string" ) { | |||||
| 5624 | self = this; | |||||
| 5625 | return this.push Stack( jQu ery( selec tor ).filt er(functio n() { | |||||
| 5626 | for ( i = 0; i < l en; i++ ) { | |||||
| 5627 | if ( jQuer y.contains ( self[ i ], this ) ) { | |||||
| 5628 | re turn true; | |||||
| 5629 | } | |||||
| 5630 | } | |||||
| 5631 | }) ); | |||||
| 5632 | } | |||||
| 5633 | ||||||
| 5634 | ret = []; | |||||
| 5635 | for ( i = 0; i < len; i+ + ) { | |||||
| 5636 | jQuery .find( sel ector, thi s[ i ], re t ); | |||||
| 5637 | } | |||||
| 5638 | ||||||
| 5639 | // N eeded beca use $( sel ector, con text ) bec omes $( co ntext ).fi nd( select or ) | |||||
| 5640 | ret = this.pus hStack( le n > 1 ? jQ uery.uniqu e( ret ) : ret ); | |||||
| 5641 | ret. selector = ( this.se lector ? t his.select or + " " : "" ) + se lector; | |||||
| 5642 | retu rn ret; | |||||
| 5643 | }, | |||||
| 5644 | ||||||
| 5645 | ha s: functio n( target ) { | |||||
| 5646 | var i, | |||||
| 5647 | target s = jQuery ( target, this ), | |||||
| 5648 | len = targets.le ngth; | |||||
| 5649 | ||||||
| 5650 | retu rn this.fi lter(funct ion() { | |||||
| 5651 | for ( i = 0; i < len; i++ ) { | |||||
| 5652 | if ( jQu ery.contai ns( this, targets[i] ) ) { | |||||
| 5653 | return tru e; | |||||
| 5654 | } | |||||
| 5655 | } | |||||
| 5656 | }); | |||||
| 5657 | }, | |||||
| 5658 | ||||||
| 5659 | no t: functio n( selecto r ) { | |||||
| 5660 | retu rn this.pu shStack( w innow(this , selector , false) ) ; | |||||
| 5661 | }, | |||||
| 5662 | ||||||
| 5663 | fi lter: func tion( sele ctor ) { | |||||
| 5664 | retu rn this.pu shStack( w innow(this , selector , true) ); | |||||
| 5665 | }, | |||||
| 5666 | ||||||
| 5667 | is : function ( selector ) { | |||||
| 5668 | retu rn !!selec tor && ( | |||||
| 5669 | typeof selector === "strin g" ? | |||||
| 5670 | // If th is is a po sitional/r elative se lector, ch eck member ship in th e returned set | |||||
| 5671 | // so $( "p:first") .is("p:las t") won't return tru e for a do c with two "p". | |||||
| 5672 | rneedsCo ntext.test ( selector ) ? | |||||
| 5673 | jQuery( se lector, th is.context ).index( this[0] ) >= 0 : | |||||
| 5674 | jQuery.fil ter( selec tor, this ).length > 0 : | |||||
| 5675 | this.fil ter( selec tor ).leng th > 0 ); | |||||
| 5676 | }, | |||||
| 5677 | ||||||
| 5678 | cl osest: fun ction( sel ectors, co ntext ) { | |||||
| 5679 | var cur, | |||||
| 5680 | i = 0, | |||||
| 5681 | l = th is.length, | |||||
| 5682 | ret = [], | |||||
| 5683 | pos = rneedsCont ext.test( selectors ) || typeo f selector s !== "str ing" ? | |||||
| 5684 | jQuery( selectors, context | | this.con text ) : | |||||
| 5685 | 0; | |||||
| 5686 | ||||||
| 5687 | for ( ; i < l; i++ ) { | |||||
| 5688 | cur = this[i]; | |||||
| 5689 | ||||||
| 5690 | while ( cur && c ur.ownerDo cument && cur !== co ntext && c ur.nodeTyp e !== 11 ) { | |||||
| 5691 | if ( pos ? pos.ind ex(cur) > -1 : jQuer y.find.mat chesSelect or(cur, se lectors) ) { | |||||
| 5692 | ret.push( cur ); | |||||
| 5693 | break; | |||||
| 5694 | } | |||||
| 5695 | cur = cu r.parentNo de; | |||||
| 5696 | } | |||||
| 5697 | } | |||||
| 5698 | ||||||
| 5699 | retu rn this.pu shStack( r et.length > 1 ? jQue ry.unique( ret ) : r et ); | |||||
| 5700 | }, | |||||
| 5701 | ||||||
| 5702 | // Determine the posit ion of an element wi thin | |||||
| 5703 | // the match ed set of elements | |||||
| 5704 | in dex: funct ion( elem ) { | |||||
| 5705 | ||||||
| 5706 | // N o argument , return i ndex in pa rent | |||||
| 5707 | if ( !elem ) { | |||||
| 5708 | return ( this[0] && this[0 ].parentNo de ) ? thi s.first(). prevAll(). length : - 1; | |||||
| 5709 | } | |||||
| 5710 | ||||||
| 5711 | // i ndex in se lector | |||||
| 5712 | if ( typeof el em === "st ring" ) { | |||||
| 5713 | return jQuery.in Array( thi s[0], jQue ry( elem ) ); | |||||
| 5714 | } | |||||
| 5715 | ||||||
| 5716 | // L ocate the position o f the desi red elemen t | |||||
| 5717 | retu rn jQuery. inArray( | |||||
| 5718 | // If it receive s a jQuery object, t he first e lement is used | |||||
| 5719 | elem.j query ? el em[0] : el em, this ) ; | |||||
| 5720 | }, | |||||
| 5721 | ||||||
| 5722 | ad d: functio n( selecto r, context ) { | |||||
| 5723 | var set = type of selecto r === "str ing" ? | |||||
| 5724 | jQuery( selector, context ) : | |||||
| 5725 | jQuery.m akeArray( selector & & selector .nodeType ? [ select or ] : sel ector ), | |||||
| 5726 | all = jQuery.mer ge( this.g et(), set ); | |||||
| 5727 | ||||||
| 5728 | retu rn this.pu shStack( j Query.uniq ue(all) ); | |||||
| 5729 | }, | |||||
| 5730 | ||||||
| 5731 | ad dBack: fun ction( sel ector ) { | |||||
| 5732 | retu rn this.ad d( selecto r == null ? | |||||
| 5733 | this.p revObject : this.pre vObject.fi lter(selec tor) | |||||
| 5734 | ); | |||||
| 5735 | } | |||||
| 5736 | }); | |||||
| 5737 | ||||||
| 5738 | jQuery.fn. andSelf = jQuery.fn. addBack; | |||||
| 5739 | ||||||
| 5740 | function s ibling( cu r, dir ) { | |||||
| 5741 | do { | |||||
| 5742 | cur = cur[ dir ]; | |||||
| 5743 | } while ( cu r && cur.n odeType != = 1 ); | |||||
| 5744 | ||||||
| 5745 | re turn cur; | |||||
| 5746 | } | |||||
| 5747 | ||||||
| 5748 | jQuery.eac h({ | |||||
| 5749 | pa rent: func tion( elem ) { | |||||
| 5750 | var parent = e lem.parent Node; | |||||
| 5751 | retu rn parent && parent. nodeType ! == 11 ? pa rent : nul l; | |||||
| 5752 | }, | |||||
| 5753 | pa rents: fun ction( ele m ) { | |||||
| 5754 | retu rn jQuery. dir( elem, "parentNo de" ); | |||||
| 5755 | }, | |||||
| 5756 | pa rentsUntil : function ( elem, i, until ) { | |||||
| 5757 | retu rn jQuery. dir( elem, "parentNo de", until ); | |||||
| 5758 | }, | |||||
| 5759 | ne xt: functi on( elem ) { | |||||
| 5760 | retu rn sibling ( elem, "n extSibling " ); | |||||
| 5761 | }, | |||||
| 5762 | pr ev: functi on( elem ) { | |||||
| 5763 | retu rn sibling ( elem, "p reviousSib ling" ); | |||||
| 5764 | }, | |||||
| 5765 | ne xtAll: fun ction( ele m ) { | |||||
| 5766 | retu rn jQuery. dir( elem, "nextSibl ing" ); | |||||
| 5767 | }, | |||||
| 5768 | pr evAll: fun ction( ele m ) { | |||||
| 5769 | retu rn jQuery. dir( elem, "previous Sibling" ) ; | |||||
| 5770 | }, | |||||
| 5771 | ne xtUntil: f unction( e lem, i, un til ) { | |||||
| 5772 | retu rn jQuery. dir( elem, "nextSibl ing", unti l ); | |||||
| 5773 | }, | |||||
| 5774 | pr evUntil: f unction( e lem, i, un til ) { | |||||
| 5775 | retu rn jQuery. dir( elem, "previous Sibling", until ); | |||||
| 5776 | }, | |||||
| 5777 | si blings: fu nction( el em ) { | |||||
| 5778 | retu rn jQuery. sibling( ( elem.pare ntNode || {} ).first Child, ele m ); | |||||
| 5779 | }, | |||||
| 5780 | ch ildren: fu nction( el em ) { | |||||
| 5781 | retu rn jQuery. sibling( e lem.firstC hild ); | |||||
| 5782 | }, | |||||
| 5783 | co ntents: fu nction( el em ) { | |||||
| 5784 | retu rn jQuery. nodeName( elem, "ifr ame" ) ? | |||||
| 5785 | elem.c ontentDocu ment || el em.content Window.doc ument : | |||||
| 5786 | jQuery .merge( [] , elem.chi ldNodes ); | |||||
| 5787 | } | |||||
| 5788 | }, functio n( name, f n ) { | |||||
| 5789 | jQ uery.fn[ n ame ] = fu nction( un til, selec tor ) { | |||||
| 5790 | var ret = jQue ry.map( th is, fn, un til ); | |||||
| 5791 | ||||||
| 5792 | if ( !runtil.t est( name ) ) { | |||||
| 5793 | select or = until ; | |||||
| 5794 | } | |||||
| 5795 | ||||||
| 5796 | if ( selector && typeof selector = == "string " ) { | |||||
| 5797 | ret = jQuery.fil ter( selec tor, ret ) ; | |||||
| 5798 | } | |||||
| 5799 | ||||||
| 5800 | ret = this.len gth > 1 && !guarante edUnique[ name ] ? j Query.uniq ue( ret ) : ret; | |||||
| 5801 | ||||||
| 5802 | if ( this.leng th > 1 && rparentspr ev.test( n ame ) ) { | |||||
| 5803 | ret = ret.revers e(); | |||||
| 5804 | } | |||||
| 5805 | ||||||
| 5806 | retu rn this.pu shStack( r et ); | |||||
| 5807 | }; | |||||
| 5808 | }); | |||||
| 5809 | ||||||
| 5810 | jQuery.ext end({ | |||||
| 5811 | fi lter: func tion( expr , elems, n ot ) { | |||||
| 5812 | if ( not ) { | |||||
| 5813 | expr = ":not(" + expr + ") "; | |||||
| 5814 | } | |||||
| 5815 | ||||||
| 5816 | retu rn elems.l ength === 1 ? | |||||
| 5817 | jQuery .find.matc hesSelecto r(elems[0] , expr) ? [ elems[0] ] : [] : | |||||
| 5818 | jQuery .find.matc hes(expr, elems); | |||||
| 5819 | }, | |||||
| 5820 | ||||||
| 5821 | di r: functio n( elem, d ir, until ) { | |||||
| 5822 | var matched = [], | |||||
| 5823 | cur = elem[ dir ]; | |||||
| 5824 | ||||||
| 5825 | whil e ( cur && cur.nodeT ype !== 9 && (until === undefi ned || cur .nodeType !== 1 || ! jQuery( cu r ).is( un til )) ) { | |||||
| 5826 | if ( c ur.nodeTyp e === 1 ) { | |||||
| 5827 | matched. push( cur ); | |||||
| 5828 | } | |||||
| 5829 | cur = cur[dir]; | |||||
| 5830 | } | |||||
| 5831 | retu rn matched ; | |||||
| 5832 | }, | |||||
| 5833 | ||||||
| 5834 | si bling: fun ction( n, elem ) { | |||||
| 5835 | var r = []; | |||||
| 5836 | ||||||
| 5837 | for ( ; n; n = n.nextSib ling ) { | |||||
| 5838 | if ( n .nodeType === 1 && n !== elem ) { | |||||
| 5839 | r.push( n ); | |||||
| 5840 | } | |||||
| 5841 | } | |||||
| 5842 | ||||||
| 5843 | retu rn r; | |||||
| 5844 | } | |||||
| 5845 | }); | |||||
| 5846 | ||||||
| 5847 | // Impleme nt the ide ntical fun ctionality for filte r and not | |||||
| 5848 | function w innow( ele ments, qua lifier, ke ep ) { | |||||
| 5849 | ||||||
| 5850 | // Can't pas s null or undefined to indexOf in Firefo x 4 | |||||
| 5851 | // Set to 0 to skip st ring check | |||||
| 5852 | qu alifier = qualifier || 0; | |||||
| 5853 | ||||||
| 5854 | if ( jQuery. isFunction ( qualifie r ) ) { | |||||
| 5855 | retu rn jQuery. grep(eleme nts, funct ion( elem, i ) { | |||||
| 5856 | var re tVal = !!q ualifier.c all( elem, i, elem ) ; | |||||
| 5857 | return retVal == = keep; | |||||
| 5858 | }); | |||||
| 5859 | ||||||
| 5860 | } else if ( qualifier. nodeType ) { | |||||
| 5861 | retu rn jQuery. grep(eleme nts, funct ion( elem ) { | |||||
| 5862 | return ( elem == = qualifie r ) === ke ep; | |||||
| 5863 | }); | |||||
| 5864 | ||||||
| 5865 | } else if ( typeof qua lifier === "string" ) { | |||||
| 5866 | var filtered = jQuery.gr ep(element s, functio n( elem ) { | |||||
| 5867 | return elem.node Type === 1 ; | |||||
| 5868 | }); | |||||
| 5869 | ||||||
| 5870 | if ( isSimple. test( qual ifier ) ) { | |||||
| 5871 | return jQuery.fi lter(quali fier, filt ered, !kee p); | |||||
| 5872 | } el se { | |||||
| 5873 | qualif ier = jQue ry.filter( qualifier , filtered ); | |||||
| 5874 | } | |||||
| 5875 | } | |||||
| 5876 | ||||||
| 5877 | re turn jQuer y.grep(ele ments, fun ction( ele m ) { | |||||
| 5878 | retu rn ( jQuer y.inArray( elem, qua lifier ) > = 0 ) === keep; | |||||
| 5879 | }) ; | |||||
| 5880 | } | |||||
| 5881 | function c reateSafeF ragment( d ocument ) { | |||||
| 5882 | va r list = n odeNames.s plit( "|" ), | |||||
| 5883 | safe Frag = doc ument.crea teDocument Fragment() ; | |||||
| 5884 | ||||||
| 5885 | if ( safeFra g.createEl ement ) { | |||||
| 5886 | whil e ( list.l ength ) { | |||||
| 5887 | safeFr ag.createE lement( | |||||
| 5888 | list.pop () | |||||
| 5889 | ); | |||||
| 5890 | } | |||||
| 5891 | } | |||||
| 5892 | re turn safeF rag; | |||||
| 5893 | } | |||||
| 5894 | ||||||
| 5895 | var nodeNa mes = "abb r|article| aside|audi o|bdi|canv as|data|da talist|det ails|figca ption|figu re|footer| " + | |||||
| 5896 | "hea der|hgroup |mark|mete r|nav|outp ut|progres s|section| summary|ti me|video", | |||||
| 5897 | ri nlinejQuer y = / jQue ry\d+="(?: null|\d+)" /g, | |||||
| 5898 | rn oshimcache = new Reg Exp("<(?:" + nodeNam es + ")[\\ s/>]", "i" ), | |||||
| 5899 | rl eadingWhit espace = / ^\s+/, | |||||
| 5900 | rx htmlTag = /<(?!area| br|col|emb ed|hr|img| input|link |meta|para m)(([\w:]+ )[^>]*)\/> /gi, | |||||
| 5901 | rt agName = / <([\w:]+)/ , | |||||
| 5902 | rt body = /<t body/i, | |||||
| 5903 | rh tml = /<|& #?\w+;/, | |||||
| 5904 | rn oInnerhtml = /<(?:sc ript|style |link)/i, | |||||
| 5905 | ma nipulation _rcheckabl eType = /^ (?:checkbo x|radio)$/ i, | |||||
| 5906 | // checked=" checked" o r checked | |||||
| 5907 | rc hecked = / checked\s* (?:[^=]|=\ s*.checked .)/i, | |||||
| 5908 | rs criptType = /^$|\/(? :java|ecma )script/i, | |||||
| 5909 | rs criptTypeM asked = /^ true\/(.*) /, | |||||
| 5910 | rc leanScript = /^\s*<! (?:\[CDATA \[|--)|(?: \]\]|--)>\ s*$/g, | |||||
| 5911 | ||||||
| 5912 | // We have t o close th ese tags t o support XHTML (#13 200) | |||||
| 5913 | wr apMap = { | |||||
| 5914 | opti on: [ 1, " <select mu ltiple='mu ltiple'>", "</select >" ], | |||||
| 5915 | lege nd: [ 1, " <fieldset> ", "</fiel dset>" ], | |||||
| 5916 | area : [ 1, "<m ap>", "</m ap>" ], | |||||
| 5917 | para m: [ 1, "< object>", "</object> " ], | |||||
| 5918 | thea d: [ 1, "< table>", " </table>" ], | |||||
| 5919 | tr: [ 2, "<tab le><tbody> ", "</tbod y></table> " ], | |||||
| 5920 | col: [ 2, "<ta ble><tbody ></tbody>< colgroup>" , "</colgr oup></tabl e>" ], | |||||
| 5921 | td: [ 3, "<tab le><tbody> <tr>", "</ tr></tbody ></table>" ], | |||||
| 5922 | ||||||
| 5923 | // I E6-8 can't serialize link, scr ipt, style , or any h tml5 (NoSc ope) tags, | |||||
| 5924 | // u nless wrap ped in a d iv with no n-breaking character s in front of it. | |||||
| 5925 | _def ault: jQue ry.support .htmlSeria lize ? [ 0 , "", "" ] : [ 1, "X <div>", "< /div>" ] | |||||
| 5926 | }, | |||||
| 5927 | sa feFragment = createS afeFragmen t( documen t ), | |||||
| 5928 | fr agmentDiv = safeFrag ment.appen dChild( do cument.cre ateElement ("div") ); | |||||
| 5929 | ||||||
| 5930 | wrapMap.op tgroup = w rapMap.opt ion; | |||||
| 5931 | wrapMap.tb ody = wrap Map.tfoot = wrapMap. colgroup = wrapMap.c aption = w rapMap.the ad; | |||||
| 5932 | wrapMap.th = wrapMap .td; | |||||
| 5933 | ||||||
| 5934 | jQuery.fn. extend({ | |||||
| 5935 | te xt: functi on( value ) { | |||||
| 5936 | retu rn jQuery. access( th is, functi on( value ) { | |||||
| 5937 | return value === undefined ? | |||||
| 5938 | jQuery.t ext( this ) : | |||||
| 5939 | this.emp ty().appen d( ( this[ 0] && this [0].ownerD ocument || document ).createTe xtNode( va lue ) ); | |||||
| 5940 | }, n ull, value , argument s.length ) ; | |||||
| 5941 | }, | |||||
| 5942 | ||||||
| 5943 | wr apAll: fun ction( htm l ) { | |||||
| 5944 | if ( jQuery.is Function( html ) ) { | |||||
| 5945 | return this.each (function( i) { | |||||
| 5946 | jQuery(t his).wrapA ll( html.c all(this, i) ); | |||||
| 5947 | }); | |||||
| 5948 | } | |||||
| 5949 | ||||||
| 5950 | if ( this[0] ) { | |||||
| 5951 | // The elements to wrap th e target a round | |||||
| 5952 | var wr ap = jQuer y( html, t his[0].own erDocument ).eq(0).c lone(true) ; | |||||
| 5953 | ||||||
| 5954 | if ( t his[0].par entNode ) { | |||||
| 5955 | wrap.ins ertBefore( this[0] ) ; | |||||
| 5956 | } | |||||
| 5957 | ||||||
| 5958 | wrap.m ap(functio n() { | |||||
| 5959 | var elem = this; | |||||
| 5960 | ||||||
| 5961 | while ( elem.first Child && e lem.firstC hild.nodeT ype === 1 ) { | |||||
| 5962 | elem = ele m.firstChi ld; | |||||
| 5963 | } | |||||
| 5964 | ||||||
| 5965 | return e lem; | |||||
| 5966 | }).app end( this ); | |||||
| 5967 | } | |||||
| 5968 | ||||||
| 5969 | retu rn this; | |||||
| 5970 | }, | |||||
| 5971 | ||||||
| 5972 | wr apInner: f unction( h tml ) { | |||||
| 5973 | if ( jQuery.is Function( html ) ) { | |||||
| 5974 | return this.each (function( i) { | |||||
| 5975 | jQuery(t his).wrapI nner( html .call(this , i) ); | |||||
| 5976 | }); | |||||
| 5977 | } | |||||
| 5978 | ||||||
| 5979 | retu rn this.ea ch(functio n() { | |||||
| 5980 | var se lf = jQuer y( this ), | |||||
| 5981 | contents = self.co ntents(); | |||||
| 5982 | ||||||
| 5983 | if ( c ontents.le ngth ) { | |||||
| 5984 | contents .wrapAll( html ); | |||||
| 5985 | ||||||
| 5986 | } else { | |||||
| 5987 | self.app end( html ); | |||||
| 5988 | } | |||||
| 5989 | }); | |||||
| 5990 | }, | |||||
| 5991 | ||||||
| 5992 | wr ap: functi on( html ) { | |||||
| 5993 | var isFunction = jQuery. isFunction ( html ); | |||||
| 5994 | ||||||
| 5995 | retu rn this.ea ch(functio n(i) { | |||||
| 5996 | jQuery ( this ).w rapAll( is Function ? html.call (this, i) : html ); | |||||
| 5997 | }); | |||||
| 5998 | }, | |||||
| 5999 | ||||||
| 6000 | un wrap: func tion() { | |||||
| 6001 | retu rn this.pa rent().eac h(function () { | |||||
| 6002 | if ( ! jQuery.nod eName( thi s, "body" ) ) { | |||||
| 6003 | jQuery( this ).rep laceWith( this.child Nodes ); | |||||
| 6004 | } | |||||
| 6005 | }).e nd(); | |||||
| 6006 | }, | |||||
| 6007 | ||||||
| 6008 | ap pend: func tion() { | |||||
| 6009 | retu rn this.do mManip(arg uments, tr ue, functi on( elem ) { | |||||
| 6010 | if ( t his.nodeTy pe === 1 | | this.nod eType === 11 || this .nodeType === 9 ) { | |||||
| 6011 | this.app endChild( elem ); | |||||
| 6012 | } | |||||
| 6013 | }); | |||||
| 6014 | }, | |||||
| 6015 | ||||||
| 6016 | pr epend: fun ction() { | |||||
| 6017 | retu rn this.do mManip(arg uments, tr ue, functi on( elem ) { | |||||
| 6018 | if ( t his.nodeTy pe === 1 | | this.nod eType === 11 || this .nodeType === 9 ) { | |||||
| 6019 | this.ins ertBefore( elem, thi s.firstChi ld ); | |||||
| 6020 | } | |||||
| 6021 | }); | |||||
| 6022 | }, | |||||
| 6023 | ||||||
| 6024 | be fore: func tion() { | |||||
| 6025 | retu rn this.do mManip( ar guments, f alse, func tion( elem ) { | |||||
| 6026 | if ( t his.parent Node ) { | |||||
| 6027 | this.par entNode.in sertBefore ( elem, th is ); | |||||
| 6028 | } | |||||
| 6029 | }); | |||||
| 6030 | }, | |||||
| 6031 | ||||||
| 6032 | af ter: funct ion() { | |||||
| 6033 | retu rn this.do mManip( ar guments, f alse, func tion( elem ) { | |||||
| 6034 | if ( t his.parent Node ) { | |||||
| 6035 | this.par entNode.in sertBefore ( elem, th is.nextSib ling ); | |||||
| 6036 | } | |||||
| 6037 | }); | |||||
| 6038 | }, | |||||
| 6039 | ||||||
| 6040 | // keepData is for int ernal use only--do n ot documen t | |||||
| 6041 | re move: func tion( sele ctor, keep Data ) { | |||||
| 6042 | var elem, | |||||
| 6043 | i = 0; | |||||
| 6044 | ||||||
| 6045 | for ( ; (elem = this[i]) != null; i++ ) { | |||||
| 6046 | if ( ! selector | | jQuery.f ilter( sel ector, [ e lem ] ).le ngth > 0 ) { | |||||
| 6047 | if ( !ke epData && elem.nodeT ype === 1 ) { | |||||
| 6048 | jQuery.cle anData( ge tAll( elem ) ); | |||||
| 6049 | } | |||||
| 6050 | ||||||
| 6051 | if ( ele m.parentNo de ) { | |||||
| 6052 | if ( keepD ata && jQu ery.contai ns( elem.o wnerDocume nt, elem ) ) { | |||||
| 6053 | se tGlobalEva l( getAll( elem, "sc ript" ) ); | |||||
| 6054 | } | |||||
| 6055 | elem.paren tNode.remo veChild( e lem ); | |||||
| 6056 | } | |||||
| 6057 | } | |||||
| 6058 | } | |||||
| 6059 | ||||||
| 6060 | retu rn this; | |||||
| 6061 | }, | |||||
| 6062 | ||||||
| 6063 | em pty: funct ion() { | |||||
| 6064 | var elem, | |||||
| 6065 | i = 0; | |||||
| 6066 | ||||||
| 6067 | for ( ; (elem = this[i]) != null; i++ ) { | |||||
| 6068 | // Rem ove elemen t nodes an d prevent memory lea ks | |||||
| 6069 | if ( e lem.nodeTy pe === 1 ) { | |||||
| 6070 | jQuery.c leanData( getAll( el em, false ) ); | |||||
| 6071 | } | |||||
| 6072 | ||||||
| 6073 | // Rem ove any re maining no des | |||||
| 6074 | while ( elem.fir stChild ) { | |||||
| 6075 | elem.rem oveChild( elem.first Child ); | |||||
| 6076 | } | |||||
| 6077 | ||||||
| 6078 | // If this is a select, en sure that it display s empty (# 12336) | |||||
| 6079 | // Sup port: IE<9 | |||||
| 6080 | if ( e lem.option s && jQuer y.nodeName ( elem, "s elect" ) ) { | |||||
| 6081 | elem.opt ions.lengt h = 0; | |||||
| 6082 | } | |||||
| 6083 | } | |||||
| 6084 | ||||||
| 6085 | retu rn this; | |||||
| 6086 | }, | |||||
| 6087 | ||||||
| 6088 | cl one: funct ion( dataA ndEvents, deepDataAn dEvents ) { | |||||
| 6089 | data AndEvents = dataAndE vents == n ull ? fals e : dataAn dEvents; | |||||
| 6090 | deep DataAndEve nts = deep DataAndEve nts == nul l ? dataAn dEvents : deepDataAn dEvents; | |||||
| 6091 | ||||||
| 6092 | retu rn this.ma p( functio n () { | |||||
| 6093 | return jQuery.cl one( this, dataAndEv ents, deep DataAndEve nts ); | |||||
| 6094 | }); | |||||
| 6095 | }, | |||||
| 6096 | ||||||
| 6097 | ht ml: functi on( value ) { | |||||
| 6098 | retu rn jQuery. access( th is, functi on( value ) { | |||||
| 6099 | var el em = this[ 0] || {}, | |||||
| 6100 | i = 0, | |||||
| 6101 | l = this .length; | |||||
| 6102 | ||||||
| 6103 | if ( v alue === u ndefined ) { | |||||
| 6104 | return e lem.nodeTy pe === 1 ? | |||||
| 6105 | elem.inner HTML.repla ce( rinlin ejQuery, " " ) : | |||||
| 6106 | undefined; | |||||
| 6107 | } | |||||
| 6108 | ||||||
| 6109 | // See if we can take a sh ortcut and just use innerHTML | |||||
| 6110 | if ( t ypeof valu e === "str ing" && !r noInnerhtm l.test( va lue ) && | |||||
| 6111 | ( jQuery .support.h tmlSeriali ze || !rno shimcache. test( valu e ) ) && | |||||
| 6112 | ( jQuery .support.l eadingWhit espace || !rleadingW hitespace. test( valu e ) ) && | |||||
| 6113 | !wrapMap [ ( rtagNa me.exec( v alue ) || ["", ""] ) [1].toLowe rCase() ] ) { | |||||
| 6114 | ||||||
| 6115 | value = value.repl ace( rxhtm lTag, "<$1 ></$2>" ); | |||||
| 6116 | ||||||
| 6117 | try { | |||||
| 6118 | for (; i < l; i++ ) { | |||||
| 6119 | // Remove el ement node s and prev ent memory leaks | |||||
| 6120 | el em = this[ i] || {}; | |||||
| 6121 | if ( elem.no deType === 1 ) { | |||||
| 6122 | jQue ry.cleanDa ta( getAll ( elem, fa lse ) ); | |||||
| 6123 | elem .innerHTML = value; | |||||
| 6124 | } | |||||
| 6125 | } | |||||
| 6126 | ||||||
| 6127 | elem = 0; | |||||
| 6128 | ||||||
| 6129 | // If us ing innerH TML throws an except ion, use t he fallbac k method | |||||
| 6130 | } catch( e) {} | |||||
| 6131 | } | |||||
| 6132 | ||||||
| 6133 | if ( e lem ) { | |||||
| 6134 | this.emp ty().appen d( value ) ; | |||||
| 6135 | } | |||||
| 6136 | }, n ull, value , argument s.length ) ; | |||||
| 6137 | }, | |||||
| 6138 | ||||||
| 6139 | re placeWith: function( value ) { | |||||
| 6140 | var isFunc = j Query.isFu nction( va lue ); | |||||
| 6141 | ||||||
| 6142 | // M ake sure t hat the el ements are removed f rom the DO M before t hey are in serted | |||||
| 6143 | // t his can he lp fix rep lacing a p arent with child ele ments | |||||
| 6144 | if ( !isFunc & & typeof v alue !== " string" ) { | |||||
| 6145 | value = jQuery( value ).no t( this ). detach(); | |||||
| 6146 | } | |||||
| 6147 | ||||||
| 6148 | retu rn this.do mManip( [ value ], t rue, funct ion( elem ) { | |||||
| 6149 | var ne xt = this. nextSiblin g, | |||||
| 6150 | parent = this.pare ntNode; | |||||
| 6151 | ||||||
| 6152 | if ( p arent ) { | |||||
| 6153 | jQuery( this ).rem ove(); | |||||
| 6154 | parent.i nsertBefor e( elem, n ext ); | |||||
| 6155 | } | |||||
| 6156 | }); | |||||
| 6157 | }, | |||||
| 6158 | ||||||
| 6159 | de tach: func tion( sele ctor ) { | |||||
| 6160 | retu rn this.re move( sele ctor, true ); | |||||
| 6161 | }, | |||||
| 6162 | ||||||
| 6163 | do mManip: fu nction( ar gs, table, callback ) { | |||||
| 6164 | ||||||
| 6165 | // F latten any nested ar rays | |||||
| 6166 | args = core_co ncat.apply ( [], args ); | |||||
| 6167 | ||||||
| 6168 | var first, nod e, hasScri pts, | |||||
| 6169 | script s, doc, fr agment, | |||||
| 6170 | i = 0, | |||||
| 6171 | l = th is.length, | |||||
| 6172 | set = this, | |||||
| 6173 | iNoClo ne = l - 1 , | |||||
| 6174 | value = args[0], | |||||
| 6175 | isFunc tion = jQu ery.isFunc tion( valu e ); | |||||
| 6176 | ||||||
| 6177 | // W e can't cl oneNode fr agments th at contain checked, in WebKit | |||||
| 6178 | if ( isFunctio n || !( l <= 1 || ty peof value !== "stri ng" || jQu ery.suppor t.checkClo ne || !rch ecked.test ( value ) ) ) { | |||||
| 6179 | return this.each (function( index ) { | |||||
| 6180 | var self = set.eq( index ); | |||||
| 6181 | if ( isF unction ) { | |||||
| 6182 | args[0] = value.call ( this, in dex, table ? self.ht ml() : und efined ); | |||||
| 6183 | } | |||||
| 6184 | self.dom Manip( arg s, table, callback ) ; | |||||
| 6185 | }); | |||||
| 6186 | } | |||||
| 6187 | ||||||
| 6188 | if ( l ) { | |||||
| 6189 | fragme nt = jQuer y.buildFra gment( arg s, this[ 0 ].ownerDo cument, fa lse, this ); | |||||
| 6190 | first = fragment .firstChil d; | |||||
| 6191 | ||||||
| 6192 | if ( f ragment.ch ildNodes.l ength === 1 ) { | |||||
| 6193 | fragment = first; | |||||
| 6194 | } | |||||
| 6195 | ||||||
| 6196 | if ( f irst ) { | |||||
| 6197 | table = table && j Query.node Name( firs t, "tr" ); | |||||
| 6198 | scripts = jQuery.m ap( getAll ( fragment , "script" ), disabl eScript ); | |||||
| 6199 | hasScrip ts = scrip ts.length; | |||||
| 6200 | ||||||
| 6201 | // Use t he origina l fragment for the l ast item i nstead of the first because it can end u p | |||||
| 6202 | // being emptied i ncorrectly in certai n situatio ns (#8070) . | |||||
| 6203 | for ( ; i < l; i++ ) { | |||||
| 6204 | node = fra gment; | |||||
| 6205 | ||||||
| 6206 | if ( i !== iNoClone ) { | |||||
| 6207 | no de = jQuer y.clone( n ode, true, true ); | |||||
| 6208 | ||||||
| 6209 | // Keep refe rences to cloned scr ipts for l ater resto ration | |||||
| 6210 | if ( hasScri pts ) { | |||||
| 6211 | jQue ry.merge( scripts, g etAll( nod e, "script " ) ); | |||||
| 6212 | } | |||||
| 6213 | } | |||||
| 6214 | ||||||
| 6215 | callback.c all( | |||||
| 6216 | ta ble && jQu ery.nodeNa me( this[i ], "table" ) ? | |||||
| 6217 | find OrAppend( this[i], " tbody" ) : | |||||
| 6218 | this [i], | |||||
| 6219 | no de, | |||||
| 6220 | i | |||||
| 6221 | ); | |||||
| 6222 | } | |||||
| 6223 | ||||||
| 6224 | if ( has Scripts ) { | |||||
| 6225 | doc = scri pts[ scrip ts.length - 1 ].owne rDocument; | |||||
| 6226 | ||||||
| 6227 | // Reenabl e scripts | |||||
| 6228 | jQuery.map ( scripts, restoreSc ript ); | |||||
| 6229 | ||||||
| 6230 | // Evaluat e executab le scripts on first document i nsertion | |||||
| 6231 | for ( i = 0; i < has Scripts; i ++ ) { | |||||
| 6232 | no de = scrip ts[ i ]; | |||||
| 6233 | if ( rscript Type.test( node.type || "" ) & & | |||||
| 6234 | !jQu ery._data( node, "gl obalEval" ) && jQuer y.contains ( doc, nod e ) ) { | |||||
| 6235 | ||||||
| 6236 | if ( node.src ) { | |||||
| 6237 | // Hop e ajax is available. .. | |||||
| 6238 | jQuery .ajax({ | |||||
| 6239 | url: nod e.src, | |||||
| 6240 | type: "G ET", | |||||
| 6241 | dataType : "script" , | |||||
| 6242 | async: f alse, | |||||
| 6243 | global: false, | |||||
| 6244 | "throws" : true | |||||
| 6245 | }); | |||||
| 6246 | } el se { | |||||
| 6247 | jQuery .globalEva l( ( node. text || no de.textCon tent || no de.innerHT ML || "" ) .replace( rcleanScri pt, "" ) ) ; | |||||
| 6248 | } | |||||
| 6249 | } | |||||
| 6250 | } | |||||
| 6251 | } | |||||
| 6252 | ||||||
| 6253 | // Fix # 11809: Avo id leaking memory | |||||
| 6254 | fragment = first = null; | |||||
| 6255 | } | |||||
| 6256 | } | |||||
| 6257 | ||||||
| 6258 | retu rn this; | |||||
| 6259 | } | |||||
| 6260 | }); | |||||
| 6261 | ||||||
| 6262 | function f indOrAppen d( elem, t ag ) { | |||||
| 6263 | re turn elem. getElement sByTagName ( tag )[0] || elem.a ppendChild ( elem.own erDocument .createEle ment( tag ) ); | |||||
| 6264 | } | |||||
| 6265 | ||||||
| 6266 | // Replace /restore t he type at tribute of script el ements for safe DOM manipulati on | |||||
| 6267 | function d isableScri pt( elem ) { | |||||
| 6268 | va r attr = e lem.getAtt ributeNode ("type"); | |||||
| 6269 | el em.type = ( attr && attr.speci fied ) + " /" + elem. type; | |||||
| 6270 | re turn elem; | |||||
| 6271 | } | |||||
| 6272 | function r estoreScri pt( elem ) { | |||||
| 6273 | va r match = rscriptTyp eMasked.ex ec( elem.t ype ); | |||||
| 6274 | if ( match ) { | |||||
| 6275 | elem .type = ma tch[1]; | |||||
| 6276 | } else { | |||||
| 6277 | elem .removeAtt ribute("ty pe"); | |||||
| 6278 | } | |||||
| 6279 | re turn elem; | |||||
| 6280 | } | |||||
| 6281 | ||||||
| 6282 | // Mark sc ripts as h aving alre ady been e valuated | |||||
| 6283 | function s etGlobalEv al( elems, refElemen ts ) { | |||||
| 6284 | va r elem, | |||||
| 6285 | i = 0; | |||||
| 6286 | fo r ( ; (ele m = elems[ i]) != nul l; i++ ) { | |||||
| 6287 | jQue ry._data( elem, "glo balEval", !refElemen ts || jQue ry._data( refElement s[i], "glo balEval" ) ); | |||||
| 6288 | } | |||||
| 6289 | } | |||||
| 6290 | ||||||
| 6291 | function c loneCopyEv ent( src, dest ) { | |||||
| 6292 | ||||||
| 6293 | if ( dest.no deType !== 1 || !jQu ery.hasDat a( src ) ) { | |||||
| 6294 | retu rn; | |||||
| 6295 | } | |||||
| 6296 | ||||||
| 6297 | va r type, i, l, | |||||
| 6298 | oldD ata = jQue ry._data( src ), | |||||
| 6299 | curD ata = jQue ry._data( dest, oldD ata ), | |||||
| 6300 | even ts = oldDa ta.events; | |||||
| 6301 | ||||||
| 6302 | if ( events ) { | |||||
| 6303 | dele te curData .handle; | |||||
| 6304 | curD ata.events = {}; | |||||
| 6305 | ||||||
| 6306 | for ( type in events ) { | |||||
| 6307 | for ( i = 0, l = events[ t ype ].leng th; i < l; i++ ) { | |||||
| 6308 | jQuery.e vent.add( dest, type , events[ type ][ i ] ); | |||||
| 6309 | } | |||||
| 6310 | } | |||||
| 6311 | } | |||||
| 6312 | ||||||
| 6313 | // make the cloned pub lic data o bject a co py from th e original | |||||
| 6314 | if ( curData .data ) { | |||||
| 6315 | curD ata.data = jQuery.ex tend( {}, curData.da ta ); | |||||
| 6316 | } | |||||
| 6317 | } | |||||
| 6318 | ||||||
| 6319 | function f ixCloneNod eIssues( s rc, dest ) { | |||||
| 6320 | va r nodeName , e, data; | |||||
| 6321 | ||||||
| 6322 | // We do not need to d o anything for non-E lements | |||||
| 6323 | if ( dest.no deType !== 1 ) { | |||||
| 6324 | retu rn; | |||||
| 6325 | } | |||||
| 6326 | ||||||
| 6327 | no deName = d est.nodeNa me.toLower Case(); | |||||
| 6328 | ||||||
| 6329 | // IE6-8 cop ies events bound via attachEve nt when us ing cloneN ode. | |||||
| 6330 | if ( !jQuery .support.n oCloneEven t && dest[ jQuery.ex pando ] ) { | |||||
| 6331 | data = jQuery. _data( des t ); | |||||
| 6332 | ||||||
| 6333 | for ( e in dat a.events ) { | |||||
| 6334 | jQuery .removeEve nt( dest, e, data.ha ndle ); | |||||
| 6335 | } | |||||
| 6336 | ||||||
| 6337 | // E vent data gets refer enced inst ead of cop ied if the expando g ets copied too | |||||
| 6338 | dest .removeAtt ribute( jQ uery.expan do ); | |||||
| 6339 | } | |||||
| 6340 | ||||||
| 6341 | // IE blanks contents when cloni ng scripts , and trie s to evalu ate newly- set text | |||||
| 6342 | if ( nodeNam e === "scr ipt" && de st.text != = src.text ) { | |||||
| 6343 | disa bleScript( dest ).te xt = src.t ext; | |||||
| 6344 | rest oreScript( dest ); | |||||
| 6345 | ||||||
| 6346 | // IE6-10 im properly c lones chil dren of ob ject eleme nts using classid. | |||||
| 6347 | // IE10 thro ws NoModif icationAll owedError if parent is null, # 12132. | |||||
| 6348 | } else if ( nodeName = == "object " ) { | |||||
| 6349 | if ( dest.pare ntNode ) { | |||||
| 6350 | dest.o uterHTML = src.outer HTML; | |||||
| 6351 | } | |||||
| 6352 | ||||||
| 6353 | // T his path a ppears una voidable f or IE9. Wh en cloning an object | |||||
| 6354 | // e lement in IE9, the o uterHTML s trategy ab ove is not sufficien t. | |||||
| 6355 | // I f the src has innerH TML and th e destinat ion does n ot, | |||||
| 6356 | // c opy the sr c.innerHTM L into the dest.inne rHTML. #10 324 | |||||
| 6357 | if ( jQuery.su pport.html 5Clone && ( src.inne rHTML && ! jQuery.tri m(dest.inn erHTML) ) ) { | |||||
| 6358 | dest.i nnerHTML = src.inner HTML; | |||||
| 6359 | } | |||||
| 6360 | ||||||
| 6361 | } else if ( nodeName = == "input" && manipu lation_rch eckableTyp e.test( sr c.type ) ) { | |||||
| 6362 | // I E6-8 fails to persis t the chec ked state of a clone d checkbox | |||||
| 6363 | // o r radio bu tton. Wors e, IE6-7 f ail to giv e the clon ed element | |||||
| 6364 | // a checked a ppearance if the def aultChecke d value is n't also s et | |||||
| 6365 | ||||||
| 6366 | dest .defaultCh ecked = de st.checked = src.che cked; | |||||
| 6367 | ||||||
| 6368 | // I E6-7 get c onfused an d end up s etting the value of a cloned | |||||
| 6369 | // c heckbox/ra dio button to an emp ty string instead of "on" | |||||
| 6370 | if ( dest.valu e !== src. value ) { | |||||
| 6371 | dest.v alue = src .value; | |||||
| 6372 | } | |||||
| 6373 | ||||||
| 6374 | // IE6-8 fai ls to retu rn the sel ected opti on to the default se lected | |||||
| 6375 | // state whe n cloning options | |||||
| 6376 | } else if ( nodeName = == "option " ) { | |||||
| 6377 | dest .defaultSe lected = d est.select ed = src.d efaultSele cted; | |||||
| 6378 | ||||||
| 6379 | // IE6-8 fai ls to set the defaul tValue to the correc t value wh en | |||||
| 6380 | // cloning o ther types of input fields | |||||
| 6381 | } else if ( nodeName = == "input" || nodeNa me === "te xtarea" ) { | |||||
| 6382 | dest .defaultVa lue = src. defaultVal ue; | |||||
| 6383 | } | |||||
| 6384 | } | |||||
| 6385 | ||||||
| 6386 | jQuery.eac h({ | |||||
| 6387 | ap pendTo: "a ppend", | |||||
| 6388 | pr ependTo: " prepend", | |||||
| 6389 | in sertBefore : "before" , | |||||
| 6390 | in sertAfter: "after", | |||||
| 6391 | re placeAll: "replaceWi th" | |||||
| 6392 | }, functio n( name, o riginal ) { | |||||
| 6393 | jQ uery.fn[ n ame ] = fu nction( se lector ) { | |||||
| 6394 | var elems, | |||||
| 6395 | i = 0, | |||||
| 6396 | ret = [], | |||||
| 6397 | insert = jQuery( selector ), | |||||
| 6398 | last = insert.le ngth - 1; | |||||
| 6399 | ||||||
| 6400 | for ( ; i <= l ast; i++ ) { | |||||
| 6401 | elems = i === la st ? this : this.clo ne(true); | |||||
| 6402 | jQuery ( insert[i ] )[ origi nal ]( ele ms ); | |||||
| 6403 | ||||||
| 6404 | // Mod ern browse rs can app ly jQuery collection s as array s, but old IE needs a .get() | |||||
| 6405 | core_p ush.apply( ret, elem s.get() ); | |||||
| 6406 | } | |||||
| 6407 | ||||||
| 6408 | retu rn this.pu shStack( r et ); | |||||
| 6409 | }; | |||||
| 6410 | }); | |||||
| 6411 | ||||||
| 6412 | function g etAll( con text, tag ) { | |||||
| 6413 | va r elems, e lem, | |||||
| 6414 | i = 0, | |||||
| 6415 | foun d = typeof context.g etElements ByTagName !== core_s trundefine d ? contex t.getEleme ntsByTagNa me( tag || "*" ) : | |||||
| 6416 | typeof context.q uerySelect orAll !== core_strun defined ? context.qu erySelecto rAll( tag || "*" ) : | |||||
| 6417 | undefi ned; | |||||
| 6418 | ||||||
| 6419 | if ( !found ) { | |||||
| 6420 | for ( found = [], elems = context. childNodes || contex t; (elem = elems[i]) != null; i++ ) { | |||||
| 6421 | if ( ! tag || jQu ery.nodeNa me( elem, tag ) ) { | |||||
| 6422 | found.pu sh( elem ) ; | |||||
| 6423 | } else { | |||||
| 6424 | jQuery.m erge( foun d, getAll( elem, tag ) ); | |||||
| 6425 | } | |||||
| 6426 | } | |||||
| 6427 | } | |||||
| 6428 | ||||||
| 6429 | re turn tag = == undefin ed || tag && jQuery. nodeName( context, t ag ) ? | |||||
| 6430 | jQue ry.merge( [ context ], found ) : | |||||
| 6431 | foun d; | |||||
| 6432 | } | |||||
| 6433 | ||||||
| 6434 | // Used in buildFrag ment, fixe s the defa ultChecked property | |||||
| 6435 | function f ixDefaultC hecked( el em ) { | |||||
| 6436 | if ( manipul ation_rche ckableType .test( ele m.type ) ) { | |||||
| 6437 | elem .defaultCh ecked = el em.checked ; | |||||
| 6438 | } | |||||
| 6439 | } | |||||
| 6440 | ||||||
| 6441 | jQuery.ext end({ | |||||
| 6442 | cl one: funct ion( elem, dataAndEv ents, deep DataAndEve nts ) { | |||||
| 6443 | var destElemen ts, node, clone, i, srcElement s, | |||||
| 6444 | inPage = jQuery. contains( elem.owner Document, elem ); | |||||
| 6445 | ||||||
| 6446 | if ( jQuery.su pport.html 5Clone || jQuery.isX MLDoc(elem ) || !rnos himcache.t est( "<" + elem.node Name + ">" ) ) { | |||||
| 6447 | clone = elem.clo neNode( tr ue ); | |||||
| 6448 | ||||||
| 6449 | // I E<=8 does not proper ly clone d etached, u nknown ele ment nodes | |||||
| 6450 | } el se { | |||||
| 6451 | fragme ntDiv.inne rHTML = el em.outerHT ML; | |||||
| 6452 | fragme ntDiv.remo veChild( c lone = fra gmentDiv.f irstChild ); | |||||
| 6453 | } | |||||
| 6454 | ||||||
| 6455 | if ( (!jQuery. support.no CloneEvent || !jQuer y.support. noCloneChe cked) && | |||||
| 6456 | (elem.no deType === 1 || elem .nodeType === 11) && !jQuery.i sXMLDoc(el em) ) { | |||||
| 6457 | ||||||
| 6458 | // We eschew Siz zle here f or perform ance reaso ns: http:/ /jsperf.co m/getall-v s-sizzle/2 | |||||
| 6459 | destEl ements = g etAll( clo ne ); | |||||
| 6460 | srcEle ments = ge tAll( elem ); | |||||
| 6461 | ||||||
| 6462 | // Fix all IE cl oning issu es | |||||
| 6463 | for ( i = 0; (no de = srcEl ements[i]) != null; ++i ) { | |||||
| 6464 | // Ensur e that the destinati on node is not null; Fixes #95 87 | |||||
| 6465 | if ( des tElements[ i] ) { | |||||
| 6466 | fixCloneNo deIssues( node, dest Elements[i ] ); | |||||
| 6467 | } | |||||
| 6468 | } | |||||
| 6469 | } | |||||
| 6470 | ||||||
| 6471 | // C opy the ev ents from the origin al to the clone | |||||
| 6472 | if ( dataAndEv ents ) { | |||||
| 6473 | if ( d eepDataAnd Events ) { | |||||
| 6474 | srcEleme nts = srcE lements || getAll( e lem ); | |||||
| 6475 | destElem ents = des tElements || getAll( clone ); | |||||
| 6476 | ||||||
| 6477 | for ( i = 0; (node = srcElem ents[i]) ! = null; i+ + ) { | |||||
| 6478 | cloneCopyE vent( node , destElem ents[i] ); | |||||
| 6479 | } | |||||
| 6480 | } else { | |||||
| 6481 | cloneCop yEvent( el em, clone ); | |||||
| 6482 | } | |||||
| 6483 | } | |||||
| 6484 | ||||||
| 6485 | // P reserve sc ript evalu ation hist ory | |||||
| 6486 | dest Elements = getAll( c lone, "scr ipt" ); | |||||
| 6487 | if ( destEleme nts.length > 0 ) { | |||||
| 6488 | setGlo balEval( d estElement s, !inPage && getAll ( elem, "s cript" ) ) ; | |||||
| 6489 | } | |||||
| 6490 | ||||||
| 6491 | dest Elements = srcElemen ts = node = null; | |||||
| 6492 | ||||||
| 6493 | // R eturn the cloned set | |||||
| 6494 | retu rn clone; | |||||
| 6495 | }, | |||||
| 6496 | ||||||
| 6497 | bu ildFragmen t: functio n( elems, context, s cripts, se lection ) { | |||||
| 6498 | var j, elem, c ontains, | |||||
| 6499 | tmp, t ag, tbody, wrap, | |||||
| 6500 | l = el ems.length , | |||||
| 6501 | ||||||
| 6502 | // Ens ure a safe fragment | |||||
| 6503 | safe = createSaf eFragment( context ) , | |||||
| 6504 | ||||||
| 6505 | nodes = [], | |||||
| 6506 | i = 0; | |||||
| 6507 | ||||||
| 6508 | for ( ; i < l; i++ ) { | |||||
| 6509 | elem = elems[ i ]; | |||||
| 6510 | ||||||
| 6511 | if ( e lem || ele m === 0 ) { | |||||
| 6512 | ||||||
| 6513 | // Add n odes direc tly | |||||
| 6514 | if ( jQu ery.type( elem ) === "object" ) { | |||||
| 6515 | jQuery.mer ge( nodes, elem.node Type ? [ e lem ] : el em ); | |||||
| 6516 | ||||||
| 6517 | // Conve rt non-htm l into a t ext node | |||||
| 6518 | } else i f ( !rhtml .test( ele m ) ) { | |||||
| 6519 | nodes.push ( context. createText Node( elem ) ); | |||||
| 6520 | ||||||
| 6521 | // Conve rt html in to DOM nod es | |||||
| 6522 | } else { | |||||
| 6523 | tmp = tmp || safe.ap pendChild( context.c reateEleme nt("div") ); | |||||
| 6524 | ||||||
| 6525 | // Deseria lize a sta ndard repr esentation | |||||
| 6526 | tag = ( rt agName.exe c( elem ) || ["", "" ] )[1].toL owerCase() ; | |||||
| 6527 | wrap = wra pMap[ tag ] || wrapM ap._defaul t; | |||||
| 6528 | ||||||
| 6529 | tmp.innerH TML = wrap [1] + elem .replace( rxhtmlTag, "<$1></$2 >" ) + wra p[2]; | |||||
| 6530 | ||||||
| 6531 | // Descend through w rappers to the right content | |||||
| 6532 | j = wrap[0 ]; | |||||
| 6533 | while ( j- - ) { | |||||
| 6534 | tm p = tmp.la stChild; | |||||
| 6535 | } | |||||
| 6536 | ||||||
| 6537 | // Manuall y add lead ing whites pace remov ed by IE | |||||
| 6538 | if ( !jQue ry.support .leadingWh itespace & & rleading Whitespace .test( ele m ) ) { | |||||
| 6539 | no des.push( context.cr eateTextNo de( rleadi ngWhitespa ce.exec( e lem )[0] ) ); | |||||
| 6540 | } | |||||
| 6541 | ||||||
| 6542 | // Remove IE's autoi nserted <t body> from table fra gments | |||||
| 6543 | if ( !jQue ry.support .tbody ) { | |||||
| 6544 | ||||||
| 6545 | // String wa s a <table >, *may* h ave spurio us <tbody> | |||||
| 6546 | el em = tag = == "table" && !rtbod y.test( el em ) ? | |||||
| 6547 | tmp. firstChild : | |||||
| 6548 | ||||||
| 6549 | // S tring was a bare <th ead> or <t foot> | |||||
| 6550 | wrap [1] === "< table>" && !rtbody.t est( elem ) ? | |||||
| 6551 | tmp : | |||||
| 6552 | 0; | |||||
| 6553 | ||||||
| 6554 | j = elem && elem.child Nodes.leng th; | |||||
| 6555 | wh ile ( j-- ) { | |||||
| 6556 | if ( jQuery.no deName( (t body = ele m.childNod es[j]), "t body" ) && !tbody.ch ildNodes.l ength ) { | |||||
| 6557 | elem.r emoveChild ( tbody ); | |||||
| 6558 | } | |||||
| 6559 | } | |||||
| 6560 | } | |||||
| 6561 | ||||||
| 6562 | jQuery.mer ge( nodes, tmp.child Nodes ); | |||||
| 6563 | ||||||
| 6564 | // Fix #12 392 for We bKit and I E > 9 | |||||
| 6565 | tmp.textCo ntent = "" ; | |||||
| 6566 | ||||||
| 6567 | // Fix #12 392 for ol dIE | |||||
| 6568 | while ( tm p.firstChi ld ) { | |||||
| 6569 | tm p.removeCh ild( tmp.f irstChild ); | |||||
| 6570 | } | |||||
| 6571 | ||||||
| 6572 | // Remembe r the top- level cont ainer for proper cle anup | |||||
| 6573 | tmp = safe .lastChild ; | |||||
| 6574 | } | |||||
| 6575 | } | |||||
| 6576 | } | |||||
| 6577 | ||||||
| 6578 | // F ix #11356: Clear ele ments from fragment | |||||
| 6579 | if ( tmp ) { | |||||
| 6580 | safe.r emoveChild ( tmp ); | |||||
| 6581 | } | |||||
| 6582 | ||||||
| 6583 | // R eset defau ltChecked for any ra dios and c heckboxes | |||||
| 6584 | // a bout to be appended to the DOM in IE 6/7 (#8060) | |||||
| 6585 | if ( !jQuery.s upport.app endChecked ) { | |||||
| 6586 | jQuery .grep( get All( nodes , "input" ), fixDefa ultChecked ); | |||||
| 6587 | } | |||||
| 6588 | ||||||
| 6589 | i = 0; | |||||
| 6590 | whil e ( (elem = nodes[ i ++ ]) ) { | |||||
| 6591 | ||||||
| 6592 | // #40 87 - If or igin and d estination elements are the sa me, and th is is | |||||
| 6593 | // tha t element, do not do anything | |||||
| 6594 | if ( s election & & jQuery.i nArray( el em, select ion ) !== -1 ) { | |||||
| 6595 | continue ; | |||||
| 6596 | } | |||||
| 6597 | ||||||
| 6598 | contai ns = jQuer y.contains ( elem.own erDocument , elem ); | |||||
| 6599 | ||||||
| 6600 | // App end to fra gment | |||||
| 6601 | tmp = getAll( sa fe.appendC hild( elem ), "scrip t" ); | |||||
| 6602 | ||||||
| 6603 | // Pre serve scri pt evaluat ion histor y | |||||
| 6604 | if ( c ontains ) { | |||||
| 6605 | setGloba lEval( tmp ); | |||||
| 6606 | } | |||||
| 6607 | ||||||
| 6608 | // Cap ture execu tables | |||||
| 6609 | if ( s cripts ) { | |||||
| 6610 | j = 0; | |||||
| 6611 | while ( (elem = tm p[ j++ ]) ) { | |||||
| 6612 | if ( rscri ptType.tes t( elem.ty pe || "" ) ) { | |||||
| 6613 | sc ripts.push ( elem ); | |||||
| 6614 | } | |||||
| 6615 | } | |||||
| 6616 | } | |||||
| 6617 | } | |||||
| 6618 | ||||||
| 6619 | tmp = null; | |||||
| 6620 | ||||||
| 6621 | retu rn safe; | |||||
| 6622 | }, | |||||
| 6623 | ||||||
| 6624 | cl eanData: f unction( e lems, /* i nternal */ acceptDat a ) { | |||||
| 6625 | var elem, type , id, data , | |||||
| 6626 | i = 0, | |||||
| 6627 | intern alKey = jQ uery.expan do, | |||||
| 6628 | cache = jQuery.c ache, | |||||
| 6629 | delete Expando = jQuery.sup port.delet eExpando, | |||||
| 6630 | specia l = jQuery .event.spe cial; | |||||
| 6631 | ||||||
| 6632 | for ( ; (elem = elems[i] ) != null; i++ ) { | |||||
| 6633 | ||||||
| 6634 | if ( a cceptData || jQuery. acceptData ( elem ) ) { | |||||
| 6635 | ||||||
| 6636 | id = ele m[ interna lKey ]; | |||||
| 6637 | data = i d && cache [ id ]; | |||||
| 6638 | ||||||
| 6639 | if ( dat a ) { | |||||
| 6640 | if ( data. events ) { | |||||
| 6641 | fo r ( type i n data.eve nts ) { | |||||
| 6642 | if ( special[ type ] ) { | |||||
| 6643 | jQuery .event.rem ove( elem, type ); | |||||
| 6644 | ||||||
| 6645 | // T his is a s hortcut to avoid jQu ery.event. remove's o verhead | |||||
| 6646 | } el se { | |||||
| 6647 | jQuery .removeEve nt( elem, type, data .handle ); | |||||
| 6648 | } | |||||
| 6649 | } | |||||
| 6650 | } | |||||
| 6651 | ||||||
| 6652 | // Remove cache only if it was not alrea dy removed by jQuery .event.rem ove | |||||
| 6653 | if ( cache [ id ] ) { | |||||
| 6654 | ||||||
| 6655 | de lete cache [ id ]; | |||||
| 6656 | ||||||
| 6657 | // IE does n ot allow u s to delet e expando properties from node s, | |||||
| 6658 | // nor does it have a removeAttr ibute func tion on Do cument nod es; | |||||
| 6659 | // we must h andle all of these c ases | |||||
| 6660 | if ( deleteE xpando ) { | |||||
| 6661 | dele te elem[ i nternalKey ]; | |||||
| 6662 | ||||||
| 6663 | } else if ( typeof ele m.removeAt tribute != = core_str undefined ) { | |||||
| 6664 | elem .removeAtt ribute( in ternalKey ); | |||||
| 6665 | ||||||
| 6666 | } else { | |||||
| 6667 | elem [ internal Key ] = nu ll; | |||||
| 6668 | } | |||||
| 6669 | ||||||
| 6670 | co re_deleted Ids.push( id ); | |||||
| 6671 | } | |||||
| 6672 | } | |||||
| 6673 | } | |||||
| 6674 | } | |||||
| 6675 | } | |||||
| 6676 | }); | |||||
| 6677 | var iframe , getStyle s, curCSS, | |||||
| 6678 | ra lpha = /al pha\([^)]* \)/i, | |||||
| 6679 | ro pacity = / opacity\s* =\s*([^)]* )/, | |||||
| 6680 | rp osition = /^(top|rig ht|bottom| left)$/, | |||||
| 6681 | // swappable if displa y is none or starts with table except "t able", "ta ble-cell", or "table -caption" | |||||
| 6682 | // see here for displa y values: https://de veloper.mo zilla.org/ en-US/docs /CSS/displ ay | |||||
| 6683 | rd isplayswap = /^(none |table(?!- c[ea]).+)/ , | |||||
| 6684 | rm argin = /^ margin/, | |||||
| 6685 | rn umsplit = new RegExp ( "^(" + c ore_pnum + ")(.*)$", "i" ), | |||||
| 6686 | rn umnonpx = new RegExp ( "^(" + c ore_pnum + ")(?!px)[ a-z%]+$", "i" ), | |||||
| 6687 | rr elNum = ne w RegExp( "^([+-])=( " + core_p num + ")", "i" ), | |||||
| 6688 | el emdisplay = { BODY: "block" }, | |||||
| 6689 | ||||||
| 6690 | cs sShow = { position: "absolute" , visibili ty: "hidde n", displa y: "block" }, | |||||
| 6691 | cs sNormalTra nsform = { | |||||
| 6692 | lett erSpacing: 0, | |||||
| 6693 | font Weight: 40 0 | |||||
| 6694 | }, | |||||
| 6695 | ||||||
| 6696 | cs sExpand = [ "Top", " Right", "B ottom", "L eft" ], | |||||
| 6697 | cs sPrefixes = [ "Webki t", "O", " Moz", "ms" ]; | |||||
| 6698 | ||||||
| 6699 | // return a css prop erty mappe d to a pot entially v endor pref ixed prope rty | |||||
| 6700 | function v endorPropN ame( style , name ) { | |||||
| 6701 | ||||||
| 6702 | // shortcut for names that are n ot vendor prefixed | |||||
| 6703 | if ( name in style ) { | |||||
| 6704 | retu rn name; | |||||
| 6705 | } | |||||
| 6706 | ||||||
| 6707 | // check for vendor pr efixed nam es | |||||
| 6708 | va r capName = name.cha rAt(0).toU pperCase() + name.sl ice(1), | |||||
| 6709 | orig Name = nam e, | |||||
| 6710 | i = cssPrefixe s.length; | |||||
| 6711 | ||||||
| 6712 | wh ile ( i-- ) { | |||||
| 6713 | name = cssPref ixes[ i ] + capName; | |||||
| 6714 | if ( name in s tyle ) { | |||||
| 6715 | return name; | |||||
| 6716 | } | |||||
| 6717 | } | |||||
| 6718 | ||||||
| 6719 | re turn origN ame; | |||||
| 6720 | } | |||||
| 6721 | ||||||
| 6722 | function i sHidden( e lem, el ) { | |||||
| 6723 | // isHidden might be c alled from jQuery#fi lter funct ion; | |||||
| 6724 | // in that c ase, eleme nt will be second ar gument | |||||
| 6725 | el em = el || elem; | |||||
| 6726 | re turn jQuer y.css( ele m, "displa y" ) === " none" || ! jQuery.con tains( ele m.ownerDoc ument, ele m ); | |||||
| 6727 | } | |||||
| 6728 | ||||||
| 6729 | function s howHide( e lements, s how ) { | |||||
| 6730 | va r display, elem, hid den, | |||||
| 6731 | valu es = [], | |||||
| 6732 | inde x = 0, | |||||
| 6733 | leng th = eleme nts.length ; | |||||
| 6734 | ||||||
| 6735 | fo r ( ; inde x < length ; index++ ) { | |||||
| 6736 | elem = element s[ index ] ; | |||||
| 6737 | if ( !elem.sty le ) { | |||||
| 6738 | contin ue; | |||||
| 6739 | } | |||||
| 6740 | ||||||
| 6741 | valu es[ index ] = jQuery ._data( el em, "olddi splay" ); | |||||
| 6742 | disp lay = elem .style.dis play; | |||||
| 6743 | if ( show ) { | |||||
| 6744 | // Res et the inl ine displa y of this element to learn if it is | |||||
| 6745 | // bei ng hidden by cascade d rules or not | |||||
| 6746 | if ( ! values[ in dex ] && d isplay === "none" ) { | |||||
| 6747 | elem.sty le.display = ""; | |||||
| 6748 | } | |||||
| 6749 | ||||||
| 6750 | // Set elements which have been over ridden wit h display: none | |||||
| 6751 | // in a styleshe et to what ever the d efault bro wser style is | |||||
| 6752 | // for such an e lement | |||||
| 6753 | if ( e lem.style. display == = "" && is Hidden( el em ) ) { | |||||
| 6754 | values[ index ] = jQuery._da ta( elem, "olddispla y", css_de faultDispl ay(elem.no deName) ); | |||||
| 6755 | } | |||||
| 6756 | } el se { | |||||
| 6757 | ||||||
| 6758 | if ( ! values[ in dex ] ) { | |||||
| 6759 | hidden = isHidden( elem ); | |||||
| 6760 | ||||||
| 6761 | if ( dis play && di splay !== "none" || !hidden ) { | |||||
| 6762 | jQuery._da ta( elem, "olddispla y", hidden ? display : jQuery. css( elem, "display" ) ); | |||||
| 6763 | } | |||||
| 6764 | } | |||||
| 6765 | } | |||||
| 6766 | } | |||||
| 6767 | ||||||
| 6768 | // Set the d isplay of most of th e elements in a seco nd loop | |||||
| 6769 | // to avoid the consta nt reflow | |||||
| 6770 | fo r ( index = 0; index < length; index++ ) { | |||||
| 6771 | elem = element s[ index ] ; | |||||
| 6772 | if ( !elem.sty le ) { | |||||
| 6773 | contin ue; | |||||
| 6774 | } | |||||
| 6775 | if ( !show || elem.style .display = == "none" || elem.st yle.displa y === "" ) { | |||||
| 6776 | elem.s tyle.displ ay = show ? values[ index ] || "" : "non e"; | |||||
| 6777 | } | |||||
| 6778 | } | |||||
| 6779 | ||||||
| 6780 | re turn eleme nts; | |||||
| 6781 | } | |||||
| 6782 | ||||||
| 6783 | jQuery.fn. extend({ | |||||
| 6784 | cs s: functio n( name, v alue ) { | |||||
| 6785 | retu rn jQuery. access( th is, functi on( elem, name, valu e ) { | |||||
| 6786 | var le n, styles, | |||||
| 6787 | map = {} , | |||||
| 6788 | i = 0; | |||||
| 6789 | ||||||
| 6790 | if ( j Query.isAr ray( name ) ) { | |||||
| 6791 | styles = getStyles ( elem ); | |||||
| 6792 | len = na me.length; | |||||
| 6793 | ||||||
| 6794 | for ( ; i < len; i ++ ) { | |||||
| 6795 | map[ name[ i ] ] = j Query.css( elem, nam e[ i ], fa lse, style s ); | |||||
| 6796 | } | |||||
| 6797 | ||||||
| 6798 | return m ap; | |||||
| 6799 | } | |||||
| 6800 | ||||||
| 6801 | return value !== undefined ? | |||||
| 6802 | jQuery.s tyle( elem , name, va lue ) : | |||||
| 6803 | jQuery.c ss( elem, name ); | |||||
| 6804 | }, n ame, value , argument s.length > 1 ); | |||||
| 6805 | }, | |||||
| 6806 | sh ow: functi on() { | |||||
| 6807 | retu rn showHid e( this, t rue ); | |||||
| 6808 | }, | |||||
| 6809 | hi de: functi on() { | |||||
| 6810 | retu rn showHid e( this ); | |||||
| 6811 | }, | |||||
| 6812 | to ggle: func tion( stat e ) { | |||||
| 6813 | var bool = typ eof state === "boole an"; | |||||
| 6814 | ||||||
| 6815 | retu rn this.ea ch(functio n() { | |||||
| 6816 | if ( b ool ? stat e : isHidd en( this ) ) { | |||||
| 6817 | jQuery( this ).sho w(); | |||||
| 6818 | } else { | |||||
| 6819 | jQuery( this ).hid e(); | |||||
| 6820 | } | |||||
| 6821 | }); | |||||
| 6822 | } | |||||
| 6823 | }); | |||||
| 6824 | ||||||
| 6825 | jQuery.ext end({ | |||||
| 6826 | // Add in st yle proper ty hooks f or overrid ing the de fault | |||||
| 6827 | // behavior of getting and setti ng a style property | |||||
| 6828 | cs sHooks: { | |||||
| 6829 | opac ity: { | |||||
| 6830 | get: f unction( e lem, compu ted ) { | |||||
| 6831 | if ( com puted ) { | |||||
| 6832 | // We shou ld always get a numb er back fr om opacity | |||||
| 6833 | var ret = curCSS( el em, "opaci ty" ); | |||||
| 6834 | return ret === "" ? "1" : ret; | |||||
| 6835 | } | |||||
| 6836 | } | |||||
| 6837 | } | |||||
| 6838 | }, | |||||
| 6839 | ||||||
| 6840 | // Exclude t he followi ng css pro perties to add px | |||||
| 6841 | cs sNumber: { | |||||
| 6842 | "col umnCount": true, | |||||
| 6843 | "fil lOpacity": true, | |||||
| 6844 | "fon tWeight": true, | |||||
| 6845 | "lin eHeight": true, | |||||
| 6846 | "opa city": tru e, | |||||
| 6847 | "orp hans": tru e, | |||||
| 6848 | "wid ows": true , | |||||
| 6849 | "zIn dex": true , | |||||
| 6850 | "zoo m": true | |||||
| 6851 | }, | |||||
| 6852 | ||||||
| 6853 | // Add in pr operties w hose names you wish to fix bef ore | |||||
| 6854 | // setting o r getting the value | |||||
| 6855 | cs sProps: { | |||||
| 6856 | // n ormalize f loat css p roperty | |||||
| 6857 | "flo at": jQuer y.support. cssFloat ? "cssFloat " : "style Float" | |||||
| 6858 | }, | |||||
| 6859 | ||||||
| 6860 | // Get and s et the sty le propert y on a DOM Node | |||||
| 6861 | st yle: funct ion( elem, name, val ue, extra ) { | |||||
| 6862 | // D on't set s tyles on t ext and co mment node s | |||||
| 6863 | if ( !elem || elem.nodeT ype === 3 || elem.no deType === 8 || !ele m.style ) { | |||||
| 6864 | return ; | |||||
| 6865 | } | |||||
| 6866 | ||||||
| 6867 | // M ake sure t hat we're working wi th the rig ht name | |||||
| 6868 | var ret, type, hooks, | |||||
| 6869 | origNa me = jQuer y.camelCas e( name ), | |||||
| 6870 | style = elem.sty le; | |||||
| 6871 | ||||||
| 6872 | name = jQuery. cssProps[ origName ] || ( jQue ry.cssProp s[ origNam e ] = vend orPropName ( style, o rigName ) ); | |||||
| 6873 | ||||||
| 6874 | // g ets hook f or the pre fixed vers ion | |||||
| 6875 | // f ollowed by the unpre fixed vers ion | |||||
| 6876 | hook s = jQuery .cssHooks[ name ] || jQuery.cs sHooks[ or igName ]; | |||||
| 6877 | ||||||
| 6878 | // C heck if we 're settin g a value | |||||
| 6879 | if ( value !== undefined ) { | |||||
| 6880 | type = typeof va lue; | |||||
| 6881 | ||||||
| 6882 | // con vert relat ive number strings ( += or -=) to relativ e numbers. #7345 | |||||
| 6883 | if ( t ype === "s tring" && (ret = rre lNum.exec( value )) ) { | |||||
| 6884 | value = ( ret[1] + 1 ) * ret [2] + pars eFloat( jQ uery.css( elem, name ) ); | |||||
| 6885 | // Fixes bug #9237 | |||||
| 6886 | type = " number"; | |||||
| 6887 | } | |||||
| 6888 | ||||||
| 6889 | // Mak e sure tha t NaN and null value s aren't s et. See: # 7116 | |||||
| 6890 | if ( v alue == nu ll || type === "numb er" && isN aN( value ) ) { | |||||
| 6891 | return; | |||||
| 6892 | } | |||||
| 6893 | ||||||
| 6894 | // If a number w as passed in, add 'p x' to the (except fo r certain CSS proper ties) | |||||
| 6895 | if ( t ype === "n umber" && !jQuery.cs sNumber[ o rigName ] ) { | |||||
| 6896 | value += "px"; | |||||
| 6897 | } | |||||
| 6898 | ||||||
| 6899 | // Fix es #8908, it can be done more correctly by specifi ng setters in cssHoo ks, | |||||
| 6900 | // but it would mean to de fine eight (for ever y problema tic proper ty) identi cal functi ons | |||||
| 6901 | if ( ! jQuery.sup port.clear CloneStyle && value === "" && name.index Of("backgr ound") === 0 ) { | |||||
| 6902 | style[ n ame ] = "i nherit"; | |||||
| 6903 | } | |||||
| 6904 | ||||||
| 6905 | // If a hook was provided, use that value, oth erwise jus t set the specified value | |||||
| 6906 | if ( ! hooks || ! ("set" in hooks) || (value = h ooks.set( elem, valu e, extra ) ) !== unde fined ) { | |||||
| 6907 | ||||||
| 6908 | // Wrapp ed to prev ent IE fro m throwing errors wh en 'invali d' values are provid ed | |||||
| 6909 | // Fixes bug #5509 | |||||
| 6910 | try { | |||||
| 6911 | style[ nam e ] = valu e; | |||||
| 6912 | } catch( e) {} | |||||
| 6913 | } | |||||
| 6914 | ||||||
| 6915 | } el se { | |||||
| 6916 | // If a hook was provided get the no n-computed value fro m there | |||||
| 6917 | if ( h ooks && "g et" in hoo ks && (ret = hooks.g et( elem, false, ext ra )) !== undefined ) { | |||||
| 6918 | return r et; | |||||
| 6919 | } | |||||
| 6920 | ||||||
| 6921 | // Oth erwise jus t get the value from the style object | |||||
| 6922 | return style[ na me ]; | |||||
| 6923 | } | |||||
| 6924 | }, | |||||
| 6925 | ||||||
| 6926 | cs s: functio n( elem, n ame, extra , styles ) { | |||||
| 6927 | var num, val, hooks, | |||||
| 6928 | origNa me = jQuer y.camelCas e( name ); | |||||
| 6929 | ||||||
| 6930 | // M ake sure t hat we're working wi th the rig ht name | |||||
| 6931 | name = jQuery. cssProps[ origName ] || ( jQue ry.cssProp s[ origNam e ] = vend orPropName ( elem.sty le, origNa me ) ); | |||||
| 6932 | ||||||
| 6933 | // g ets hook f or the pre fixed vers ion | |||||
| 6934 | // f ollowed by the unpre fixed vers ion | |||||
| 6935 | hook s = jQuery .cssHooks[ name ] || jQuery.cs sHooks[ or igName ]; | |||||
| 6936 | ||||||
| 6937 | // I f a hook w as provide d get the computed v alue from there | |||||
| 6938 | if ( hooks && "get" in h ooks ) { | |||||
| 6939 | val = hooks.get( elem, tru e, extra ) ; | |||||
| 6940 | } | |||||
| 6941 | ||||||
| 6942 | // O therwise, if a way t o get the computed v alue exist s, use tha t | |||||
| 6943 | if ( val === u ndefined ) { | |||||
| 6944 | val = curCSS( el em, name, styles ); | |||||
| 6945 | } | |||||
| 6946 | ||||||
| 6947 | //co nvert "nor mal" to co mputed val ue | |||||
| 6948 | if ( val === " normal" && name in c ssNormalTr ansform ) { | |||||
| 6949 | val = cssNormalT ransform[ name ]; | |||||
| 6950 | } | |||||
| 6951 | ||||||
| 6952 | // R eturn, con verting to number if forced or a qualifi er was pro vided and val looks numeric | |||||
| 6953 | if ( extra === "" || ext ra ) { | |||||
| 6954 | num = parseFloat ( val ); | |||||
| 6955 | return extra === true || j Query.isNu meric( num ) ? num | | 0 : val; | |||||
| 6956 | } | |||||
| 6957 | retu rn val; | |||||
| 6958 | }, | |||||
| 6959 | ||||||
| 6960 | // A method for quickl y swapping in/out CS S properti es to get correct ca lculations | |||||
| 6961 | sw ap: functi on( elem, options, c allback, a rgs ) { | |||||
| 6962 | var ret, name, | |||||
| 6963 | old = {}; | |||||
| 6964 | ||||||
| 6965 | // R emember th e old valu es, and in sert the n ew ones | |||||
| 6966 | for ( name in options ) { | |||||
| 6967 | old[ n ame ] = el em.style[ name ]; | |||||
| 6968 | elem.s tyle[ name ] = optio ns[ name ] ; | |||||
| 6969 | } | |||||
| 6970 | ||||||
| 6971 | ret = callback .apply( el em, args | | [] ); | |||||
| 6972 | ||||||
| 6973 | // R evert the old values | |||||
| 6974 | for ( name in options ) { | |||||
| 6975 | elem.s tyle[ name ] = old[ name ]; | |||||
| 6976 | } | |||||
| 6977 | ||||||
| 6978 | retu rn ret; | |||||
| 6979 | } | |||||
| 6980 | }); | |||||
| 6981 | ||||||
| 6982 | // NOTE: w e've inclu ded the "w indow" in window.get ComputedSt yle | |||||
| 6983 | // because jsdom on node.js wi ll break w ithout it. | |||||
| 6984 | if ( windo w.getCompu tedStyle ) { | |||||
| 6985 | ge tStyles = function( elem ) { | |||||
| 6986 | retu rn window. getCompute dStyle( el em, null ) ; | |||||
| 6987 | }; | |||||
| 6988 | ||||||
| 6989 | cu rCSS = fun ction( ele m, name, _ computed ) { | |||||
| 6990 | var width, min Width, max Width, | |||||
| 6991 | comput ed = _comp uted || ge tStyles( e lem ), | |||||
| 6992 | ||||||
| 6993 | // get PropertyVa lue is onl y needed f or .css('f ilter') in IE9, see #12537 | |||||
| 6994 | ret = computed ? computed. getPropert yValue( na me ) || co mputed[ na me ] : und efined, | |||||
| 6995 | style = elem.sty le; | |||||
| 6996 | ||||||
| 6997 | if ( computed ) { | |||||
| 6998 | ||||||
| 6999 | if ( r et === "" && !jQuery .contains( elem.owne rDocument, elem ) ) { | |||||
| 7000 | ret = jQ uery.style ( elem, na me ); | |||||
| 7001 | } | |||||
| 7002 | ||||||
| 7003 | // A t ribute to the "aweso me hack by Dean Edwa rds" | |||||
| 7004 | // Chr ome < 17 a nd Safari 5.0 uses " computed v alue" inst ead of "us ed value" for margin -right | |||||
| 7005 | // Saf ari 5.1.7 (at least) returns p ercentage for a larg er set of values, bu t width se ems to be reliably p ixels | |||||
| 7006 | // thi s is again st the CSS OM draft s pec: http: //dev.w3.o rg/csswg/c ssom/#reso lved-value s | |||||
| 7007 | if ( r numnonpx.t est( ret ) && rmargi n.test( na me ) ) { | |||||
| 7008 | ||||||
| 7009 | // Remem ber the or iginal val ues | |||||
| 7010 | width = style.widt h; | |||||
| 7011 | minWidth = style.m inWidth; | |||||
| 7012 | maxWidth = style.m axWidth; | |||||
| 7013 | ||||||
| 7014 | // Put i n the new values to get a comp uted value out | |||||
| 7015 | style.mi nWidth = s tyle.maxWi dth = styl e.width = ret; | |||||
| 7016 | ret = co mputed.wid th; | |||||
| 7017 | ||||||
| 7018 | // Rever t the chan ged values | |||||
| 7019 | style.wi dth = widt h; | |||||
| 7020 | style.mi nWidth = m inWidth; | |||||
| 7021 | style.ma xWidth = m axWidth; | |||||
| 7022 | } | |||||
| 7023 | } | |||||
| 7024 | ||||||
| 7025 | retu rn ret; | |||||
| 7026 | }; | |||||
| 7027 | } else if ( document .documentE lement.cur rentStyle ) { | |||||
| 7028 | ge tStyles = function( elem ) { | |||||
| 7029 | retu rn elem.cu rrentStyle ; | |||||
| 7030 | }; | |||||
| 7031 | ||||||
| 7032 | cu rCSS = fun ction( ele m, name, _ computed ) { | |||||
| 7033 | var left, rs, rsLeft, | |||||
| 7034 | comput ed = _comp uted || ge tStyles( e lem ), | |||||
| 7035 | ret = computed ? computed[ name ] : undefined, | |||||
| 7036 | style = elem.sty le; | |||||
| 7037 | ||||||
| 7038 | // A void setti ng ret to empty stri ng here | |||||
| 7039 | // s o we don't default t o auto | |||||
| 7040 | if ( ret == nu ll && styl e && style [ name ] ) { | |||||
| 7041 | ret = style[ nam e ]; | |||||
| 7042 | } | |||||
| 7043 | ||||||
| 7044 | // F rom the aw esome hack by Dean E dwards | |||||
| 7045 | // h ttp://erik .eae.net/a rchives/20 07/07/27/1 8.54.15/#c omment-102 291 | |||||
| 7046 | ||||||
| 7047 | // I f we're no t dealing with a reg ular pixel number | |||||
| 7048 | // b ut a numbe r that has a weird e nding, we need to co nvert it t o pixels | |||||
| 7049 | // b ut not pos ition css attributes , as those are propo rtional to the paren t element instead | |||||
| 7050 | // a nd we can' t measure the parent instead b ecause it might trig ger a "sta cking doll s" problem | |||||
| 7051 | if ( rnumnonpx .test( ret ) && !rpo sition.tes t( name ) ) { | |||||
| 7052 | ||||||
| 7053 | // Rem ember the original v alues | |||||
| 7054 | left = style.lef t; | |||||
| 7055 | rs = e lem.runtim eStyle; | |||||
| 7056 | rsLeft = rs && r s.left; | |||||
| 7057 | ||||||
| 7058 | // Put in the ne w values t o get a co mputed val ue out | |||||
| 7059 | if ( r sLeft ) { | |||||
| 7060 | rs.left = elem.cur rentStyle. left; | |||||
| 7061 | } | |||||
| 7062 | style. left = nam e === "fon tSize" ? " 1em" : ret ; | |||||
| 7063 | ret = style.pixe lLeft + "p x"; | |||||
| 7064 | ||||||
| 7065 | // Rev ert the ch anged valu es | |||||
| 7066 | style. left = lef t; | |||||
| 7067 | if ( r sLeft ) { | |||||
| 7068 | rs.left = rsLeft; | |||||
| 7069 | } | |||||
| 7070 | } | |||||
| 7071 | ||||||
| 7072 | retu rn ret === "" ? "aut o" : ret; | |||||
| 7073 | }; | |||||
| 7074 | } | |||||
| 7075 | ||||||
| 7076 | function s etPositive Number( el em, value, subtract ) { | |||||
| 7077 | va r matches = rnumspli t.exec( va lue ); | |||||
| 7078 | re turn match es ? | |||||
| 7079 | // G uard again st undefin ed "subtra ct", e.g., when used as in css Hooks | |||||
| 7080 | Math .max( 0, m atches[ 1 ] - ( subt ract || 0 ) ) + ( ma tches[ 2 ] || "px" ) : | |||||
| 7081 | valu e; | |||||
| 7082 | } | |||||
| 7083 | ||||||
| 7084 | function a ugmentWidt hOrHeight( elem, nam e, extra, isBorderBo x, styles ) { | |||||
| 7085 | va r i = extr a === ( is BorderBox ? "border" : "conten t" ) ? | |||||
| 7086 | // I f we alrea dy have th e right me asurement, avoid aug mentation | |||||
| 7087 | 4 : | |||||
| 7088 | // O therwise i nitialize for horizo ntal or ve rtical pro perties | |||||
| 7089 | name === "widt h" ? 1 : 0 , | |||||
| 7090 | ||||||
| 7091 | val = 0; | |||||
| 7092 | ||||||
| 7093 | fo r ( ; i < 4; i += 2 ) { | |||||
| 7094 | // b oth box mo dels exclu de margin, so add it if we wan t it | |||||
| 7095 | if ( extra === "margin" ) { | |||||
| 7096 | val += jQuery.cs s( elem, e xtra + css Expand[ i ], true, s tyles ); | |||||
| 7097 | } | |||||
| 7098 | ||||||
| 7099 | if ( isBorderB ox ) { | |||||
| 7100 | // bor der-box in cludes pad ding, so r emove it i f we want content | |||||
| 7101 | if ( e xtra === " content" ) { | |||||
| 7102 | val -= j Query.css( elem, "pa dding" + c ssExpand[ i ], true, styles ); | |||||
| 7103 | } | |||||
| 7104 | ||||||
| 7105 | // at this point , extra is n't border nor margi n, so remo ve border | |||||
| 7106 | if ( e xtra !== " margin" ) { | |||||
| 7107 | val -= j Query.css( elem, "bo rder" + cs sExpand[ i ] + "Widt h", true, styles ); | |||||
| 7108 | } | |||||
| 7109 | } el se { | |||||
| 7110 | // at this point , extra is n't conten t, so add padding | |||||
| 7111 | val += jQuery.cs s( elem, " padding" + cssExpand [ i ], tru e, styles ); | |||||
| 7112 | ||||||
| 7113 | // at this point , extra is n't conten t nor padd ing, so ad d border | |||||
| 7114 | if ( e xtra !== " padding" ) { | |||||
| 7115 | val += j Query.css( elem, "bo rder" + cs sExpand[ i ] + "Widt h", true, styles ); | |||||
| 7116 | } | |||||
| 7117 | } | |||||
| 7118 | } | |||||
| 7119 | ||||||
| 7120 | re turn val; | |||||
| 7121 | } | |||||
| 7122 | ||||||
| 7123 | function g etWidthOrH eight( ele m, name, e xtra ) { | |||||
| 7124 | ||||||
| 7125 | // Start wit h offset p roperty, w hich is eq uivalent t o the bord er-box val ue | |||||
| 7126 | va r valueIsB orderBox = true, | |||||
| 7127 | val = name === "width" ? elem.offs etWidth : elem.offse tHeight, | |||||
| 7128 | styl es = getSt yles( elem ), | |||||
| 7129 | isBo rderBox = jQuery.sup port.boxSi zing && jQ uery.css( elem, "box Sizing", f alse, styl es ) === " border-box "; | |||||
| 7130 | ||||||
| 7131 | // some non- html eleme nts return undefined for offse tWidth, so check for null/unde fined | |||||
| 7132 | // svg - htt ps://bugzi lla.mozill a.org/show _bug.cgi?i d=649285 | |||||
| 7133 | // MathML - https://bu gzilla.moz illa.org/s how_bug.cg i?id=49166 8 | |||||
| 7134 | if ( val <= 0 || val = = null ) { | |||||
| 7135 | // F all back t o computed then unco mputed css if necess ary | |||||
| 7136 | val = curCSS( elem, name , styles ) ; | |||||
| 7137 | if ( val < 0 | | val == n ull ) { | |||||
| 7138 | val = elem.style [ name ]; | |||||
| 7139 | } | |||||
| 7140 | ||||||
| 7141 | // C omputed un it is not pixels. St op here an d return. | |||||
| 7142 | if ( rnumnonpx .test(val) ) { | |||||
| 7143 | return val; | |||||
| 7144 | } | |||||
| 7145 | ||||||
| 7146 | // w e need the check for style in case a bro wser which returns u nreliable values | |||||
| 7147 | // f or getComp utedStyle silently f alls back to the rel iable elem .style | |||||
| 7148 | valu eIsBorderB ox = isBor derBox && ( jQuery.s upport.box SizingReli able || va l === elem .style[ na me ] ); | |||||
| 7149 | ||||||
| 7150 | // N ormalize " ", auto, a nd prepare for extra | |||||
| 7151 | val = parseFlo at( val ) || 0; | |||||
| 7152 | } | |||||
| 7153 | ||||||
| 7154 | // use the a ctive box- sizing mod el to add/ subtract i rrelevant styles | |||||
| 7155 | re turn ( val + | |||||
| 7156 | augm entWidthOr Height( | |||||
| 7157 | elem, | |||||
| 7158 | name, | |||||
| 7159 | extra || ( isBor derBox ? " border" : "content" ), | |||||
| 7160 | valueI sBorderBox , | |||||
| 7161 | styles | |||||
| 7162 | ) | |||||
| 7163 | ) + "px"; | |||||
| 7164 | } | |||||
| 7165 | ||||||
| 7166 | // Try to determine the defaul t display value of a n element | |||||
| 7167 | function c ss_default Display( n odeName ) { | |||||
| 7168 | va r doc = do cument, | |||||
| 7169 | disp lay = elem display[ n odeName ]; | |||||
| 7170 | ||||||
| 7171 | if ( !displa y ) { | |||||
| 7172 | disp lay = actu alDisplay( nodeName, doc ); | |||||
| 7173 | ||||||
| 7174 | // I f the simp le way fai ls, read f rom inside an iframe | |||||
| 7175 | if ( display = == "none" || !displa y ) { | |||||
| 7176 | // Use the alrea dy-created iframe if possible | |||||
| 7177 | iframe = ( ifram e || | |||||
| 7178 | jQuery(" <iframe fr ameborder= '0' width= '0' height ='0'/>") | |||||
| 7179 | .css( "c ssText", " display:bl ock !impor tant" ) | |||||
| 7180 | ).appe ndTo( doc. documentEl ement ); | |||||
| 7181 | ||||||
| 7182 | // Alw ays write a new HTML skeleton so Webkit and Firefo x don't ch oke on reu se | |||||
| 7183 | doc = ( iframe[0 ].contentW indow || i frame[0].c ontentDocu ment ).doc ument; | |||||
| 7184 | doc.wr ite("<!doc type html> <html><bod y>"); | |||||
| 7185 | doc.cl ose(); | |||||
| 7186 | ||||||
| 7187 | displa y = actual Display( n odeName, d oc ); | |||||
| 7188 | iframe .detach(); | |||||
| 7189 | } | |||||
| 7190 | ||||||
| 7191 | // S tore the c orrect def ault displ ay | |||||
| 7192 | elem display[ n odeName ] = display; | |||||
| 7193 | } | |||||
| 7194 | ||||||
| 7195 | re turn displ ay; | |||||
| 7196 | } | |||||
| 7197 | ||||||
| 7198 | // Called ONLY from within css _defaultDi splay | |||||
| 7199 | function a ctualDispl ay( name, doc ) { | |||||
| 7200 | va r elem = j Query( doc .createEle ment( name ) ).appen dTo( doc.b ody ), | |||||
| 7201 | disp lay = jQue ry.css( el em[0], "di splay" ); | |||||
| 7202 | el em.remove( ); | |||||
| 7203 | re turn displ ay; | |||||
| 7204 | } | |||||
| 7205 | ||||||
| 7206 | jQuery.eac h([ "heigh t", "width " ], funct ion( i, na me ) { | |||||
| 7207 | jQ uery.cssHo oks[ name ] = { | |||||
| 7208 | get: function( elem, com puted, ext ra ) { | |||||
| 7209 | if ( c omputed ) { | |||||
| 7210 | // certa in element s can have dimension info if w e invisibl y show the m | |||||
| 7211 | // howev er, it mus t have a c urrent dis play style that woul d benefit from this | |||||
| 7212 | return e lem.offset Width === 0 && rdisp layswap.te st( jQuery .css( elem , "display " ) ) ? | |||||
| 7213 | jQuery.swa p( elem, c ssShow, fu nction() { | |||||
| 7214 | re turn getWi dthOrHeigh t( elem, n ame, extra ); | |||||
| 7215 | }) : | |||||
| 7216 | getWidthOr Height( el em, name, extra ); | |||||
| 7217 | } | |||||
| 7218 | }, | |||||
| 7219 | ||||||
| 7220 | set: function( elem, val ue, extra ) { | |||||
| 7221 | var st yles = ext ra && getS tyles( ele m ); | |||||
| 7222 | return setPositi veNumber( elem, valu e, extra ? | |||||
| 7223 | augmentW idthOrHeig ht( | |||||
| 7224 | elem, | |||||
| 7225 | name, | |||||
| 7226 | extra, | |||||
| 7227 | jQuery.sup port.boxSi zing && jQ uery.css( elem, "box Sizing", f alse, styl es ) === " border-box ", | |||||
| 7228 | styles | |||||
| 7229 | ) : 0 | |||||
| 7230 | ); | |||||
| 7231 | } | |||||
| 7232 | }; | |||||
| 7233 | }); | |||||
| 7234 | ||||||
| 7235 | if ( !jQue ry.support .opacity ) { | |||||
| 7236 | jQ uery.cssHo oks.opacit y = { | |||||
| 7237 | get: function( elem, com puted ) { | |||||
| 7238 | // IE uses filte rs for opa city | |||||
| 7239 | return ropacity. test( (com puted && e lem.curren tStyle ? e lem.curren tStyle.fil ter : elem .style.fil ter) || "" ) ? | |||||
| 7240 | ( 0.01 * parseFloa t( RegExp. $1 ) ) + " " : | |||||
| 7241 | computed ? "1" : " "; | |||||
| 7242 | }, | |||||
| 7243 | ||||||
| 7244 | set: function( elem, val ue ) { | |||||
| 7245 | var st yle = elem .style, | |||||
| 7246 | currentS tyle = ele m.currentS tyle, | |||||
| 7247 | opacity = jQuery.i sNumeric( value ) ? "alpha(opa city=" + v alue * 100 + ")" : " ", | |||||
| 7248 | filter = currentSt yle && cur rentStyle. filter || style.filt er || ""; | |||||
| 7249 | ||||||
| 7250 | // IE has troubl e with opa city if it does not have layou t | |||||
| 7251 | // For ce it by s etting the zoom leve l | |||||
| 7252 | style. zoom = 1; | |||||
| 7253 | ||||||
| 7254 | // if setting op acity to 1 , and no o ther filte rs exist - attempt t o remove f ilter attr ibute #665 2 | |||||
| 7255 | // if value === "", then r emove inli ne opacity #12685 | |||||
| 7256 | if ( ( value >= 1 || value === "" ) && | |||||
| 7257 | jQuery.tri m( filter. replace( r alpha, "" ) ) === "" && | |||||
| 7258 | style.remo veAttribut e ) { | |||||
| 7259 | ||||||
| 7260 | // Setti ng style.f ilter to n ull, "" & " " still leave "fil ter:" in t he cssText | |||||
| 7261 | // if "f ilter:" is present a t all, cle arType is disabled, we want to avoid thi s | |||||
| 7262 | // style .removeAtt ribute is IE Only, b ut so appa rently is this code path... | |||||
| 7263 | style.re moveAttrib ute( "filt er" ); | |||||
| 7264 | ||||||
| 7265 | // if th ere is no filter sty le applied in a css rule or un set inline opacity, we are don e | |||||
| 7266 | if ( val ue === "" || current Style && ! currentSty le.filter ) { | |||||
| 7267 | return; | |||||
| 7268 | } | |||||
| 7269 | } | |||||
| 7270 | ||||||
| 7271 | // oth erwise, se t new filt er values | |||||
| 7272 | style. filter = r alpha.test ( filter ) ? | |||||
| 7273 | filter.r eplace( ra lpha, opac ity ) : | |||||
| 7274 | filter + " " + opa city; | |||||
| 7275 | } | |||||
| 7276 | }; | |||||
| 7277 | } | |||||
| 7278 | ||||||
| 7279 | // These h ooks canno t be added until DOM ready bec ause the s upport tes t | |||||
| 7280 | // for it is not run until aft er DOM rea dy | |||||
| 7281 | jQuery(fun ction() { | |||||
| 7282 | if ( !jQuery .support.r eliableMar ginRight ) { | |||||
| 7283 | jQue ry.cssHook s.marginRi ght = { | |||||
| 7284 | get: f unction( e lem, compu ted ) { | |||||
| 7285 | if ( com puted ) { | |||||
| 7286 | // WebKit Bug 13343 - getCompu tedStyle r eturns wro ng value f or margin- right | |||||
| 7287 | // Work ar ound by te mporarily setting el ement disp lay to inl ine-block | |||||
| 7288 | return jQu ery.swap( elem, { "d isplay": " inline-blo ck" }, | |||||
| 7289 | cu rCSS, [ el em, "margi nRight" ] ); | |||||
| 7290 | } | |||||
| 7291 | } | |||||
| 7292 | }; | |||||
| 7293 | } | |||||
| 7294 | ||||||
| 7295 | // Webkit bu g: https:/ /bugs.webk it.org/sho w_bug.cgi? id=29084 | |||||
| 7296 | // getComput edStyle re turns perc ent when s pecified f or top/lef t/bottom/r ight | |||||
| 7297 | // rather th an make th e css modu le depend on the off set module , we just check for it here | |||||
| 7298 | if ( !jQuery .support.p ixelPositi on && jQue ry.fn.posi tion ) { | |||||
| 7299 | jQue ry.each( [ "top", "l eft" ], fu nction( i, prop ) { | |||||
| 7300 | jQuery .cssHooks[ prop ] = { | |||||
| 7301 | get: fun ction( ele m, compute d ) { | |||||
| 7302 | if ( compu ted ) { | |||||
| 7303 | co mputed = c urCSS( ele m, prop ); | |||||
| 7304 | // if curCSS returns p ercentage, fallback to offset | |||||
| 7305 | re turn rnumn onpx.test( computed ) ? | |||||
| 7306 | jQue ry( elem ) .position( )[ prop ] + "px" : | |||||
| 7307 | comp uted; | |||||
| 7308 | } | |||||
| 7309 | } | |||||
| 7310 | }; | |||||
| 7311 | }); | |||||
| 7312 | } | |||||
| 7313 | ||||||
| 7314 | }); | |||||
| 7315 | ||||||
| 7316 | if ( jQuer y.expr && jQuery.exp r.filters ) { | |||||
| 7317 | jQ uery.expr. filters.hi dden = fun ction( ele m ) { | |||||
| 7318 | // S upport: Op era <= 12. 12 | |||||
| 7319 | // O pera repor ts offsetW idths and offsetHeig hts less t han zero o n some ele ments | |||||
| 7320 | retu rn elem.of fsetWidth <= 0 && el em.offsetH eight <= 0 || | |||||
| 7321 | (!jQue ry.support .reliableH iddenOffse ts && ((el em.style & & elem.sty le.display ) || jQuer y.css( ele m, "displa y" )) === "none"); | |||||
| 7322 | }; | |||||
| 7323 | ||||||
| 7324 | jQ uery.expr. filters.vi sible = fu nction( el em ) { | |||||
| 7325 | retu rn !jQuery .expr.filt ers.hidden ( elem ); | |||||
| 7326 | }; | |||||
| 7327 | } | |||||
| 7328 | ||||||
| 7329 | // These h ooks are u sed by ani mate to ex pand prope rties | |||||
| 7330 | jQuery.eac h({ | |||||
| 7331 | ma rgin: "", | |||||
| 7332 | pa dding: "", | |||||
| 7333 | bo rder: "Wid th" | |||||
| 7334 | }, functio n( prefix, suffix ) { | |||||
| 7335 | jQ uery.cssHo oks[ prefi x + suffix ] = { | |||||
| 7336 | expa nd: functi on( value ) { | |||||
| 7337 | var i = 0, | |||||
| 7338 | expanded = {}, | |||||
| 7339 | ||||||
| 7340 | // assum es a singl e number i f not a st ring | |||||
| 7341 | parts = typeof val ue === "st ring" ? va lue.split( " ") : [ v alue ]; | |||||
| 7342 | ||||||
| 7343 | for ( ; i < 4; i ++ ) { | |||||
| 7344 | expanded [ prefix + cssExpand [ i ] + su ffix ] = | |||||
| 7345 | parts[ i ] || parts[ i - 2 ] | | parts[ 0 ]; | |||||
| 7346 | } | |||||
| 7347 | ||||||
| 7348 | return expanded; | |||||
| 7349 | } | |||||
| 7350 | }; | |||||
| 7351 | ||||||
| 7352 | if ( !rmargi n.test( pr efix ) ) { | |||||
| 7353 | jQue ry.cssHook s[ prefix + suffix ] .set = set PositiveNu mber; | |||||
| 7354 | } | |||||
| 7355 | }); | |||||
| 7356 | var r20 = /%20/g, | |||||
| 7357 | rb racket = / \[\]$/, | |||||
| 7358 | rC RLF = /\r? \n/g, | |||||
| 7359 | rs ubmitterTy pes = /^(? :submit|bu tton|image |reset|fil e)$/i, | |||||
| 7360 | rs ubmittable = /^(?:in put|select |textarea| keygen)/i; | |||||
| 7361 | ||||||
| 7362 | jQuery.fn. extend({ | |||||
| 7363 | se rialize: f unction() { | |||||
| 7364 | retu rn jQuery. param( thi s.serializ eArray() ) ; | |||||
| 7365 | }, | |||||
| 7366 | se rializeArr ay: functi on() { | |||||
| 7367 | retu rn this.ma p(function (){ | |||||
| 7368 | // Can add propH ook for "e lements" t o filter o r add form elements | |||||
| 7369 | var el ements = j Query.prop ( this, "e lements" ) ; | |||||
| 7370 | return elements ? jQuery.m akeArray( elements ) : this; | |||||
| 7371 | }) | |||||
| 7372 | .fil ter(functi on(){ | |||||
| 7373 | var ty pe = this. type; | |||||
| 7374 | // Use .is(":dis abled") so that fiel dset[disab led] works | |||||
| 7375 | return this.name && !jQuer y( this ). is( ":disa bled" ) && | |||||
| 7376 | rsubmitt able.test( this.node Name ) && !rsubmitte rTypes.tes t( type ) && | |||||
| 7377 | ( this.c hecked || !manipulat ion_rcheck ableType.t est( type ) ); | |||||
| 7378 | }) | |||||
| 7379 | .map (function( i, elem ) { | |||||
| 7380 | var va l = jQuery ( this ).v al(); | |||||
| 7381 | ||||||
| 7382 | return val == nu ll ? | |||||
| 7383 | null : | |||||
| 7384 | jQuery.i sArray( va l ) ? | |||||
| 7385 | jQuery.map ( val, fun ction( val ){ | |||||
| 7386 | re turn { nam e: elem.na me, value: val.repla ce( rCRLF, "\r\n" ) }; | |||||
| 7387 | }) : | |||||
| 7388 | { name: el em.name, v alue: val. replace( r CRLF, "\r\ n" ) }; | |||||
| 7389 | }).g et(); | |||||
| 7390 | } | |||||
| 7391 | }); | |||||
| 7392 | ||||||
| 7393 | //Serializ e an array of form e lements or a set of | |||||
| 7394 | //key/valu es into a query stri ng | |||||
| 7395 | jQuery.par am = funct ion( a, tr aditional ) { | |||||
| 7396 | va r prefix, | |||||
| 7397 | s = [], | |||||
| 7398 | add = function ( key, val ue ) { | |||||
| 7399 | // If value is a function, invoke it and retur n its valu e | |||||
| 7400 | value = jQuery.i sFunction( value ) ? value() : ( value = = null ? " " : value ); | |||||
| 7401 | s[ s.l ength ] = encodeURIC omponent( key ) + "= " + encode URICompone nt( value ); | |||||
| 7402 | }; | |||||
| 7403 | ||||||
| 7404 | // Set tradi tional to true for j Query <= 1 .3.2 behav ior. | |||||
| 7405 | if ( traditi onal === u ndefined ) { | |||||
| 7406 | trad itional = jQuery.aja xSettings && jQuery. ajaxSettin gs.traditi onal; | |||||
| 7407 | } | |||||
| 7408 | ||||||
| 7409 | // If an arr ay was pas sed in, as sume that it is an a rray of fo rm element s. | |||||
| 7410 | if ( jQuery. isArray( a ) || ( a. jquery && !jQuery.is PlainObjec t( a ) ) ) { | |||||
| 7411 | // S erialize t he form el ements | |||||
| 7412 | jQue ry.each( a , function () { | |||||
| 7413 | add( t his.name, this.value ); | |||||
| 7414 | }); | |||||
| 7415 | ||||||
| 7416 | } else { | |||||
| 7417 | // I f traditio nal, encod e the "old " way (the way 1.3.2 or older | |||||
| 7418 | // d id it), ot herwise en code param s recursiv ely. | |||||
| 7419 | for ( prefix i n a ) { | |||||
| 7420 | buildP arams( pre fix, a[ pr efix ], tr aditional, add ); | |||||
| 7421 | } | |||||
| 7422 | } | |||||
| 7423 | ||||||
| 7424 | // Return th e resultin g serializ ation | |||||
| 7425 | re turn s.joi n( "&" ).r eplace( r2 0, "+" ); | |||||
| 7426 | }; | |||||
| 7427 | ||||||
| 7428 | function b uildParams ( prefix, obj, tradi tional, ad d ) { | |||||
| 7429 | va r name; | |||||
| 7430 | ||||||
| 7431 | if ( jQuery. isArray( o bj ) ) { | |||||
| 7432 | // S erialize a rray item. | |||||
| 7433 | jQue ry.each( o bj, functi on( i, v ) { | |||||
| 7434 | if ( t raditional || rbrack et.test( p refix ) ) { | |||||
| 7435 | // Treat each arra y item as a scalar. | |||||
| 7436 | add( pre fix, v ); | |||||
| 7437 | ||||||
| 7438 | } else { | |||||
| 7439 | // Item is non-sca lar (array or object ), encode its numeri c index. | |||||
| 7440 | buildPar ams( prefi x + "[" + ( typeof v === "obje ct" ? i : "" ) + "]" , v, tradi tional, ad d ); | |||||
| 7441 | } | |||||
| 7442 | }); | |||||
| 7443 | ||||||
| 7444 | } else if ( !tradition al && jQue ry.type( o bj ) === " object" ) { | |||||
| 7445 | // S erialize o bject item . | |||||
| 7446 | for ( name in obj ) { | |||||
| 7447 | buildP arams( pre fix + "[" + name + " ]", obj[ n ame ], tra ditional, add ); | |||||
| 7448 | } | |||||
| 7449 | ||||||
| 7450 | } else { | |||||
| 7451 | // S erialize s calar item . | |||||
| 7452 | add( prefix, o bj ); | |||||
| 7453 | } | |||||
| 7454 | } | |||||
| 7455 | jQuery.eac h( ("blur focus focu sin focuso ut load re size scrol l unload c lick dblcl ick " + | |||||
| 7456 | "m ousedown m ouseup mou semove mou seover mou seout mous eenter mou seleave " + | |||||
| 7457 | "c hange sele ct submit keydown ke ypress key up error c ontextmenu ").split(" "), funct ion( i, na me ) { | |||||
| 7458 | ||||||
| 7459 | // Handle ev ent bindin g | |||||
| 7460 | jQ uery.fn[ n ame ] = fu nction( da ta, fn ) { | |||||
| 7461 | retu rn argumen ts.length > 0 ? | |||||
| 7462 | this.o n( name, n ull, data, fn ) : | |||||
| 7463 | this.t rigger( na me ); | |||||
| 7464 | }; | |||||
| 7465 | }); | |||||
| 7466 | ||||||
| 7467 | jQuery.fn. hover = fu nction( fn Over, fnOu t ) { | |||||
| 7468 | re turn this. mouseenter ( fnOver ) .mouseleav e( fnOut | | fnOver ) ; | |||||
| 7469 | }; | |||||
| 7470 | var | |||||
| 7471 | // Document location | |||||
| 7472 | aj axLocParts , | |||||
| 7473 | aj axLocation , | |||||
| 7474 | aj ax_nonce = jQuery.no w(), | |||||
| 7475 | ||||||
| 7476 | aj ax_rquery = /\?/, | |||||
| 7477 | rh ash = /#.* $/, | |||||
| 7478 | rt s = /([?&] )_=[^&]*/, | |||||
| 7479 | rh eaders = / ^(.*?):[ \ t]*([^\r\n ]*)\r?$/mg , // IE le aves an \r character at EOL | |||||
| 7480 | // #7653, #8 125, #8152 : local pr otocol det ection | |||||
| 7481 | rl ocalProtoc ol = /^(?: about|app| app-storag e|.+-exten sion|file| res|widget ):$/, | |||||
| 7482 | rn oContent = /^(?:GET| HEAD)$/, | |||||
| 7483 | rp rotocol = /^\/\//, | |||||
| 7484 | ru rl = /^([\ w.+-]+:)(? :\/\/([^\/ ?#:]*)(?:: (\d+)|)|)/ , | |||||
| 7485 | ||||||
| 7486 | // Keep a co py of the old load m ethod | |||||
| 7487 | _l oad = jQue ry.fn.load , | |||||
| 7488 | ||||||
| 7489 | /* Prefilter s | |||||
| 7490 | * 1) They a re useful to introdu ce custom dataTypes (see ajax/ jsonp.js f or an exam ple) | |||||
| 7491 | * 2) These are called : | |||||
| 7492 | * - BEFO RE asking for a tran sport | |||||
| 7493 | * - AFTE R param se rializatio n (s.data is a strin g if s.pro cessData i s true) | |||||
| 7494 | * 3) key is the dataT ype | |||||
| 7495 | * 4) the ca tchall sym bol "*" ca n be used | |||||
| 7496 | * 5) execut ion will s tart with transport dataType a nd THEN co ntinue dow n to "*" i f needed | |||||
| 7497 | * / | |||||
| 7498 | pr efilters = {}, | |||||
| 7499 | ||||||
| 7500 | /* Transport s bindings | |||||
| 7501 | * 1) key is the dataT ype | |||||
| 7502 | * 2) the ca tchall sym bol "*" ca n be used | |||||
| 7503 | * 3) select ion will s tart with transport dataType a nd THEN go to "*" if needed | |||||
| 7504 | * / | |||||
| 7505 | tr ansports = {}, | |||||
| 7506 | ||||||
| 7507 | // Avoid com ment-prolo g char seq uence (#10 098); must appease l int and ev ade compre ssion | |||||
| 7508 | al lTypes = " */".concat ("*"); | |||||
| 7509 | ||||||
| 7510 | // #8138, IE may thr ow an exce ption when accessing | |||||
| 7511 | // a field from wind ow.locatio n if docum ent.domain has been set | |||||
| 7512 | try { | |||||
| 7513 | aj axLocation = locatio n.href; | |||||
| 7514 | } catch( e ) { | |||||
| 7515 | // Use the h ref attrib ute of an A element | |||||
| 7516 | // since IE will modif y it given document. location | |||||
| 7517 | aj axLocation = documen t.createEl ement( "a" ); | |||||
| 7518 | aj axLocation .href = "" ; | |||||
| 7519 | aj axLocation = ajaxLoc ation.href ; | |||||
| 7520 | } | |||||
| 7521 | ||||||
| 7522 | // Segment location into parts | |||||
| 7523 | ajaxLocPar ts = rurl. exec( ajax Location.t oLowerCase () ) || [] ; | |||||
| 7524 | ||||||
| 7525 | // Base "c onstructor " for jQue ry.ajaxPre filter and jQuery.aj axTranspor t | |||||
| 7526 | function a ddToPrefil tersOrTran sports( st ructure ) { | |||||
| 7527 | ||||||
| 7528 | // dataTypeE xpression is optiona l and defa ults to "* " | |||||
| 7529 | re turn funct ion( dataT ypeExpress ion, func ) { | |||||
| 7530 | ||||||
| 7531 | if ( typeof da taTypeExpr ession !== "string" ) { | |||||
| 7532 | func = dataTypeE xpression; | |||||
| 7533 | dataTy peExpressi on = "*"; | |||||
| 7534 | } | |||||
| 7535 | ||||||
| 7536 | var dataType, | |||||
| 7537 | i = 0, | |||||
| 7538 | dataTy pes = data TypeExpres sion.toLow erCase().m atch( core _rnotwhite ) || []; | |||||
| 7539 | ||||||
| 7540 | if ( jQuery.is Function( func ) ) { | |||||
| 7541 | // For each data Type in th e dataType Expression | |||||
| 7542 | while ( (dataTyp e = dataTy pes[i++]) ) { | |||||
| 7543 | // Prepe nd if requ ested | |||||
| 7544 | if ( dat aType[0] = == "+" ) { | |||||
| 7545 | dataType = dataType. slice( 1 ) || "*"; | |||||
| 7546 | (structure [ dataType ] = struc ture[ data Type ] || []).unshif t( func ); | |||||
| 7547 | ||||||
| 7548 | // Other wise appen d | |||||
| 7549 | } else { | |||||
| 7550 | (structure [ dataType ] = struc ture[ data Type ] || []).push( func ); | |||||
| 7551 | } | |||||
| 7552 | } | |||||
| 7553 | } | |||||
| 7554 | }; | |||||
| 7555 | } | |||||
| 7556 | ||||||
| 7557 | // Base in spection f unction fo r prefilte rs and tra nsports | |||||
| 7558 | function i nspectPref iltersOrTr ansports( structure, options, originalOp tions, jqX HR ) { | |||||
| 7559 | ||||||
| 7560 | va r inspecte d = {}, | |||||
| 7561 | seek ingTranspo rt = ( str ucture === transport s ); | |||||
| 7562 | ||||||
| 7563 | fu nction ins pect( data Type ) { | |||||
| 7564 | var selected; | |||||
| 7565 | insp ected[ dat aType ] = true; | |||||
| 7566 | jQue ry.each( s tructure[ dataType ] || [], fu nction( _, prefilter OrFactory ) { | |||||
| 7567 | var da taTypeOrTr ansport = prefilterO rFactory( options, o riginalOpt ions, jqXH R ); | |||||
| 7568 | if( ty peof dataT ypeOrTrans port === " string" && !seekingT ransport & & !inspect ed[ dataTy peOrTransp ort ] ) { | |||||
| 7569 | options. dataTypes. unshift( d ataTypeOrT ransport ) ; | |||||
| 7570 | inspect( dataTypeO rTransport ); | |||||
| 7571 | return f alse; | |||||
| 7572 | } else if ( seek ingTranspo rt ) { | |||||
| 7573 | return ! ( selected = dataTyp eOrTranspo rt ); | |||||
| 7574 | } | |||||
| 7575 | }); | |||||
| 7576 | retu rn selecte d; | |||||
| 7577 | } | |||||
| 7578 | ||||||
| 7579 | re turn inspe ct( option s.dataType s[ 0 ] ) | | !inspect ed[ "*" ] && inspect ( "*" ); | |||||
| 7580 | } | |||||
| 7581 | ||||||
| 7582 | // A speci al extend for ajax o ptions | |||||
| 7583 | // that ta kes "flat" options ( not to be deep exten ded) | |||||
| 7584 | // Fixes # 9887 | |||||
| 7585 | function a jaxExtend( target, s rc ) { | |||||
| 7586 | va r deep, ke y, | |||||
| 7587 | flat Options = jQuery.aja xSettings. flatOption s || {}; | |||||
| 7588 | ||||||
| 7589 | fo r ( key in src ) { | |||||
| 7590 | if ( src[ key ] !== unde fined ) { | |||||
| 7591 | ( flat Options[ k ey ] ? tar get : ( de ep || (dee p = {}) ) )[ key ] = src[ key ]; | |||||
| 7592 | } | |||||
| 7593 | } | |||||
| 7594 | if ( deep ) { | |||||
| 7595 | jQue ry.extend( true, tar get, deep ); | |||||
| 7596 | } | |||||
| 7597 | ||||||
| 7598 | re turn targe t; | |||||
| 7599 | } | |||||
| 7600 | ||||||
| 7601 | jQuery.fn. load = fun ction( url , params, callback ) { | |||||
| 7602 | if ( typeof url !== "s tring" && _load ) { | |||||
| 7603 | retu rn _load.a pply( this , argument s ); | |||||
| 7604 | } | |||||
| 7605 | ||||||
| 7606 | va r selector , response , type, | |||||
| 7607 | self = this, | |||||
| 7608 | off = url.inde xOf(" "); | |||||
| 7609 | ||||||
| 7610 | if ( off >= 0 ) { | |||||
| 7611 | sele ctor = url .slice( of f, url.len gth ); | |||||
| 7612 | url = url.slic e( 0, off ); | |||||
| 7613 | } | |||||
| 7614 | ||||||
| 7615 | // If it's a function | |||||
| 7616 | if ( jQuery. isFunction ( params ) ) { | |||||
| 7617 | ||||||
| 7618 | // W e assume t hat it's t he callbac k | |||||
| 7619 | call back = par ams; | |||||
| 7620 | para ms = undef ined; | |||||
| 7621 | ||||||
| 7622 | // Otherwise , build a param stri ng | |||||
| 7623 | } else if ( params && typeof par ams === "o bject" ) { | |||||
| 7624 | type = "POST"; | |||||
| 7625 | } | |||||
| 7626 | ||||||
| 7627 | // If we hav e elements to modify , make the request | |||||
| 7628 | if ( self.le ngth > 0 ) { | |||||
| 7629 | jQue ry.ajax({ | |||||
| 7630 | url: u rl, | |||||
| 7631 | ||||||
| 7632 | // if "type" var iable is u ndefined, then "GET" method wi ll be used | |||||
| 7633 | type: type, | |||||
| 7634 | dataTy pe: "html" , | |||||
| 7635 | data: params | |||||
| 7636 | }).d one(functi on( respon seText ) { | |||||
| 7637 | ||||||
| 7638 | // Sav e response for use i n complete callback | |||||
| 7639 | respon se = argum ents; | |||||
| 7640 | ||||||
| 7641 | self.h tml( selec tor ? | |||||
| 7642 | ||||||
| 7643 | // If a selector w as specifi ed, locate the right elements in a dummy div | |||||
| 7644 | // Exclu de scripts to avoid IE 'Permis sion Denie d' errors | |||||
| 7645 | jQuery(" <div>").ap pend( jQue ry.parseHT ML( respon seText ) ) .find( sel ector ) : | |||||
| 7646 | ||||||
| 7647 | // Other wise use t he full re sult | |||||
| 7648 | response Text ); | |||||
| 7649 | ||||||
| 7650 | }).c omplete( c allback && function( jqXHR, st atus ) { | |||||
| 7651 | self.e ach( callb ack, respo nse || [ j qXHR.respo nseText, s tatus, jqX HR ] ); | |||||
| 7652 | }); | |||||
| 7653 | } | |||||
| 7654 | ||||||
| 7655 | re turn this; | |||||
| 7656 | }; | |||||
| 7657 | ||||||
| 7658 | // Attach a bunch of functions for handl ing common AJAX even ts | |||||
| 7659 | jQuery.eac h( [ "ajax Start", "a jaxStop", "ajaxCompl ete", "aja xError", " ajaxSucces s", "ajaxS end" ], fu nction( i, type ){ | |||||
| 7660 | jQ uery.fn[ t ype ] = fu nction( fn ){ | |||||
| 7661 | retu rn this.on ( type, fn ); | |||||
| 7662 | }; | |||||
| 7663 | }); | |||||
| 7664 | ||||||
| 7665 | jQuery.eac h( [ "get" , "post" ] , function ( i, metho d ) { | |||||
| 7666 | jQ uery[ meth od ] = fun ction( url , data, ca llback, ty pe ) { | |||||
| 7667 | // s hift argum ents if da ta argumen t was omit ted | |||||
| 7668 | if ( jQuery.is Function( data ) ) { | |||||
| 7669 | type = type || c allback; | |||||
| 7670 | callba ck = data; | |||||
| 7671 | data = undefined ; | |||||
| 7672 | } | |||||
| 7673 | ||||||
| 7674 | retu rn jQuery. ajax({ | |||||
| 7675 | url: u rl, | |||||
| 7676 | type: method, | |||||
| 7677 | dataTy pe: type, | |||||
| 7678 | data: data, | |||||
| 7679 | succes s: callbac k | |||||
| 7680 | }); | |||||
| 7681 | }; | |||||
| 7682 | }); | |||||
| 7683 | ||||||
| 7684 | jQuery.ext end({ | |||||
| 7685 | ||||||
| 7686 | // Counter f or holding the numbe r of activ e queries | |||||
| 7687 | ac tive: 0, | |||||
| 7688 | ||||||
| 7689 | // Last-Modi fied heade r cache fo r next req uest | |||||
| 7690 | la stModified : {}, | |||||
| 7691 | et ag: {}, | |||||
| 7692 | ||||||
| 7693 | aj axSettings : { | |||||
| 7694 | url: ajaxLocat ion, | |||||
| 7695 | type : "GET", | |||||
| 7696 | isLo cal: rloca lProtocol. test( ajax LocParts[ 1 ] ), | |||||
| 7697 | glob al: true, | |||||
| 7698 | proc essData: t rue, | |||||
| 7699 | asyn c: true, | |||||
| 7700 | cont entType: " applicatio n/x-www-fo rm-urlenco ded; chars et=UTF-8", | |||||
| 7701 | /* | |||||
| 7702 | time out: 0, | |||||
| 7703 | data : null, | |||||
| 7704 | data Type: null , | |||||
| 7705 | user name: null , | |||||
| 7706 | pass word: null , | |||||
| 7707 | cach e: null, | |||||
| 7708 | thro ws: false, | |||||
| 7709 | trad itional: f alse, | |||||
| 7710 | head ers: {}, | |||||
| 7711 | */ | |||||
| 7712 | ||||||
| 7713 | acce pts: { | |||||
| 7714 | "*": a llTypes, | |||||
| 7715 | text: "text/plai n", | |||||
| 7716 | html: "text/html ", | |||||
| 7717 | xml: " applicatio n/xml, tex t/xml", | |||||
| 7718 | json: "applicati on/json, t ext/javasc ript" | |||||
| 7719 | }, | |||||
| 7720 | ||||||
| 7721 | cont ents: { | |||||
| 7722 | xml: / xml/, | |||||
| 7723 | html: /html/, | |||||
| 7724 | json: /json/ | |||||
| 7725 | }, | |||||
| 7726 | ||||||
| 7727 | resp onseFields : { | |||||
| 7728 | xml: " responseXM L", | |||||
| 7729 | text: "responseT ext" | |||||
| 7730 | }, | |||||
| 7731 | ||||||
| 7732 | // D ata conver ters | |||||
| 7733 | // K eys separa te source (or catcha ll "*") an d destinat ion types with a sin gle space | |||||
| 7734 | conv erters: { | |||||
| 7735 | ||||||
| 7736 | // Con vert anyth ing to tex t | |||||
| 7737 | "* tex t": window .String, | |||||
| 7738 | ||||||
| 7739 | // Tex t to html (true = no transform ation) | |||||
| 7740 | "text html": tru e, | |||||
| 7741 | ||||||
| 7742 | // Eva luate text as a json expressio n | |||||
| 7743 | "text json": jQu ery.parseJ SON, | |||||
| 7744 | ||||||
| 7745 | // Par se text as xml | |||||
| 7746 | "text xml": jQue ry.parseXM L | |||||
| 7747 | }, | |||||
| 7748 | ||||||
| 7749 | // F or options that shou ldn't be d eep extend ed: | |||||
| 7750 | // y ou can add your own custom opt ions here if | |||||
| 7751 | // a nd when yo u create o ne that sh ouldn't be | |||||
| 7752 | // d eep extend ed (see aj axExtend) | |||||
| 7753 | flat Options: { | |||||
| 7754 | url: t rue, | |||||
| 7755 | contex t: true | |||||
| 7756 | } | |||||
| 7757 | }, | |||||
| 7758 | ||||||
| 7759 | // Creates a full fled ged settin gs object into targe t | |||||
| 7760 | // with both ajaxSetti ngs and se ttings fie lds. | |||||
| 7761 | // If target is omitte d, writes into ajaxS ettings. | |||||
| 7762 | aj axSetup: f unction( t arget, set tings ) { | |||||
| 7763 | retu rn setting s ? | |||||
| 7764 | ||||||
| 7765 | // Bui lding a se ttings obj ect | |||||
| 7766 | ajaxEx tend( ajax Extend( ta rget, jQue ry.ajaxSet tings ), s ettings ) : | |||||
| 7767 | ||||||
| 7768 | // Ext ending aja xSettings | |||||
| 7769 | ajaxEx tend( jQue ry.ajaxSet tings, tar get ); | |||||
| 7770 | }, | |||||
| 7771 | ||||||
| 7772 | aj axPrefilte r: addToPr efiltersOr Transports ( prefilte rs ), | |||||
| 7773 | aj axTranspor t: addToPr efiltersOr Transports ( transpor ts ), | |||||
| 7774 | ||||||
| 7775 | // Main meth od | |||||
| 7776 | aj ax: functi on( url, o ptions ) { | |||||
| 7777 | ||||||
| 7778 | // I f url is a n object, simulate p re-1.5 sig nature | |||||
| 7779 | if ( typeof ur l === "obj ect" ) { | |||||
| 7780 | option s = url; | |||||
| 7781 | url = undefined; | |||||
| 7782 | } | |||||
| 7783 | ||||||
| 7784 | // F orce optio ns to be a n object | |||||
| 7785 | opti ons = opti ons || {}; | |||||
| 7786 | ||||||
| 7787 | var // Cross-d omain dete ction vars | |||||
| 7788 | parts, | |||||
| 7789 | // Loo p variable | |||||
| 7790 | i, | |||||
| 7791 | // URL without a nti-cache param | |||||
| 7792 | cacheU RL, | |||||
| 7793 | // Res ponse head ers as str ing | |||||
| 7794 | respon seHeadersS tring, | |||||
| 7795 | // tim eout handl e | |||||
| 7796 | timeou tTimer, | |||||
| 7797 | ||||||
| 7798 | // To know if gl obal event s are to b e dispatch ed | |||||
| 7799 | fireGl obals, | |||||
| 7800 | ||||||
| 7801 | transp ort, | |||||
| 7802 | // Res ponse head ers | |||||
| 7803 | respon seHeaders, | |||||
| 7804 | // Cre ate the fi nal option s object | |||||
| 7805 | s = jQ uery.ajaxS etup( {}, options ), | |||||
| 7806 | // Cal lbacks con text | |||||
| 7807 | callba ckContext = s.contex t || s, | |||||
| 7808 | // Con text for g lobal even ts is call backContex t if it is a DOM nod e or jQuer y collecti on | |||||
| 7809 | global EventConte xt = s.con text && ( callbackCo ntext.node Type || ca llbackCont ext.jquery ) ? | |||||
| 7810 | jQuery( callbackCo ntext ) : | |||||
| 7811 | jQuery.e vent, | |||||
| 7812 | // Def erreds | |||||
| 7813 | deferr ed = jQuer y.Deferred (), | |||||
| 7814 | comple teDeferred = jQuery. Callbacks( "once memo ry"), | |||||
| 7815 | // Sta tus-depend ent callba cks | |||||
| 7816 | status Code = s.s tatusCode || {}, | |||||
| 7817 | // Hea ders (they are sent all at onc e) | |||||
| 7818 | reques tHeaders = {}, | |||||
| 7819 | reques tHeadersNa mes = {}, | |||||
| 7820 | // The jqXHR sta te | |||||
| 7821 | state = 0, | |||||
| 7822 | // Def ault abort message | |||||
| 7823 | strAbo rt = "canc eled", | |||||
| 7824 | // Fak e xhr | |||||
| 7825 | jqXHR = { | |||||
| 7826 | readySta te: 0, | |||||
| 7827 | ||||||
| 7828 | // Build s headers hashtable if needed | |||||
| 7829 | getRespo nseHeader: function( key ) { | |||||
| 7830 | var match; | |||||
| 7831 | if ( state === 2 ) { | |||||
| 7832 | if ( !respon seHeaders ) { | |||||
| 7833 | resp onseHeader s = {}; | |||||
| 7834 | whil e ( (match = rheader s.exec( re sponseHead ersString )) ) { | |||||
| 7835 | respon seHeaders[ match[1]. toLowerCas e() ] = ma tch[ 2 ]; | |||||
| 7836 | } | |||||
| 7837 | } | |||||
| 7838 | ma tch = resp onseHeader s[ key.toL owerCase() ]; | |||||
| 7839 | } | |||||
| 7840 | return mat ch == null ? null : match; | |||||
| 7841 | }, | |||||
| 7842 | ||||||
| 7843 | // Raw s tring | |||||
| 7844 | getAllRe sponseHead ers: funct ion() { | |||||
| 7845 | return sta te === 2 ? responseH eadersStri ng : null; | |||||
| 7846 | }, | |||||
| 7847 | ||||||
| 7848 | // Cache s the head er | |||||
| 7849 | setReque stHeader: function( name, valu e ) { | |||||
| 7850 | var lname = name.toL owerCase() ; | |||||
| 7851 | if ( !stat e ) { | |||||
| 7852 | na me = reque stHeadersN ames[ lnam e ] = requ estHeaders Names[ lna me ] || na me; | |||||
| 7853 | re questHeade rs[ name ] = value; | |||||
| 7854 | } | |||||
| 7855 | return thi s; | |||||
| 7856 | }, | |||||
| 7857 | ||||||
| 7858 | // Overr ides respo nse conten t-type hea der | |||||
| 7859 | override MimeType: function( type ) { | |||||
| 7860 | if ( !stat e ) { | |||||
| 7861 | s. mimeType = type; | |||||
| 7862 | } | |||||
| 7863 | return thi s; | |||||
| 7864 | }, | |||||
| 7865 | ||||||
| 7866 | // Statu s-dependen t callback s | |||||
| 7867 | statusCo de: functi on( map ) { | |||||
| 7868 | var code; | |||||
| 7869 | if ( map ) { | |||||
| 7870 | if ( state < 2 ) { | |||||
| 7871 | for ( code in map ) { | |||||
| 7872 | // Laz y-add the new callba ck in a wa y that pre serves old ones | |||||
| 7873 | status Code[ code ] = [ sta tusCode[ c ode ], map [ code ] ] ; | |||||
| 7874 | } | |||||
| 7875 | } else { | |||||
| 7876 | // E xecute the appropria te callbac ks | |||||
| 7877 | jqXH R.always( map[ jqXHR .status ] ); | |||||
| 7878 | } | |||||
| 7879 | } | |||||
| 7880 | return thi s; | |||||
| 7881 | }, | |||||
| 7882 | ||||||
| 7883 | // Cance l the requ est | |||||
| 7884 | abort: f unction( s tatusText ) { | |||||
| 7885 | var finalT ext = stat usText || strAbort; | |||||
| 7886 | if ( trans port ) { | |||||
| 7887 | tr ansport.ab ort( final Text ); | |||||
| 7888 | } | |||||
| 7889 | done( 0, f inalText ) ; | |||||
| 7890 | return thi s; | |||||
| 7891 | } | |||||
| 7892 | }; | |||||
| 7893 | ||||||
| 7894 | // A ttach defe rreds | |||||
| 7895 | defe rred.promi se( jqXHR ).complete = complet eDeferred. add; | |||||
| 7896 | jqXH R.success = jqXHR.do ne; | |||||
| 7897 | jqXH R.error = jqXHR.fail ; | |||||
| 7898 | ||||||
| 7899 | // R emove hash character (#7531: a nd string promotion) | |||||
| 7900 | // A dd protoco l if not p rovided (# 5866: IE7 issue with protocol- less urls) | |||||
| 7901 | // H andle fals y url in t he setting s object ( #10093: co nsistency with old s ignature) | |||||
| 7902 | // W e also use the url p arameter i f availabl e | |||||
| 7903 | s.ur l = ( ( ur l || s.url || ajaxLo cation ) + "" ).repl ace( rhash , "" ).rep lace( rpro tocol, aja xLocParts[ 1 ] + "// " ); | |||||
| 7904 | ||||||
| 7905 | // A lias metho d option t o type as per ticket #12004 | |||||
| 7906 | s.ty pe = optio ns.method || options .type || s .method || s.type; | |||||
| 7907 | ||||||
| 7908 | // E xtract dat aTypes lis t | |||||
| 7909 | s.da taTypes = jQuery.tri m( s.dataT ype || "*" ).toLower Case().mat ch( core_r notwhite ) || [""]; | |||||
| 7910 | ||||||
| 7911 | // A cross-dom ain reques t is in or der when w e have a p rotocol:ho st:port mi smatch | |||||
| 7912 | if ( s.crossDo main == nu ll ) { | |||||
| 7913 | parts = rurl.exe c( s.url.t oLowerCase () ); | |||||
| 7914 | s.cros sDomain = !!( parts && | |||||
| 7915 | ( parts[ 1 ] !== a jaxLocPart s[ 1 ] || parts[ 2 ] !== ajaxL ocParts[ 2 ] || | |||||
| 7916 | ( parts[ 3 ] || ( pa rts[ 1 ] = == "http:" ? 80 : 44 3 ) ) != | |||||
| 7917 | ( ajaxLocPar ts[ 3 ] || ( ajaxLoc Parts[ 1 ] === "http :" ? 80 : 443 ) ) ) | |||||
| 7918 | ); | |||||
| 7919 | } | |||||
| 7920 | ||||||
| 7921 | // C onvert dat a if not a lready a s tring | |||||
| 7922 | if ( s.data && s.process Data && ty peof s.dat a !== "str ing" ) { | |||||
| 7923 | s.data = jQuery. param( s.d ata, s.tra ditional ) ; | |||||
| 7924 | } | |||||
| 7925 | ||||||
| 7926 | // A pply prefi lters | |||||
| 7927 | insp ectPrefilt ersOrTrans ports( pre filters, s , options, jqXHR ); | |||||
| 7928 | ||||||
| 7929 | // I f request was aborte d inside a prefilter , stop the re | |||||
| 7930 | if ( state === 2 ) { | |||||
| 7931 | return jqXHR; | |||||
| 7932 | } | |||||
| 7933 | ||||||
| 7934 | // W e can fire global ev ents as of now if as ked to | |||||
| 7935 | fire Globals = s.global; | |||||
| 7936 | ||||||
| 7937 | // W atch for a new set o f requests | |||||
| 7938 | if ( fireGloba ls && jQue ry.active+ + === 0 ) { | |||||
| 7939 | jQuery .event.tri gger("ajax Start"); | |||||
| 7940 | } | |||||
| 7941 | ||||||
| 7942 | // U ppercase t he type | |||||
| 7943 | s.ty pe = s.typ e.toUpperC ase(); | |||||
| 7944 | ||||||
| 7945 | // D etermine i f request has conten t | |||||
| 7946 | s.ha sContent = !rnoConte nt.test( s .type ); | |||||
| 7947 | ||||||
| 7948 | // S ave the UR L in case we're toyi ng with th e If-Modif ied-Since | |||||
| 7949 | // a nd/or If-N one-Match header lat er on | |||||
| 7950 | cach eURL = s.u rl; | |||||
| 7951 | ||||||
| 7952 | // M ore option s handling for reque sts with n o content | |||||
| 7953 | if ( !s.hasCon tent ) { | |||||
| 7954 | ||||||
| 7955 | // If data is av ailable, a ppend data to url | |||||
| 7956 | if ( s .data ) { | |||||
| 7957 | cacheURL = ( s.url += ( ajax _rquery.te st( cacheU RL ) ? "&" : "?" ) + s.data ); | |||||
| 7958 | // #9682 : remove d ata so tha t it's not used in a n eventual retry | |||||
| 7959 | delete s .data; | |||||
| 7960 | } | |||||
| 7961 | ||||||
| 7962 | // Add anti-cach e in url i f needed | |||||
| 7963 | if ( s .cache === false ) { | |||||
| 7964 | s.url = rts.test( cacheURL ) ? | |||||
| 7965 | ||||||
| 7966 | // If ther e is alrea dy a '_' p arameter, set its va lue | |||||
| 7967 | cacheURL.r eplace( rt s, "$1_=" + ajax_non ce++ ) : | |||||
| 7968 | ||||||
| 7969 | // Otherwi se add one to the en d | |||||
| 7970 | cacheURL + ( ajax_rq uery.test( cacheURL ) ? "&" : "?" ) + "_ =" + ajax_ nonce++; | |||||
| 7971 | } | |||||
| 7972 | } | |||||
| 7973 | ||||||
| 7974 | // S et the If- Modified-S ince and/o r If-None- Match head er, if in ifModified mode. | |||||
| 7975 | if ( s.ifModif ied ) { | |||||
| 7976 | if ( j Query.last Modified[ cacheURL ] ) { | |||||
| 7977 | jqXHR.se tRequestHe ader( "If- Modified-S ince", jQu ery.lastMo dified[ ca cheURL ] ) ; | |||||
| 7978 | } | |||||
| 7979 | if ( j Query.etag [ cacheURL ] ) { | |||||
| 7980 | jqXHR.se tRequestHe ader( "If- None-Match ", jQuery. etag[ cach eURL ] ); | |||||
| 7981 | } | |||||
| 7982 | } | |||||
| 7983 | ||||||
| 7984 | // S et the cor rect heade r, if data is being sent | |||||
| 7985 | if ( s.data && s.hasCont ent && s.c ontentType !== false || option s.contentT ype ) { | |||||
| 7986 | jqXHR. setRequest Header( "C ontent-Typ e", s.cont entType ); | |||||
| 7987 | } | |||||
| 7988 | ||||||
| 7989 | // S et the Acc epts heade r for the server, de pending on the dataT ype | |||||
| 7990 | jqXH R.setReque stHeader( | |||||
| 7991 | "Accep t", | |||||
| 7992 | s.data Types[ 0 ] && s.acce pts[ s.dat aTypes[0] ] ? | |||||
| 7993 | s.accept s[ s.dataT ypes[0] ] + ( s.data Types[ 0 ] !== "*" ? ", " + al lTypes + " ; q=0.01" : "" ) : | |||||
| 7994 | s.accept s[ "*" ] | |||||
| 7995 | ); | |||||
| 7996 | ||||||
| 7997 | // C heck for h eaders opt ion | |||||
| 7998 | for ( i in s.h eaders ) { | |||||
| 7999 | jqXHR. setRequest Header( i, s.headers [ i ] ); | |||||
| 8000 | } | |||||
| 8001 | ||||||
| 8002 | // A llow custo m headers/ mimetypes and early abort | |||||
| 8003 | if ( s.beforeS end && ( s .beforeSen d.call( ca llbackCont ext, jqXHR , s ) === false || s tate === 2 ) ) { | |||||
| 8004 | // Abo rt if not done alrea dy and ret urn | |||||
| 8005 | return jqXHR.abo rt(); | |||||
| 8006 | } | |||||
| 8007 | ||||||
| 8008 | // a borting is no longer a cancell ation | |||||
| 8009 | strA bort = "ab ort"; | |||||
| 8010 | ||||||
| 8011 | // I nstall cal lbacks on deferreds | |||||
| 8012 | for ( i in { s uccess: 1, error: 1, complete: 1 } ) { | |||||
| 8013 | jqXHR[ i ]( s[ i ] ); | |||||
| 8014 | } | |||||
| 8015 | ||||||
| 8016 | // G et transpo rt | |||||
| 8017 | tran sport = in spectPrefi ltersOrTra nsports( t ransports, s, option s, jqXHR ) ; | |||||
| 8018 | ||||||
| 8019 | // I f no trans port, we a uto-abort | |||||
| 8020 | if ( !transpor t ) { | |||||
| 8021 | done( -1, "No Tr ansport" ) ; | |||||
| 8022 | } el se { | |||||
| 8023 | jqXHR. readyState = 1; | |||||
| 8024 | ||||||
| 8025 | // Sen d global e vent | |||||
| 8026 | if ( f ireGlobals ) { | |||||
| 8027 | globalEv entContext .trigger( "ajaxSend" , [ jqXHR, s ] ); | |||||
| 8028 | } | |||||
| 8029 | // Tim eout | |||||
| 8030 | if ( s .async && s.timeout > 0 ) { | |||||
| 8031 | timeoutT imer = set Timeout(fu nction() { | |||||
| 8032 | jqXHR.abor t("timeout "); | |||||
| 8033 | }, s.tim eout ); | |||||
| 8034 | } | |||||
| 8035 | ||||||
| 8036 | try { | |||||
| 8037 | state = 1; | |||||
| 8038 | transpor t.send( re questHeade rs, done ) ; | |||||
| 8039 | } catc h ( e ) { | |||||
| 8040 | // Propa gate excep tion as er ror if not done | |||||
| 8041 | if ( sta te < 2 ) { | |||||
| 8042 | done( -1, e ); | |||||
| 8043 | // Simpl y rethrow otherwise | |||||
| 8044 | } else { | |||||
| 8045 | throw e; | |||||
| 8046 | } | |||||
| 8047 | } | |||||
| 8048 | } | |||||
| 8049 | ||||||
| 8050 | // C allback fo r when eve rything is done | |||||
| 8051 | func tion done( status, n ativeStatu sText, res ponses, he aders ) { | |||||
| 8052 | var is Success, s uccess, er ror, respo nse, modif ied, | |||||
| 8053 | statusTe xt = nativ eStatusTex t; | |||||
| 8054 | ||||||
| 8055 | // Cal led once | |||||
| 8056 | if ( s tate === 2 ) { | |||||
| 8057 | return; | |||||
| 8058 | } | |||||
| 8059 | ||||||
| 8060 | // Sta te is "don e" now | |||||
| 8061 | state = 2; | |||||
| 8062 | ||||||
| 8063 | // Cle ar timeout if it exi sts | |||||
| 8064 | if ( t imeoutTime r ) { | |||||
| 8065 | clearTim eout( time outTimer ) ; | |||||
| 8066 | } | |||||
| 8067 | ||||||
| 8068 | // Der eference t ransport f or early g arbage col lection | |||||
| 8069 | // (no matter ho w long the jqXHR obj ect will b e used) | |||||
| 8070 | transp ort = unde fined; | |||||
| 8071 | ||||||
| 8072 | // Cac he respons e headers | |||||
| 8073 | respon seHeadersS tring = he aders || " "; | |||||
| 8074 | ||||||
| 8075 | // Set readyStat e | |||||
| 8076 | jqXHR. readyState = status > 0 ? 4 : 0; | |||||
| 8077 | ||||||
| 8078 | // Get response data | |||||
| 8079 | if ( r esponses ) { | |||||
| 8080 | response = ajaxHan dleRespons es( s, jqX HR, respon ses ); | |||||
| 8081 | } | |||||
| 8082 | ||||||
| 8083 | // If successful , handle t ype chaini ng | |||||
| 8084 | if ( s tatus >= 2 00 && stat us < 300 | | status = == 304 ) { | |||||
| 8085 | ||||||
| 8086 | // Set t he If-Modi fied-Since and/or If -None-Matc h header, if in ifMo dified mod e. | |||||
| 8087 | if ( s.i fModified ) { | |||||
| 8088 | modified = jqXHR.get ResponseHe ader("Last -Modified" ); | |||||
| 8089 | if ( modif ied ) { | |||||
| 8090 | jQ uery.lastM odified[ c acheURL ] = modified ; | |||||
| 8091 | } | |||||
| 8092 | modified = jqXHR.get ResponseHe ader("etag "); | |||||
| 8093 | if ( modif ied ) { | |||||
| 8094 | jQ uery.etag[ cacheURL ] = modifi ed; | |||||
| 8095 | } | |||||
| 8096 | } | |||||
| 8097 | ||||||
| 8098 | // if no content | |||||
| 8099 | if ( sta tus === 20 4 ) { | |||||
| 8100 | isSuccess = true; | |||||
| 8101 | statusText = "nocont ent"; | |||||
| 8102 | ||||||
| 8103 | // if no t modified | |||||
| 8104 | } else i f ( status === 304 ) { | |||||
| 8105 | isSuccess = true; | |||||
| 8106 | statusText = "notmod ified"; | |||||
| 8107 | ||||||
| 8108 | // If we have data , let's co nvert it | |||||
| 8109 | } else { | |||||
| 8110 | isSuccess = ajaxConv ert( s, re sponse ); | |||||
| 8111 | statusText = isSucce ss.state; | |||||
| 8112 | success = isSuccess. data; | |||||
| 8113 | error = is Success.er ror; | |||||
| 8114 | isSuccess = !error; | |||||
| 8115 | } | |||||
| 8116 | } else { | |||||
| 8117 | // We ex tract erro r from sta tusText | |||||
| 8118 | // then normalize statusText and statu s for non- aborts | |||||
| 8119 | error = statusText ; | |||||
| 8120 | if ( sta tus || !st atusText ) { | |||||
| 8121 | statusText = "error" ; | |||||
| 8122 | if ( statu s < 0 ) { | |||||
| 8123 | st atus = 0; | |||||
| 8124 | } | |||||
| 8125 | } | |||||
| 8126 | } | |||||
| 8127 | ||||||
| 8128 | // Set data for the fake x hr object | |||||
| 8129 | jqXHR. status = s tatus; | |||||
| 8130 | jqXHR. statusText = ( nativ eStatusTex t || statu sText ) + ""; | |||||
| 8131 | ||||||
| 8132 | // Suc cess/Error | |||||
| 8133 | if ( i sSuccess ) { | |||||
| 8134 | deferred .resolveWi th( callba ckContext, [ success , statusTe xt, jqXHR ] ); | |||||
| 8135 | } else { | |||||
| 8136 | deferred .rejectWit h( callbac kContext, [ jqXHR, s tatusText, error ] ) ; | |||||
| 8137 | } | |||||
| 8138 | ||||||
| 8139 | // Sta tus-depend ent callba cks | |||||
| 8140 | jqXHR. statusCode ( statusCo de ); | |||||
| 8141 | status Code = und efined; | |||||
| 8142 | ||||||
| 8143 | if ( f ireGlobals ) { | |||||
| 8144 | globalEv entContext .trigger( isSuccess ? "ajaxSuc cess" : "a jaxError", | |||||
| 8145 | [ jqXHR, s , isSucces s ? succes s : error ] ); | |||||
| 8146 | } | |||||
| 8147 | ||||||
| 8148 | // Com plete | |||||
| 8149 | comple teDeferred .fireWith( callbackC ontext, [ jqXHR, sta tusText ] ); | |||||
| 8150 | ||||||
| 8151 | if ( f ireGlobals ) { | |||||
| 8152 | globalEv entContext .trigger( "ajaxCompl ete", [ jq XHR, s ] ) ; | |||||
| 8153 | // Handl e the glob al AJAX co unter | |||||
| 8154 | if ( !( --jQuery.a ctive ) ) { | |||||
| 8155 | jQuery.eve nt.trigger ("ajaxStop "); | |||||
| 8156 | } | |||||
| 8157 | } | |||||
| 8158 | } | |||||
| 8159 | ||||||
| 8160 | retu rn jqXHR; | |||||
| 8161 | }, | |||||
| 8162 | ||||||
| 8163 | ge tScript: f unction( u rl, callba ck ) { | |||||
| 8164 | retu rn jQuery. get( url, undefined, callback, "script" ); | |||||
| 8165 | }, | |||||
| 8166 | ||||||
| 8167 | ge tJSON: fun ction( url , data, ca llback ) { | |||||
| 8168 | retu rn jQuery. get( url, data, call back, "jso n" ); | |||||
| 8169 | } | |||||
| 8170 | }); | |||||
| 8171 | ||||||
| 8172 | /* Handles responses to an aja x request: | |||||
| 8173 | * - sets all respon seXXX fiel ds accordi ngly | |||||
| 8174 | * - finds the right dataType (mediates between co ntent-type and expec ted dataTy pe) | |||||
| 8175 | * - retur ns the cor responding response | |||||
| 8176 | */ | |||||
| 8177 | function a jaxHandleR esponses( s, jqXHR, responses ) { | |||||
| 8178 | va r firstDat aType, ct, finalData Type, type , | |||||
| 8179 | cont ents = s.c ontents, | |||||
| 8180 | data Types = s. dataTypes, | |||||
| 8181 | resp onseFields = s.respo nseFields; | |||||
| 8182 | ||||||
| 8183 | // Fill resp onseXXX fi elds | |||||
| 8184 | fo r ( type i n response Fields ) { | |||||
| 8185 | if ( type in r esponses ) { | |||||
| 8186 | jqXHR[ responseF ields[type ] ] = resp onses[ typ e ]; | |||||
| 8187 | } | |||||
| 8188 | } | |||||
| 8189 | ||||||
| 8190 | // Remove au to dataTyp e and get content-ty pe in the process | |||||
| 8191 | wh ile( dataT ypes[ 0 ] === "*" ) { | |||||
| 8192 | data Types.shif t(); | |||||
| 8193 | if ( ct === un defined ) { | |||||
| 8194 | ct = s .mimeType || jqXHR.g etResponse Header("Co ntent-Type "); | |||||
| 8195 | } | |||||
| 8196 | } | |||||
| 8197 | ||||||
| 8198 | // Check if we're deal ing with a known con tent-type | |||||
| 8199 | if ( ct ) { | |||||
| 8200 | for ( type in contents ) { | |||||
| 8201 | if ( c ontents[ t ype ] && c ontents[ t ype ].test ( ct ) ) { | |||||
| 8202 | dataType s.unshift( type ); | |||||
| 8203 | break; | |||||
| 8204 | } | |||||
| 8205 | } | |||||
| 8206 | } | |||||
| 8207 | ||||||
| 8208 | // Check to see if we have a res ponse for the expect ed dataTyp e | |||||
| 8209 | if ( dataTyp es[ 0 ] in responses ) { | |||||
| 8210 | fina lDataType = dataType s[ 0 ]; | |||||
| 8211 | } else { | |||||
| 8212 | // T ry convert ible dataT ypes | |||||
| 8213 | for ( type in responses ) { | |||||
| 8214 | if ( ! dataTypes[ 0 ] || s. converters [ type + " " + dataT ypes[0] ] ) { | |||||
| 8215 | finalDat aType = ty pe; | |||||
| 8216 | break; | |||||
| 8217 | } | |||||
| 8218 | if ( ! firstDataT ype ) { | |||||
| 8219 | firstDat aType = ty pe; | |||||
| 8220 | } | |||||
| 8221 | } | |||||
| 8222 | // O r just use first one | |||||
| 8223 | fina lDataType = finalDat aType || f irstDataTy pe; | |||||
| 8224 | } | |||||
| 8225 | ||||||
| 8226 | // If we fou nd a dataT ype | |||||
| 8227 | // We add th e dataType to the li st if need ed | |||||
| 8228 | // and retur n the corr esponding response | |||||
| 8229 | if ( finalDa taType ) { | |||||
| 8230 | if ( finalData Type !== d ataTypes[ 0 ] ) { | |||||
| 8231 | dataTy pes.unshif t( finalDa taType ); | |||||
| 8232 | } | |||||
| 8233 | retu rn respons es[ finalD ataType ]; | |||||
| 8234 | } | |||||
| 8235 | } | |||||
| 8236 | ||||||
| 8237 | // Chain c onversions given the request a nd the ori ginal resp onse | |||||
| 8238 | function a jaxConvert ( s, respo nse ) { | |||||
| 8239 | va r conv2, c urrent, co nv, tmp, | |||||
| 8240 | conv erters = { }, | |||||
| 8241 | i = 0, | |||||
| 8242 | // W ork with a copy of d ataTypes i n case we need to mo dify it fo r conversi on | |||||
| 8243 | data Types = s. dataTypes. slice(), | |||||
| 8244 | prev = dataTyp es[ 0 ]; | |||||
| 8245 | ||||||
| 8246 | // Apply the dataFilte r if provi ded | |||||
| 8247 | if ( s.dataF ilter ) { | |||||
| 8248 | resp onse = s.d ataFilter( response, s.dataTyp e ); | |||||
| 8249 | } | |||||
| 8250 | ||||||
| 8251 | // Create co nverters m ap with lo wercased k eys | |||||
| 8252 | if ( dataTyp es[ 1 ] ) { | |||||
| 8253 | for ( conv in s.converte rs ) { | |||||
| 8254 | conver ters[ conv .toLowerCa se() ] = s .converter s[ conv ]; | |||||
| 8255 | } | |||||
| 8256 | } | |||||
| 8257 | ||||||
| 8258 | // Convert t o each seq uential da taType, to lerating l ist modifi cation | |||||
| 8259 | fo r ( ; (cur rent = dat aTypes[++i ]); ) { | |||||
| 8260 | ||||||
| 8261 | // T here's onl y work to do if curr ent dataTy pe is non- auto | |||||
| 8262 | if ( current ! == "*" ) { | |||||
| 8263 | ||||||
| 8264 | // Con vert respo nse if pre v dataType is non-au to and dif fers from current | |||||
| 8265 | if ( p rev !== "* " && prev !== curren t ) { | |||||
| 8266 | ||||||
| 8267 | // Seek a direct c onverter | |||||
| 8268 | conv = c onverters[ prev + " " + curren t ] || con verters[ " * " + curr ent ]; | |||||
| 8269 | ||||||
| 8270 | // If no ne found, seek a pai r | |||||
| 8271 | if ( !co nv ) { | |||||
| 8272 | for ( conv 2 in conve rters ) { | |||||
| 8273 | ||||||
| 8274 | // If conv2 outputs cu rrent | |||||
| 8275 | tm p = conv2. split(" ") ; | |||||
| 8276 | if ( tmp[ 1 ] === curr ent ) { | |||||
| 8277 | ||||||
| 8278 | // I f prev can be conver ted to acc epted inpu t | |||||
| 8279 | conv = convert ers[ prev + " " + tm p[ 0 ] ] | | | |||||
| 8280 | conver ters[ "* " + tmp[ 0 ] ]; | |||||
| 8281 | if ( conv ) { | |||||
| 8282 | // Con dense equi valence co nverters | |||||
| 8283 | if ( c onv === tr ue ) { | |||||
| 8284 | conv = c onverters[ conv2 ]; | |||||
| 8285 | ||||||
| 8286 | // Oth erwise, in sert the i ntermediat e dataType | |||||
| 8287 | } else if ( conv erters[ co nv2 ] !== true ) { | |||||
| 8288 | current = tmp[ 0 ] ; | |||||
| 8289 | dataType s.splice( i--, 0, cu rrent ); | |||||
| 8290 | } | |||||
| 8291 | ||||||
| 8292 | break; | |||||
| 8293 | } | |||||
| 8294 | } | |||||
| 8295 | } | |||||
| 8296 | } | |||||
| 8297 | ||||||
| 8298 | // Apply converter (if not a n equivale nce) | |||||
| 8299 | if ( con v !== true ) { | |||||
| 8300 | ||||||
| 8301 | // Unless errors are allowed t o bubble, catch and return the m | |||||
| 8302 | if ( conv && s["thro ws"] ) { | |||||
| 8303 | re sponse = c onv( respo nse ); | |||||
| 8304 | } else { | |||||
| 8305 | tr y { | |||||
| 8306 | resp onse = con v( respons e ); | |||||
| 8307 | } catch ( e ) { | |||||
| 8308 | retu rn { state : "parsere rror", err or: conv ? e : "No c onversion from " + p rev + " to " + curre nt }; | |||||
| 8309 | } | |||||
| 8310 | } | |||||
| 8311 | } | |||||
| 8312 | } | |||||
| 8313 | ||||||
| 8314 | // Upd ate prev f or next it eration | |||||
| 8315 | prev = current; | |||||
| 8316 | } | |||||
| 8317 | } | |||||
| 8318 | ||||||
| 8319 | re turn { sta te: "succe ss", data: response }; | |||||
| 8320 | } | |||||
| 8321 | // Install script da taType | |||||
| 8322 | jQuery.aja xSetup({ | |||||
| 8323 | ac cepts: { | |||||
| 8324 | scri pt: "text/ javascript , applicat ion/javasc ript, appl ication/ec mascript, applicatio n/x-ecmasc ript" | |||||
| 8325 | }, | |||||
| 8326 | co ntents: { | |||||
| 8327 | scri pt: /(?:ja va|ecma)sc ript/ | |||||
| 8328 | }, | |||||
| 8329 | co nverters: { | |||||
| 8330 | "tex t script": function( text ) { | |||||
| 8331 | jQuery .globalEva l( text ); | |||||
| 8332 | return text; | |||||
| 8333 | } | |||||
| 8334 | } | |||||
| 8335 | }); | |||||
| 8336 | ||||||
| 8337 | // Handle cache's sp ecial case and globa l | |||||
| 8338 | jQuery.aja xPrefilter ( "script" , function ( s ) { | |||||
| 8339 | if ( s.cache === undef ined ) { | |||||
| 8340 | s.ca che = fals e; | |||||
| 8341 | } | |||||
| 8342 | if ( s.cross Domain ) { | |||||
| 8343 | s.ty pe = "GET" ; | |||||
| 8344 | s.gl obal = fal se; | |||||
| 8345 | } | |||||
| 8346 | }); | |||||
| 8347 | ||||||
| 8348 | // Bind sc ript tag h ack transp ort | |||||
| 8349 | jQuery.aja xTransport ( "script" , function (s) { | |||||
| 8350 | ||||||
| 8351 | // This tran sport only deals wit h cross do main reque sts | |||||
| 8352 | if ( s.cross Domain ) { | |||||
| 8353 | ||||||
| 8354 | var script, | |||||
| 8355 | head = document. head || jQ uery("head ")[0] || d ocument.do cumentElem ent; | |||||
| 8356 | ||||||
| 8357 | retu rn { | |||||
| 8358 | ||||||
| 8359 | send: function( _, callbac k ) { | |||||
| 8360 | ||||||
| 8361 | script = document. createElem ent("scrip t"); | |||||
| 8362 | ||||||
| 8363 | script.a sync = tru e; | |||||
| 8364 | ||||||
| 8365 | if ( s.s criptChars et ) { | |||||
| 8366 | script.cha rset = s.s criptChars et; | |||||
| 8367 | } | |||||
| 8368 | ||||||
| 8369 | script.s rc = s.url ; | |||||
| 8370 | ||||||
| 8371 | // Attac h handlers for all b rowsers | |||||
| 8372 | script.o nload = sc ript.onrea dystatecha nge = func tion( _, i sAbort ) { | |||||
| 8373 | ||||||
| 8374 | if ( isAbo rt || !scr ipt.readyS tate || /l oaded|comp lete/.test ( script.r eadyState ) ) { | |||||
| 8375 | ||||||
| 8376 | // Handle me mory leak in IE | |||||
| 8377 | sc ript.onloa d = script .onreadyst atechange = null; | |||||
| 8378 | ||||||
| 8379 | // Remove th e script | |||||
| 8380 | if ( script. parentNode ) { | |||||
| 8381 | scri pt.parentN ode.remove Child( scr ipt ); | |||||
| 8382 | } | |||||
| 8383 | ||||||
| 8384 | // Dereferen ce the scr ipt | |||||
| 8385 | sc ript = nul l; | |||||
| 8386 | ||||||
| 8387 | // Callback if not abo rt | |||||
| 8388 | if ( !isAbor t ) { | |||||
| 8389 | call back( 200, "success" ); | |||||
| 8390 | } | |||||
| 8391 | } | |||||
| 8392 | }; | |||||
| 8393 | ||||||
| 8394 | // Circu mvent IE6 bugs with base eleme nts (#2709 and #4378 ) by prepe nding | |||||
| 8395 | // Use n ative DOM manipulati on to avoi d our domM anip AJAX trickery | |||||
| 8396 | head.ins ertBefore( script, h ead.firstC hild ); | |||||
| 8397 | }, | |||||
| 8398 | ||||||
| 8399 | abort: function( ) { | |||||
| 8400 | if ( scr ipt ) { | |||||
| 8401 | script.onl oad( undef ined, true ); | |||||
| 8402 | } | |||||
| 8403 | } | |||||
| 8404 | }; | |||||
| 8405 | } | |||||
| 8406 | }); | |||||
| 8407 | var oldCal lbacks = [ ], | |||||
| 8408 | rj sonp = /(= )\?(?=&|$) |\?\?/; | |||||
| 8409 | ||||||
| 8410 | // Default jsonp set tings | |||||
| 8411 | jQuery.aja xSetup({ | |||||
| 8412 | js onp: "call back", | |||||
| 8413 | js onpCallbac k: functio n() { | |||||
| 8414 | var callback = oldCallba cks.pop() || ( jQuer y.expando + "_" + ( ajax_nonce ++ ) ); | |||||
| 8415 | this [ callback ] = true; | |||||
| 8416 | retu rn callbac k; | |||||
| 8417 | } | |||||
| 8418 | }); | |||||
| 8419 | ||||||
| 8420 | // Detect, normalize options a nd install callbacks for jsonp requests | |||||
| 8421 | jQuery.aja xPrefilter ( "json js onp", func tion( s, o riginalSet tings, jqX HR ) { | |||||
| 8422 | ||||||
| 8423 | va r callback Name, over written, r esponseCon tainer, | |||||
| 8424 | json Prop = s.j sonp !== f alse && ( rjsonp.tes t( s.url ) ? | |||||
| 8425 | "url" : | |||||
| 8426 | typeof s.data == = "string" && !( s.c ontentType || "" ).i ndexOf("ap plication/ x-www-form -urlencode d") && rjs onp.test( s.data ) & & "data" | |||||
| 8427 | ); | |||||
| 8428 | ||||||
| 8429 | // Handle if f the expe cted data type is "j sonp" or w e have a p arameter t o set | |||||
| 8430 | if ( jsonPro p || s.dat aTypes[ 0 ] === "jso np" ) { | |||||
| 8431 | ||||||
| 8432 | // G et callbac k name, re membering preexistin g value as sociated w ith it | |||||
| 8433 | call backName = s.jsonpCa llback = j Query.isFu nction( s. jsonpCallb ack ) ? | |||||
| 8434 | s.json pCallback( ) : | |||||
| 8435 | s.json pCallback; | |||||
| 8436 | ||||||
| 8437 | // I nsert call back into url or for m data | |||||
| 8438 | if ( jsonProp ) { | |||||
| 8439 | s[ jso nProp ] = s[ jsonPro p ].replac e( rjsonp, "$1" + ca llbackName ); | |||||
| 8440 | } el se if ( s. jsonp !== false ) { | |||||
| 8441 | s.url += ( ajax_ rquery.tes t( s.url ) ? "&" : " ?" ) + s.j sonp + "=" + callbac kName; | |||||
| 8442 | } | |||||
| 8443 | ||||||
| 8444 | // U se data co nverter to retrieve json after script ex ecution | |||||
| 8445 | s.co nverters[" script jso n"] = func tion() { | |||||
| 8446 | if ( ! responseCo ntainer ) { | |||||
| 8447 | jQuery.e rror( call backName + " was not called" ) ; | |||||
| 8448 | } | |||||
| 8449 | return responseC ontainer[ 0 ]; | |||||
| 8450 | }; | |||||
| 8451 | ||||||
| 8452 | // f orce json dataType | |||||
| 8453 | s.da taTypes[ 0 ] = "json "; | |||||
| 8454 | ||||||
| 8455 | // I nstall cal lback | |||||
| 8456 | over written = window[ ca llbackName ]; | |||||
| 8457 | wind ow[ callba ckName ] = function( ) { | |||||
| 8458 | respon seContaine r = argume nts; | |||||
| 8459 | }; | |||||
| 8460 | ||||||
| 8461 | // C lean-up fu nction (fi res after converters ) | |||||
| 8462 | jqXH R.always(f unction() { | |||||
| 8463 | // Res tore preex isting val ue | |||||
| 8464 | window [ callback Name ] = o verwritten ; | |||||
| 8465 | ||||||
| 8466 | // Sav e back as free | |||||
| 8467 | if ( s [ callback Name ] ) { | |||||
| 8468 | // make sure that re-using t he options doesn't s crew thing s around | |||||
| 8469 | s.jsonpC allback = originalSe ttings.jso npCallback ; | |||||
| 8470 | ||||||
| 8471 | // save the callba ck name fo r future u se | |||||
| 8472 | oldCallb acks.push( callbackN ame ); | |||||
| 8473 | } | |||||
| 8474 | ||||||
| 8475 | // Cal l if it wa s a functi on and we have a res ponse | |||||
| 8476 | if ( r esponseCon tainer && jQuery.isF unction( o verwritten ) ) { | |||||
| 8477 | overwrit ten( respo nseContain er[ 0 ] ); | |||||
| 8478 | } | |||||
| 8479 | ||||||
| 8480 | respon seContaine r = overwr itten = un defined; | |||||
| 8481 | }); | |||||
| 8482 | ||||||
| 8483 | // D elegate to script | |||||
| 8484 | retu rn "script "; | |||||
| 8485 | } | |||||
| 8486 | }); | |||||
| 8487 | var xhrCal lbacks, xh rSupported , | |||||
| 8488 | xh rId = 0, | |||||
| 8489 | // #5280: In ternet Exp lorer will keep conn ections al ive if we don't abor t on unloa d | |||||
| 8490 | xh rOnUnloadA bort = win dow.Active XObject && function( ) { | |||||
| 8491 | // A bort all p ending req uests | |||||
| 8492 | var key; | |||||
| 8493 | for ( key in x hrCallback s ) { | |||||
| 8494 | xhrCal lbacks[ ke y ]( undef ined, true ); | |||||
| 8495 | } | |||||
| 8496 | }; | |||||
| 8497 | ||||||
| 8498 | // Functio ns to crea te xhrs | |||||
| 8499 | function c reateStand ardXHR() { | |||||
| 8500 | tr y { | |||||
| 8501 | retu rn new win dow.XMLHtt pRequest() ; | |||||
| 8502 | } catch( e ) {} | |||||
| 8503 | } | |||||
| 8504 | ||||||
| 8505 | function c reateActiv eXHR() { | |||||
| 8506 | tr y { | |||||
| 8507 | retu rn new win dow.Active XObject("M icrosoft.X MLHTTP"); | |||||
| 8508 | } catch( e ) {} | |||||
| 8509 | } | |||||
| 8510 | ||||||
| 8511 | // Create the reques t object | |||||
| 8512 | // (This i s still at tached to ajaxSettin gs for bac kward comp atibility) | |||||
| 8513 | jQuery.aja xSettings. xhr = wind ow.ActiveX Object ? | |||||
| 8514 | /* Microsoft failed to properly | |||||
| 8515 | * implement the XMLHt tpRequest in IE7 (ca n't reques t local fi les), | |||||
| 8516 | * so we use the Activ eXObject w hen it is available | |||||
| 8517 | * Additiona lly XMLHtt pRequest c an be disa bled in IE 7/IE8 so | |||||
| 8518 | * we need a fallback. | |||||
| 8519 | * / | |||||
| 8520 | fu nction() { | |||||
| 8521 | retu rn !this.i sLocal && createStan dardXHR() || createA ctiveXHR() ; | |||||
| 8522 | } : | |||||
| 8523 | // For all o ther brows ers, use t he standar d XMLHttpR equest obj ect | |||||
| 8524 | cr eateStanda rdXHR; | |||||
| 8525 | ||||||
| 8526 | // Determi ne support propertie s | |||||
| 8527 | xhrSupport ed = jQuer y.ajaxSett ings.xhr() ; | |||||
| 8528 | jQuery.sup port.cors = !!xhrSup ported && ( "withCre dentials" in xhrSupp orted ); | |||||
| 8529 | xhrSupport ed = jQuer y.support. ajax = !!x hrSupporte d; | |||||
| 8530 | ||||||
| 8531 | // Create transport if the bro wser can p rovide an xhr | |||||
| 8532 | if ( xhrSu pported ) { | |||||
| 8533 | ||||||
| 8534 | jQ uery.ajaxT ransport(f unction( s ) { | |||||
| 8535 | // C ross domai n only all owed if su pported th rough XMLH ttpRequest | |||||
| 8536 | if ( !s.crossD omain || j Query.supp ort.cors ) { | |||||
| 8537 | ||||||
| 8538 | var ca llback; | |||||
| 8539 | ||||||
| 8540 | return { | |||||
| 8541 | send: fu nction( he aders, com plete ) { | |||||
| 8542 | ||||||
| 8543 | // Get a n ew xhr | |||||
| 8544 | var handle , i, | |||||
| 8545 | xh r = s.xhr( ); | |||||
| 8546 | ||||||
| 8547 | // Open th e socket | |||||
| 8548 | // Passing null user name, gene rates a lo gin popup on Opera ( #2865) | |||||
| 8549 | if ( s.use rname ) { | |||||
| 8550 | xh r.open( s. type, s.ur l, s.async , s.userna me, s.pass word ); | |||||
| 8551 | } else { | |||||
| 8552 | xh r.open( s. type, s.ur l, s.async ); | |||||
| 8553 | } | |||||
| 8554 | ||||||
| 8555 | // Apply c ustom fiel ds if prov ided | |||||
| 8556 | if ( s.xhr Fields ) { | |||||
| 8557 | fo r ( i in s .xhrFields ) { | |||||
| 8558 | xhr[ i ] = s.x hrFields[ i ]; | |||||
| 8559 | } | |||||
| 8560 | } | |||||
| 8561 | ||||||
| 8562 | // Overrid e mime typ e if neede d | |||||
| 8563 | if ( s.mim eType && x hr.overrid eMimeType ) { | |||||
| 8564 | xh r.override MimeType( s.mimeType ); | |||||
| 8565 | } | |||||
| 8566 | ||||||
| 8567 | // X-Reque sted-With header | |||||
| 8568 | // For cro ss-domain requests, seeing as conditions for a pre flight are | |||||
| 8569 | // akin to a jigsaw puzzle, we simply ne ver set it to be sur e. | |||||
| 8570 | // (it can always be set on a per-reques t basis or even usin g ajaxSetu p) | |||||
| 8571 | // For sam e-domain r equests, w on't chang e header i f already provided. | |||||
| 8572 | if ( !s.cr ossDomain && !header s["X-Reque sted-With" ] ) { | |||||
| 8573 | he aders["X-R equested-W ith"] = "X MLHttpRequ est"; | |||||
| 8574 | } | |||||
| 8575 | ||||||
| 8576 | // Need an extra try /catch for cross dom ain reques ts in Fire fox 3 | |||||
| 8577 | try { | |||||
| 8578 | fo r ( i in h eaders ) { | |||||
| 8579 | xhr. setRequest Header( i, headers[ i ] ); | |||||
| 8580 | } | |||||
| 8581 | } catch( e rr ) {} | |||||
| 8582 | ||||||
| 8583 | // Do send the reque st | |||||
| 8584 | // This ma y raise an exception which is actually | |||||
| 8585 | // handled in jQuery .ajax (so no try/cat ch here) | |||||
| 8586 | xhr.send( ( s.hasCon tent && s. data ) || null ); | |||||
| 8587 | ||||||
| 8588 | // Listene r | |||||
| 8589 | callback = function( _, isAbor t ) { | |||||
| 8590 | va r status, responseHe aders, sta tusText, r esponses; | |||||
| 8591 | ||||||
| 8592 | // Firefox t hrows exce ptions whe n accessin g properti es | |||||
| 8593 | // of an xhr when a ne twork erro r occurred | |||||
| 8594 | // http://he lpful.knob s-dials.co m/index.ph p/Componen t_returned _failure_c ode:_0x800 40111_(NS_ ERROR_NOT_ AVAILABLE) | |||||
| 8595 | tr y { | |||||
| 8596 | ||||||
| 8597 | // W as never c alled and is aborted or comple te | |||||
| 8598 | if ( callback && ( isAbo rt || xhr. readyState === 4 ) ) { | |||||
| 8599 | ||||||
| 8600 | // Onl y called o nce | |||||
| 8601 | callba ck = undef ined; | |||||
| 8602 | ||||||
| 8603 | // Do not keep a s active a nymore | |||||
| 8604 | if ( h andle ) { | |||||
| 8605 | xhr.onre adystatech ange = jQu ery.noop; | |||||
| 8606 | if ( xhr OnUnloadAb ort ) { | |||||
| 8607 | delete xhr Callbacks[ handle ]; | |||||
| 8608 | } | |||||
| 8609 | } | |||||
| 8610 | ||||||
| 8611 | // If it's an ab ort | |||||
| 8612 | if ( i sAbort ) { | |||||
| 8613 | // Abort it manual ly if need ed | |||||
| 8614 | if ( xhr .readyStat e !== 4 ) { | |||||
| 8615 | xhr.abort( ); | |||||
| 8616 | } | |||||
| 8617 | } else { | |||||
| 8618 | response s = {}; | |||||
| 8619 | status = xhr.statu s; | |||||
| 8620 | response Headers = xhr.getAll ResponseHe aders(); | |||||
| 8621 | ||||||
| 8622 | // When requesting binary da ta, IE6-9 will throw an except ion | |||||
| 8623 | // on an y attempt to access responseTe xt (#11426 ) | |||||
| 8624 | if ( typ eof xhr.re sponseText === "stri ng" ) { | |||||
| 8625 | responses. text = xhr .responseT ext; | |||||
| 8626 | } | |||||
| 8627 | ||||||
| 8628 | // Firef ox throws an excepti on when ac cessing | |||||
| 8629 | // statu sText for faulty cro ss-domain requests | |||||
| 8630 | try { | |||||
| 8631 | statusText = xhr.sta tusText; | |||||
| 8632 | } catch( e ) { | |||||
| 8633 | // We norm alize with Webkit gi ving an em pty status Text | |||||
| 8634 | statusText = ""; | |||||
| 8635 | } | |||||
| 8636 | ||||||
| 8637 | // Filte r status f or non sta ndard beha viors | |||||
| 8638 | ||||||
| 8639 | // If th e request is local a nd we have data: ass ume a succ ess | |||||
| 8640 | // (succ ess with n o data won 't get not ified, tha t's the be st we | |||||
| 8641 | // can d o given cu rrent impl ementation s) | |||||
| 8642 | if ( !st atus && s. isLocal && !s.crossD omain ) { | |||||
| 8643 | status = r esponses.t ext ? 200 : 404; | |||||
| 8644 | // IE - #1450: som etimes ret urns 1223 when it sh ould be 20 4 | |||||
| 8645 | } else i f ( status === 1223 ) { | |||||
| 8646 | status = 2 04; | |||||
| 8647 | } | |||||
| 8648 | } | |||||
| 8649 | } | |||||
| 8650 | } catch( fir efoxAccess Exception ) { | |||||
| 8651 | if ( !isAbort ) { | |||||
| 8652 | comple te( -1, fi refoxAcces sException ); | |||||
| 8653 | } | |||||
| 8654 | } | |||||
| 8655 | ||||||
| 8656 | // Call comp lete if ne eded | |||||
| 8657 | if ( respons es ) { | |||||
| 8658 | comp lete( stat us, status Text, resp onses, res ponseHeade rs ); | |||||
| 8659 | } | |||||
| 8660 | }; | |||||
| 8661 | ||||||
| 8662 | if ( !s.as ync ) { | |||||
| 8663 | // if we're in sync mo de we fire the callb ack | |||||
| 8664 | ca llback(); | |||||
| 8665 | } else if ( xhr.read yState === 4 ) { | |||||
| 8666 | // (IE6 & IE 7) if it's in cache and has be en | |||||
| 8667 | // retrieved directly we need to fire the callback | |||||
| 8668 | se tTimeout( callback ) ; | |||||
| 8669 | } else { | |||||
| 8670 | ha ndle = ++x hrId; | |||||
| 8671 | if ( xhrOnUn loadAbort ) { | |||||
| 8672 | // C reate the active xhr s callback s list if needed | |||||
| 8673 | // a nd attach the unload handler | |||||
| 8674 | if ( !xhrCallb acks ) { | |||||
| 8675 | xhrCal lbacks = { }; | |||||
| 8676 | jQuery ( window ) .unload( x hrOnUnload Abort ); | |||||
| 8677 | } | |||||
| 8678 | // A dd to list of active xhrs call backs | |||||
| 8679 | xhrC allbacks[ handle ] = callback; | |||||
| 8680 | } | |||||
| 8681 | xh r.onreadys tatechange = callbac k; | |||||
| 8682 | } | |||||
| 8683 | }, | |||||
| 8684 | ||||||
| 8685 | abort: f unction() { | |||||
| 8686 | if ( callb ack ) { | |||||
| 8687 | ca llback( un defined, t rue ); | |||||
| 8688 | } | |||||
| 8689 | } | |||||
| 8690 | }; | |||||
| 8691 | } | |||||
| 8692 | }) ; | |||||
| 8693 | } | |||||
| 8694 | var fxNow, timerId, | |||||
| 8695 | rf xtypes = / ^(?:toggle |show|hide )$/, | |||||
| 8696 | rf xnum = new RegExp( " ^(?:([+-]) =|)(" + co re_pnum + ")([a-z%]* )$", "i" ) , | |||||
| 8697 | rr un = /queu eHooks$/, | |||||
| 8698 | an imationPre filters = [ defaultP refilter ] , | |||||
| 8699 | tw eeners = { | |||||
| 8700 | "*": [function ( prop, va lue ) { | |||||
| 8701 | var en d, unit, | |||||
| 8702 | tween = this.creat eTween( pr op, value ), | |||||
| 8703 | parts = rfxnum.exe c( value ) , | |||||
| 8704 | target = tween.cur (), | |||||
| 8705 | start = +target || 0, | |||||
| 8706 | scale = 1, | |||||
| 8707 | maxItera tions = 20 ; | |||||
| 8708 | ||||||
| 8709 | if ( p arts ) { | |||||
| 8710 | end = +p arts[2]; | |||||
| 8711 | unit = p arts[3] || ( jQuery. cssNumber[ prop ] ? "" : "px" ); | |||||
| 8712 | ||||||
| 8713 | // We ne ed to comp ute starti ng value | |||||
| 8714 | if ( uni t !== "px" && start ) { | |||||
| 8715 | // Iterati vely appro ximate fro m a nonzer o starting point | |||||
| 8716 | // Prefer the curren t property , because this proce ss will be trivial i f it uses the same u nits | |||||
| 8717 | // Fallbac k to end o r a simple constant | |||||
| 8718 | start = jQ uery.css( tween.elem , prop, tr ue ) || en d || 1; | |||||
| 8719 | ||||||
| 8720 | do { | |||||
| 8721 | // If previo us iterati on zeroed out, doubl e until we get *some thing* | |||||
| 8722 | // Use a str ing for do ubling fac tor so we don't acci dentally s ee scale a s unchange d below | |||||
| 8723 | sc ale = scal e || ".5"; | |||||
| 8724 | ||||||
| 8725 | // Adjust an d apply | |||||
| 8726 | st art = star t / scale; | |||||
| 8727 | jQ uery.style ( tween.el em, prop, start + un it ); | |||||
| 8728 | ||||||
| 8729 | // Update scale, tol erating ze ro or NaN from tween .cur() | |||||
| 8730 | // And bre aking the loop if sc ale is unc hanged or perfect, o r if we've just had enough | |||||
| 8731 | } while ( scale !== (scale = t ween.cur() / target) && scale !== 1 && - -maxIterat ions ); | |||||
| 8732 | } | |||||
| 8733 | ||||||
| 8734 | tween.un it = unit; | |||||
| 8735 | tween.st art = star t; | |||||
| 8736 | // If a +=/-= toke n was prov ided, we'r e doing a relative a nimation | |||||
| 8737 | tween.en d = parts[ 1] ? start + ( parts [1] + 1 ) * end : en d; | |||||
| 8738 | } | |||||
| 8739 | return tween; | |||||
| 8740 | }] | |||||
| 8741 | }; | |||||
| 8742 | ||||||
| 8743 | // Animati ons create d synchron ously will run synch ronously | |||||
| 8744 | function c reateFxNow () { | |||||
| 8745 | se tTimeout(f unction() { | |||||
| 8746 | fxNo w = undefi ned; | |||||
| 8747 | }) ; | |||||
| 8748 | re turn ( fxN ow = jQuer y.now() ); | |||||
| 8749 | } | |||||
| 8750 | ||||||
| 8751 | function c reateTween s( animati on, props ) { | |||||
| 8752 | jQ uery.each( props, fu nction( pr op, value ) { | |||||
| 8753 | var collection = ( tween ers[ prop ] || [] ). concat( tw eeners[ "* " ] ), | |||||
| 8754 | index = 0, | |||||
| 8755 | length = collect ion.length ; | |||||
| 8756 | for ( ; index < length; index++ ) { | |||||
| 8757 | if ( c ollection[ index ].c all( anima tion, prop , value ) ) { | |||||
| 8758 | ||||||
| 8759 | // we're done with this prop erty | |||||
| 8760 | return; | |||||
| 8761 | } | |||||
| 8762 | } | |||||
| 8763 | }) ; | |||||
| 8764 | } | |||||
| 8765 | ||||||
| 8766 | function A nimation( elem, prop erties, op tions ) { | |||||
| 8767 | va r result, | |||||
| 8768 | stop ped, | |||||
| 8769 | inde x = 0, | |||||
| 8770 | leng th = anima tionPrefil ters.lengt h, | |||||
| 8771 | defe rred = jQu ery.Deferr ed().alway s( functio n() { | |||||
| 8772 | // don 't match e lem in the :animated selector | |||||
| 8773 | delete tick.elem ; | |||||
| 8774 | }), | |||||
| 8775 | tick = functio n() { | |||||
| 8776 | if ( s topped ) { | |||||
| 8777 | return f alse; | |||||
| 8778 | } | |||||
| 8779 | var cu rrentTime = fxNow || createFxN ow(), | |||||
| 8780 | remainin g = Math.m ax( 0, ani mation.sta rtTime + a nimation.d uration - currentTim e ), | |||||
| 8781 | // archa ic crash b ug won't a llow us to use 1 - ( 0.5 || 0 ) (#12497) | |||||
| 8782 | temp = r emaining / animation .duration || 0, | |||||
| 8783 | percent = 1 - temp , | |||||
| 8784 | index = 0, | |||||
| 8785 | length = animation .tweens.le ngth; | |||||
| 8786 | ||||||
| 8787 | for ( ; index < length ; i ndex++ ) { | |||||
| 8788 | animatio n.tweens[ index ].ru n( percent ); | |||||
| 8789 | } | |||||
| 8790 | ||||||
| 8791 | deferr ed.notifyW ith( elem, [ animati on, percen t, remaini ng ]); | |||||
| 8792 | ||||||
| 8793 | if ( p ercent < 1 && length ) { | |||||
| 8794 | return r emaining; | |||||
| 8795 | } else { | |||||
| 8796 | deferred .resolveWi th( elem, [ animatio n ] ); | |||||
| 8797 | return f alse; | |||||
| 8798 | } | |||||
| 8799 | }, | |||||
| 8800 | anim ation = de ferred.pro mise({ | |||||
| 8801 | elem: elem, | |||||
| 8802 | props: jQuery.ex tend( {}, properties ), | |||||
| 8803 | opts: jQuery.ext end( true, { special Easing: {} }, option s ), | |||||
| 8804 | origin alProperti es: proper ties, | |||||
| 8805 | origin alOptions: options, | |||||
| 8806 | startT ime: fxNow || create FxNow(), | |||||
| 8807 | durati on: option s.duration , | |||||
| 8808 | tweens : [], | |||||
| 8809 | create Tween: fun ction( pro p, end ) { | |||||
| 8810 | var twee n = jQuery .Tween( el em, animat ion.opts, prop, end, | |||||
| 8811 | an imation.op ts.special Easing[ pr op ] || an imation.op ts.easing ); | |||||
| 8812 | animatio n.tweens.p ush( tween ); | |||||
| 8813 | return t ween; | |||||
| 8814 | }, | |||||
| 8815 | stop: function( gotoEnd ) { | |||||
| 8816 | var inde x = 0, | |||||
| 8817 | // if we a re going t o the end, we want t o run all the tweens | |||||
| 8818 | // otherwi se we skip this part | |||||
| 8819 | length = g otoEnd ? a nimation.t weens.leng th : 0; | |||||
| 8820 | if ( sto pped ) { | |||||
| 8821 | return thi s; | |||||
| 8822 | } | |||||
| 8823 | stopped = true; | |||||
| 8824 | for ( ; index < le ngth ; ind ex++ ) { | |||||
| 8825 | animation. tweens[ in dex ].run( 1 ); | |||||
| 8826 | } | |||||
| 8827 | ||||||
| 8828 | // resol ve when we played th e last fra me | |||||
| 8829 | // other wise, reje ct | |||||
| 8830 | if ( got oEnd ) { | |||||
| 8831 | deferred.r esolveWith ( elem, [ animation, gotoEnd ] ); | |||||
| 8832 | } else { | |||||
| 8833 | deferred.r ejectWith( elem, [ a nimation, gotoEnd ] ); | |||||
| 8834 | } | |||||
| 8835 | return t his; | |||||
| 8836 | } | |||||
| 8837 | }), | |||||
| 8838 | prop s = animat ion.props; | |||||
| 8839 | ||||||
| 8840 | pr opFilter( props, ani mation.opt s.specialE asing ); | |||||
| 8841 | ||||||
| 8842 | fo r ( ; inde x < length ; index++ ) { | |||||
| 8843 | resu lt = anima tionPrefil ters[ inde x ].call( animation, elem, pro ps, animat ion.opts ) ; | |||||
| 8844 | if ( result ) { | |||||
| 8845 | return result; | |||||
| 8846 | } | |||||
| 8847 | } | |||||
| 8848 | ||||||
| 8849 | cr eateTweens ( animatio n, props ) ; | |||||
| 8850 | ||||||
| 8851 | if ( jQuery. isFunction ( animatio n.opts.sta rt ) ) { | |||||
| 8852 | anim ation.opts .start.cal l( elem, a nimation ) ; | |||||
| 8853 | } | |||||
| 8854 | ||||||
| 8855 | jQ uery.fx.ti mer( | |||||
| 8856 | jQue ry.extend( tick, { | |||||
| 8857 | elem: elem, | |||||
| 8858 | anim: animation, | |||||
| 8859 | queue: animation .opts.queu e | |||||
| 8860 | }) | |||||
| 8861 | ); | |||||
| 8862 | ||||||
| 8863 | // attach ca llbacks fr om options | |||||
| 8864 | re turn anima tion.progr ess( anima tion.opts. progress ) | |||||
| 8865 | .don e( animati on.opts.do ne, animat ion.opts.c omplete ) | |||||
| 8866 | .fai l( animati on.opts.fa il ) | |||||
| 8867 | .alw ays( anima tion.opts. always ); | |||||
| 8868 | } | |||||
| 8869 | ||||||
| 8870 | function p ropFilter( props, sp ecialEasin g ) { | |||||
| 8871 | va r value, n ame, index , easing, hooks; | |||||
| 8872 | ||||||
| 8873 | // camelCase , specialE asing and expand css Hook pass | |||||
| 8874 | fo r ( index in props ) { | |||||
| 8875 | name = jQuery. camelCase( index ); | |||||
| 8876 | easi ng = speci alEasing[ name ]; | |||||
| 8877 | valu e = props[ index ]; | |||||
| 8878 | if ( jQuery.is Array( val ue ) ) { | |||||
| 8879 | easing = value[ 1 ]; | |||||
| 8880 | value = props[ i ndex ] = v alue[ 0 ]; | |||||
| 8881 | } | |||||
| 8882 | ||||||
| 8883 | if ( index !== name ) { | |||||
| 8884 | props[ name ] = value; | |||||
| 8885 | delete props[ in dex ]; | |||||
| 8886 | } | |||||
| 8887 | ||||||
| 8888 | hook s = jQuery .cssHooks[ name ]; | |||||
| 8889 | if ( hooks && "expand" i n hooks ) { | |||||
| 8890 | value = hooks.ex pand( valu e ); | |||||
| 8891 | delete props[ na me ]; | |||||
| 8892 | ||||||
| 8893 | // not quite $.e xtend, thi s wont ove rwrite key s already present. | |||||
| 8894 | // als o - reusin g 'index' from above because w e have the correct " name" | |||||
| 8895 | for ( index in v alue ) { | |||||
| 8896 | if ( !( index in p rops ) ) { | |||||
| 8897 | props[ ind ex ] = val ue[ index ]; | |||||
| 8898 | specialEas ing[ index ] = easin g; | |||||
| 8899 | } | |||||
| 8900 | } | |||||
| 8901 | } el se { | |||||
| 8902 | specia lEasing[ n ame ] = ea sing; | |||||
| 8903 | } | |||||
| 8904 | } | |||||
| 8905 | } | |||||
| 8906 | ||||||
| 8907 | jQuery.Ani mation = j Query.exte nd( Animat ion, { | |||||
| 8908 | ||||||
| 8909 | tw eener: fun ction( pro ps, callba ck ) { | |||||
| 8910 | if ( jQuery.is Function( props ) ) { | |||||
| 8911 | callba ck = props ; | |||||
| 8912 | props = [ "*" ]; | |||||
| 8913 | } el se { | |||||
| 8914 | props = props.sp lit(" "); | |||||
| 8915 | } | |||||
| 8916 | ||||||
| 8917 | var prop, | |||||
| 8918 | index = 0, | |||||
| 8919 | length = props.l ength; | |||||
| 8920 | ||||||
| 8921 | for ( ; index < length ; index++ ) { | |||||
| 8922 | prop = props[ in dex ]; | |||||
| 8923 | tweene rs[ prop ] = tweener s[ prop ] || []; | |||||
| 8924 | tweene rs[ prop ] .unshift( callback ) ; | |||||
| 8925 | } | |||||
| 8926 | }, | |||||
| 8927 | ||||||
| 8928 | pr efilter: f unction( c allback, p repend ) { | |||||
| 8929 | if ( prepend ) { | |||||
| 8930 | animat ionPrefilt ers.unshif t( callbac k ); | |||||
| 8931 | } el se { | |||||
| 8932 | animat ionPrefilt ers.push( callback ) ; | |||||
| 8933 | } | |||||
| 8934 | } | |||||
| 8935 | }); | |||||
| 8936 | ||||||
| 8937 | function d efaultPref ilter( ele m, props, opts ) { | |||||
| 8938 | /* jshint val idthis:tru e */ | |||||
| 8939 | va r prop, in dex, lengt h, | |||||
| 8940 | valu e, dataSho w, toggle, | |||||
| 8941 | twee n, hooks, oldfire, | |||||
| 8942 | anim = this, | |||||
| 8943 | styl e = elem.s tyle, | |||||
| 8944 | orig = {}, | |||||
| 8945 | hand led = [], | |||||
| 8946 | hidd en = elem. nodeType & & isHidden ( elem ); | |||||
| 8947 | ||||||
| 8948 | // handle qu eue: false promises | |||||
| 8949 | if ( !opts.q ueue ) { | |||||
| 8950 | hook s = jQuery ._queueHoo ks( elem, "fx" ); | |||||
| 8951 | if ( hooks.unq ueued == n ull ) { | |||||
| 8952 | hooks. unqueued = 0; | |||||
| 8953 | oldfir e = hooks. empty.fire ; | |||||
| 8954 | hooks. empty.fire = functio n() { | |||||
| 8955 | if ( !ho oks.unqueu ed ) { | |||||
| 8956 | oldfire(); | |||||
| 8957 | } | |||||
| 8958 | }; | |||||
| 8959 | } | |||||
| 8960 | hook s.unqueued ++; | |||||
| 8961 | ||||||
| 8962 | anim .always(fu nction() { | |||||
| 8963 | // doi ng this ma kes sure t hat the co mplete han dler will be called | |||||
| 8964 | // bef ore this c ompletes | |||||
| 8965 | anim.a lways(func tion() { | |||||
| 8966 | hooks.un queued--; | |||||
| 8967 | if ( !jQ uery.queue ( elem, "f x" ).lengt h ) { | |||||
| 8968 | hooks.empt y.fire(); | |||||
| 8969 | } | |||||
| 8970 | }); | |||||
| 8971 | }); | |||||
| 8972 | } | |||||
| 8973 | ||||||
| 8974 | // height/wi dth overfl ow pass | |||||
| 8975 | if ( elem.no deType === 1 && ( "h eight" in props || " width" in props ) ) { | |||||
| 8976 | // M ake sure t hat nothin g sneaks o ut | |||||
| 8977 | // R ecord all 3 overflow attribute s because IE does no t | |||||
| 8978 | // c hange the overflow a ttribute w hen overfl owX and | |||||
| 8979 | // o verflowY a re set to the same v alue | |||||
| 8980 | opts .overflow = [ style. overflow, style.over flowX, sty le.overflo wY ]; | |||||
| 8981 | ||||||
| 8982 | // S et display property to inline- block for height/wid th | |||||
| 8983 | // a nimations on inline elements t hat are ha ving width /height an imated | |||||
| 8984 | if ( jQuery.cs s( elem, " display" ) === "inli ne" && | |||||
| 8985 | jQuery.c ss( elem, "float" ) === "none" ) { | |||||
| 8986 | ||||||
| 8987 | // inl ine-level elements a ccept inli ne-block; | |||||
| 8988 | // blo ck-level e lements ne ed to be i nline with layout | |||||
| 8989 | if ( ! jQuery.sup port.inlin eBlockNeed sLayout || css_defau ltDisplay( elem.node Name ) === "inline" ) { | |||||
| 8990 | style.di splay = "i nline-bloc k"; | |||||
| 8991 | ||||||
| 8992 | } else { | |||||
| 8993 | style.zo om = 1; | |||||
| 8994 | } | |||||
| 8995 | } | |||||
| 8996 | } | |||||
| 8997 | ||||||
| 8998 | if ( opts.ov erflow ) { | |||||
| 8999 | styl e.overflow = "hidden "; | |||||
| 9000 | if ( !jQuery.s upport.shr inkWrapBlo cks ) { | |||||
| 9001 | anim.a lways(func tion() { | |||||
| 9002 | style.ov erflow = o pts.overfl ow[ 0 ]; | |||||
| 9003 | style.ov erflowX = opts.overf low[ 1 ]; | |||||
| 9004 | style.ov erflowY = opts.overf low[ 2 ]; | |||||
| 9005 | }); | |||||
| 9006 | } | |||||
| 9007 | } | |||||
| 9008 | ||||||
| 9009 | ||||||
| 9010 | // show/hide pass | |||||
| 9011 | fo r ( index in props ) { | |||||
| 9012 | valu e = props[ index ]; | |||||
| 9013 | if ( rfxtypes. exec( valu e ) ) { | |||||
| 9014 | delete props[ in dex ]; | |||||
| 9015 | toggle = toggle || value = == "toggle "; | |||||
| 9016 | if ( v alue === ( hidden ? "hide" : " show" ) ) { | |||||
| 9017 | continue ; | |||||
| 9018 | } | |||||
| 9019 | handle d.push( in dex ); | |||||
| 9020 | } | |||||
| 9021 | } | |||||
| 9022 | ||||||
| 9023 | le ngth = han dled.lengt h; | |||||
| 9024 | if ( length ) { | |||||
| 9025 | data Show = jQu ery._data( elem, "fx show" ) || jQuery._d ata( elem, "fxshow", {} ); | |||||
| 9026 | if ( "hidden" in dataSho w ) { | |||||
| 9027 | hidden = dataSho w.hidden; | |||||
| 9028 | } | |||||
| 9029 | ||||||
| 9030 | // s tore state if its to ggle - ena bles .stop ().toggle( ) to "reve rse" | |||||
| 9031 | if ( toggle ) { | |||||
| 9032 | dataSh ow.hidden = !hidden; | |||||
| 9033 | } | |||||
| 9034 | if ( hidden ) { | |||||
| 9035 | jQuery ( elem ).s how(); | |||||
| 9036 | } el se { | |||||
| 9037 | anim.d one(functi on() { | |||||
| 9038 | jQuery( elem ).hid e(); | |||||
| 9039 | }); | |||||
| 9040 | } | |||||
| 9041 | anim .done(func tion() { | |||||
| 9042 | var pr op; | |||||
| 9043 | jQuery ._removeDa ta( elem, "fxshow" ) ; | |||||
| 9044 | for ( prop in or ig ) { | |||||
| 9045 | jQuery.s tyle( elem , prop, or ig[ prop ] ); | |||||
| 9046 | } | |||||
| 9047 | }); | |||||
| 9048 | for ( index = 0 ; index < length ; index++ ) { | |||||
| 9049 | prop = handled[ index ]; | |||||
| 9050 | tween = anim.cre ateTween( prop, hidd en ? dataS how[ prop ] : 0 ); | |||||
| 9051 | orig[ prop ] = d ataShow[ p rop ] || j Query.styl e( elem, p rop ); | |||||
| 9052 | ||||||
| 9053 | if ( ! ( prop in dataShow ) ) { | |||||
| 9054 | dataShow [ prop ] = tween.sta rt; | |||||
| 9055 | if ( hid den ) { | |||||
| 9056 | tween.end = tween.st art; | |||||
| 9057 | tween.star t = prop = == "width" || prop = == "height " ? 1 : 0; | |||||
| 9058 | } | |||||
| 9059 | } | |||||
| 9060 | } | |||||
| 9061 | } | |||||
| 9062 | } | |||||
| 9063 | ||||||
| 9064 | function T ween( elem , options, prop, end , easing ) { | |||||
| 9065 | re turn new T ween.proto type.init( elem, opt ions, prop , end, eas ing ); | |||||
| 9066 | } | |||||
| 9067 | jQuery.Twe en = Tween ; | |||||
| 9068 | ||||||
| 9069 | Tween.prot otype = { | |||||
| 9070 | co nstructor: Tween, | |||||
| 9071 | in it: functi on( elem, options, p rop, end, easing, un it ) { | |||||
| 9072 | this .elem = el em; | |||||
| 9073 | this .prop = pr op; | |||||
| 9074 | this .easing = easing || "swing"; | |||||
| 9075 | this .options = options; | |||||
| 9076 | this .start = t his.now = this.cur() ; | |||||
| 9077 | this .end = end ; | |||||
| 9078 | this .unit = un it || ( jQ uery.cssNu mber[ prop ] ? "" : "px" ); | |||||
| 9079 | }, | |||||
| 9080 | cu r: functio n() { | |||||
| 9081 | var hooks = Tw een.propHo oks[ this. prop ]; | |||||
| 9082 | ||||||
| 9083 | retu rn hooks & & hooks.ge t ? | |||||
| 9084 | hooks. get( this ) : | |||||
| 9085 | Tween. propHooks. _default.g et( this ) ; | |||||
| 9086 | }, | |||||
| 9087 | ru n: functio n( percent ) { | |||||
| 9088 | var eased, | |||||
| 9089 | hooks = Tween.pr opHooks[ t his.prop ] ; | |||||
| 9090 | ||||||
| 9091 | if ( this.opti ons.durati on ) { | |||||
| 9092 | this.p os = eased = jQuery. easing[ th is.easing ]( | |||||
| 9093 | percent, this.opti ons.durati on * perce nt, 0, 1, this.optio ns.duratio n | |||||
| 9094 | ); | |||||
| 9095 | } el se { | |||||
| 9096 | this.p os = eased = percent ; | |||||
| 9097 | } | |||||
| 9098 | this .now = ( t his.end - this.start ) * eased + this.st art; | |||||
| 9099 | ||||||
| 9100 | if ( this.opti ons.step ) { | |||||
| 9101 | this.o ptions.ste p.call( th is.elem, t his.now, t his ); | |||||
| 9102 | } | |||||
| 9103 | ||||||
| 9104 | if ( hooks && hooks.set ) { | |||||
| 9105 | hooks. set( this ); | |||||
| 9106 | } el se { | |||||
| 9107 | Tween. propHooks. _default.s et( this ) ; | |||||
| 9108 | } | |||||
| 9109 | retu rn this; | |||||
| 9110 | } | |||||
| 9111 | }; | |||||
| 9112 | ||||||
| 9113 | Tween.prot otype.init .prototype = Tween.p rototype; | |||||
| 9114 | ||||||
| 9115 | Tween.prop Hooks = { | |||||
| 9116 | _d efault: { | |||||
| 9117 | get: function( tween ) { | |||||
| 9118 | var re sult; | |||||
| 9119 | ||||||
| 9120 | if ( t ween.elem[ tween.pro p ] != nul l && | |||||
| 9121 | (!tween. elem.style || tween. elem.style [ tween.pr op ] == nu ll) ) { | |||||
| 9122 | return t ween.elem[ tween.pro p ]; | |||||
| 9123 | } | |||||
| 9124 | ||||||
| 9125 | // pas sing an em pty string as a 3rd parameter to .css wi ll automat ically | |||||
| 9126 | // att empt a par seFloat an d fallback to a stri ng if the parse fail s | |||||
| 9127 | // so, simple va lues such as "10px" are parsed to Float. | |||||
| 9128 | // com plex value s such as "rotate(1r ad)" are r eturned as is. | |||||
| 9129 | result = jQuery. css( tween .elem, twe en.prop, " " ); | |||||
| 9130 | // Emp ty strings , null, un defined an d "auto" a re convert ed to 0. | |||||
| 9131 | return !result | | result = == "auto" ? 0 : resu lt; | |||||
| 9132 | }, | |||||
| 9133 | set: function( tween ) { | |||||
| 9134 | // use step hook for back compat - u se cssHook if its th ere - use .style if its | |||||
| 9135 | // ava ilable and use plain propertie s where av ailable | |||||
| 9136 | if ( j Query.fx.s tep[ tween .prop ] ) { | |||||
| 9137 | jQuery.f x.step[ tw een.prop ] ( tween ); | |||||
| 9138 | } else if ( twee n.elem.sty le && ( tw een.elem.s tyle[ jQue ry.cssProp s[ tween.p rop ] ] != null || j Query.cssH ooks[ twee n.prop ] ) ) { | |||||
| 9139 | jQuery.s tyle( twee n.elem, tw een.prop, tween.now + tween.un it ); | |||||
| 9140 | } else { | |||||
| 9141 | tween.el em[ tween. prop ] = t ween.now; | |||||
| 9142 | } | |||||
| 9143 | } | |||||
| 9144 | } | |||||
| 9145 | }; | |||||
| 9146 | ||||||
| 9147 | // Remove in 2.0 - t his suppor ts IE8's p anic based approach | |||||
| 9148 | // to sett ing things on discon nected nod es | |||||
| 9149 | ||||||
| 9150 | Tween.prop Hooks.scro llTop = Tw een.propHo oks.scroll Left = { | |||||
| 9151 | se t: functio n( tween ) { | |||||
| 9152 | if ( tween.ele m.nodeType && tween. elem.paren tNode ) { | |||||
| 9153 | tween. elem[ twee n.prop ] = tween.now ; | |||||
| 9154 | } | |||||
| 9155 | } | |||||
| 9156 | }; | |||||
| 9157 | ||||||
| 9158 | jQuery.eac h([ "toggl e", "show" , "hide" ] , function ( i, name ) { | |||||
| 9159 | va r cssFn = jQuery.fn[ name ]; | |||||
| 9160 | jQ uery.fn[ n ame ] = fu nction( sp eed, easin g, callbac k ) { | |||||
| 9161 | retu rn speed = = null || typeof spe ed === "bo olean" ? | |||||
| 9162 | cssFn. apply( thi s, argumen ts ) : | |||||
| 9163 | this.a nimate( ge nFx( name, true ), s peed, easi ng, callba ck ); | |||||
| 9164 | }; | |||||
| 9165 | }); | |||||
| 9166 | ||||||
| 9167 | jQuery.fn. extend({ | |||||
| 9168 | fa deTo: func tion( spee d, to, eas ing, callb ack ) { | |||||
| 9169 | ||||||
| 9170 | // s how any hi dden eleme nts after setting op acity to 0 | |||||
| 9171 | retu rn this.fi lter( isHi dden ).css ( "opacity ", 0 ).sho w() | |||||
| 9172 | ||||||
| 9173 | // ani mate to th e value sp ecified | |||||
| 9174 | .end() .animate({ opacity: to }, spee d, easing, callback ); | |||||
| 9175 | }, | |||||
| 9176 | an imate: fun ction( pro p, speed, easing, ca llback ) { | |||||
| 9177 | var empty = jQ uery.isEmp tyObject( prop ), | |||||
| 9178 | optall = jQuery. speed( spe ed, easing , callback ), | |||||
| 9179 | doAnim ation = fu nction() { | |||||
| 9180 | // Opera te on a co py of prop so per-pr operty eas ing won't be lost | |||||
| 9181 | var anim = Animati on( this, jQuery.ext end( {}, p rop ), opt all ); | |||||
| 9182 | doAnimat ion.finish = functio n() { | |||||
| 9183 | anim.stop( true ); | |||||
| 9184 | }; | |||||
| 9185 | // Empty animation s, or fini shing reso lves immed iately | |||||
| 9186 | if ( emp ty || jQue ry._data( this, "fin ish" ) ) { | |||||
| 9187 | anim.stop( true ); | |||||
| 9188 | } | |||||
| 9189 | }; | |||||
| 9190 | doAnim ation.fini sh = doAni mation; | |||||
| 9191 | ||||||
| 9192 | retu rn empty | | optall.q ueue === f alse ? | |||||
| 9193 | this.e ach( doAni mation ) : | |||||
| 9194 | this.q ueue( opta ll.queue, doAnimatio n ); | |||||
| 9195 | }, | |||||
| 9196 | st op: functi on( type, clearQueue , gotoEnd ) { | |||||
| 9197 | var stopQueue = function ( hooks ) { | |||||
| 9198 | var st op = hooks .stop; | |||||
| 9199 | delete hooks.sto p; | |||||
| 9200 | stop( gotoEnd ); | |||||
| 9201 | }; | |||||
| 9202 | ||||||
| 9203 | if ( typeof ty pe !== "st ring" ) { | |||||
| 9204 | gotoEn d = clearQ ueue; | |||||
| 9205 | clearQ ueue = typ e; | |||||
| 9206 | type = undefined ; | |||||
| 9207 | } | |||||
| 9208 | if ( clearQueu e && type !== false ) { | |||||
| 9209 | this.q ueue( type || "fx", [] ); | |||||
| 9210 | } | |||||
| 9211 | ||||||
| 9212 | retu rn this.ea ch(functio n() { | |||||
| 9213 | var de queue = tr ue, | |||||
| 9214 | index = type != nu ll && type + "queueH ooks", | |||||
| 9215 | timers = jQuery.ti mers, | |||||
| 9216 | data = j Query._dat a( this ); | |||||
| 9217 | ||||||
| 9218 | if ( i ndex ) { | |||||
| 9219 | if ( dat a[ index ] && data[ index ].st op ) { | |||||
| 9220 | stopQueue( data[ ind ex ] ); | |||||
| 9221 | } | |||||
| 9222 | } else { | |||||
| 9223 | for ( in dex in dat a ) { | |||||
| 9224 | if ( data[ index ] & & data[ in dex ].stop && rrun.t est( index ) ) { | |||||
| 9225 | st opQueue( d ata[ index ] ); | |||||
| 9226 | } | |||||
| 9227 | } | |||||
| 9228 | } | |||||
| 9229 | ||||||
| 9230 | for ( index = ti mers.lengt h; index-- ; ) { | |||||
| 9231 | if ( tim ers[ index ].elem == = this && (type == n ull || tim ers[ index ].queue = == type) ) { | |||||
| 9232 | timers[ in dex ].anim .stop( got oEnd ); | |||||
| 9233 | dequeue = false; | |||||
| 9234 | timers.spl ice( index , 1 ); | |||||
| 9235 | } | |||||
| 9236 | } | |||||
| 9237 | ||||||
| 9238 | // sta rt the nex t in the q ueue if th e last ste p wasn't f orced | |||||
| 9239 | // tim ers curren tly will c all their complete c allbacks, which will dequeue | |||||
| 9240 | // but only if t hey were g otoEnd | |||||
| 9241 | if ( d equeue || !gotoEnd ) { | |||||
| 9242 | jQuery.d equeue( th is, type ) ; | |||||
| 9243 | } | |||||
| 9244 | }); | |||||
| 9245 | }, | |||||
| 9246 | fi nish: func tion( type ) { | |||||
| 9247 | if ( type !== false ) { | |||||
| 9248 | type = type || " fx"; | |||||
| 9249 | } | |||||
| 9250 | retu rn this.ea ch(functio n() { | |||||
| 9251 | var in dex, | |||||
| 9252 | data = j Query._dat a( this ), | |||||
| 9253 | queue = data[ type + "queue" ], | |||||
| 9254 | hooks = data[ type + "queueH ooks" ], | |||||
| 9255 | timers = jQuery.ti mers, | |||||
| 9256 | length = queue ? q ueue.lengt h : 0; | |||||
| 9257 | ||||||
| 9258 | // ena ble finish ing flag o n private data | |||||
| 9259 | data.f inish = tr ue; | |||||
| 9260 | ||||||
| 9261 | // emp ty the que ue first | |||||
| 9262 | jQuery .queue( th is, type, [] ); | |||||
| 9263 | ||||||
| 9264 | if ( h ooks && ho oks.cur && hooks.cur .finish ) { | |||||
| 9265 | hooks.cu r.finish.c all( this ); | |||||
| 9266 | } | |||||
| 9267 | ||||||
| 9268 | // loo k for any active ani mations, a nd finish them | |||||
| 9269 | for ( index = ti mers.lengt h; index-- ; ) { | |||||
| 9270 | if ( tim ers[ index ].elem == = this && timers[ in dex ].queu e === type ) { | |||||
| 9271 | timers[ in dex ].anim .stop( tru e ); | |||||
| 9272 | timers.spl ice( index , 1 ); | |||||
| 9273 | } | |||||
| 9274 | } | |||||
| 9275 | ||||||
| 9276 | // loo k for any animations in the ol d queue an d finish t hem | |||||
| 9277 | for ( index = 0; index < l ength; ind ex++ ) { | |||||
| 9278 | if ( que ue[ index ] && queue [ index ]. finish ) { | |||||
| 9279 | queue[ ind ex ].finis h.call( th is ); | |||||
| 9280 | } | |||||
| 9281 | } | |||||
| 9282 | ||||||
| 9283 | // tur n off fini shing flag | |||||
| 9284 | delete data.fini sh; | |||||
| 9285 | }); | |||||
| 9286 | } | |||||
| 9287 | }); | |||||
| 9288 | ||||||
| 9289 | // Generat e paramete rs to crea te a stand ard animat ion | |||||
| 9290 | function g enFx( type , includeW idth ) { | |||||
| 9291 | va r which, | |||||
| 9292 | attr s = { heig ht: type } , | |||||
| 9293 | i = 0; | |||||
| 9294 | ||||||
| 9295 | // if we inc lude width , step val ue is 1 to do all cs sExpand va lues, | |||||
| 9296 | // if we don 't include width, st ep value i s 2 to ski p over Lef t and Righ t | |||||
| 9297 | in cludeWidth = include Width? 1 : 0; | |||||
| 9298 | fo r( ; i < 4 ; i += 2 - includeW idth ) { | |||||
| 9299 | whic h = cssExp and[ i ]; | |||||
| 9300 | attr s[ "margin " + which ] = attrs[ "padding" + which ] = type; | |||||
| 9301 | } | |||||
| 9302 | ||||||
| 9303 | if ( include Width ) { | |||||
| 9304 | attr s.opacity = attrs.wi dth = type ; | |||||
| 9305 | } | |||||
| 9306 | ||||||
| 9307 | re turn attrs ; | |||||
| 9308 | } | |||||
| 9309 | ||||||
| 9310 | // Generat e shortcut s for cust om animati ons | |||||
| 9311 | jQuery.eac h({ | |||||
| 9312 | sl ideDown: g enFx("show "), | |||||
| 9313 | sl ideUp: gen Fx("hide") , | |||||
| 9314 | sl ideToggle: genFx("to ggle"), | |||||
| 9315 | fa deIn: { op acity: "sh ow" }, | |||||
| 9316 | fa deOut: { o pacity: "h ide" }, | |||||
| 9317 | fa deToggle: { opacity: "toggle" } | |||||
| 9318 | }, functio n( name, p rops ) { | |||||
| 9319 | jQ uery.fn[ n ame ] = fu nction( sp eed, easin g, callbac k ) { | |||||
| 9320 | retu rn this.an imate( pro ps, speed, easing, c allback ); | |||||
| 9321 | }; | |||||
| 9322 | }); | |||||
| 9323 | ||||||
| 9324 | jQuery.spe ed = funct ion( speed , easing, fn ) { | |||||
| 9325 | va r opt = sp eed && typ eof speed === "objec t" ? jQuer y.extend( {}, speed ) : { | |||||
| 9326 | comp lete: fn | | !fn && e asing || | |||||
| 9327 | jQuery .isFunctio n( speed ) && speed, | |||||
| 9328 | dura tion: spee d, | |||||
| 9329 | easi ng: fn && easing || easing && !jQuery.is Function( easing ) & & easing | |||||
| 9330 | }; | |||||
| 9331 | ||||||
| 9332 | op t.duration = jQuery. fx.off ? 0 : typeof opt.durati on === "nu mber" ? op t.duration : | |||||
| 9333 | opt. duration i n jQuery.f x.speeds ? jQuery.fx .speeds[ o pt.duratio n ] : jQue ry.fx.spee ds._defaul t; | |||||
| 9334 | ||||||
| 9335 | // normalize opt.queue - true/un defined/nu ll -> "fx" | |||||
| 9336 | if ( opt.que ue == null || opt.qu eue === tr ue ) { | |||||
| 9337 | opt. queue = "f x"; | |||||
| 9338 | } | |||||
| 9339 | ||||||
| 9340 | // Queueing | |||||
| 9341 | op t.old = op t.complete ; | |||||
| 9342 | ||||||
| 9343 | op t.complete = functio n() { | |||||
| 9344 | if ( jQuery.is Function( opt.old ) ) { | |||||
| 9345 | opt.ol d.call( th is ); | |||||
| 9346 | } | |||||
| 9347 | ||||||
| 9348 | if ( opt.queue ) { | |||||
| 9349 | jQuery .dequeue( this, opt. queue ); | |||||
| 9350 | } | |||||
| 9351 | }; | |||||
| 9352 | ||||||
| 9353 | re turn opt; | |||||
| 9354 | }; | |||||
| 9355 | ||||||
| 9356 | jQuery.eas ing = { | |||||
| 9357 | li near: func tion( p ) { | |||||
| 9358 | retu rn p; | |||||
| 9359 | }, | |||||
| 9360 | sw ing: funct ion( p ) { | |||||
| 9361 | retu rn 0.5 - M ath.cos( p *Math.PI ) / 2; | |||||
| 9362 | } | |||||
| 9363 | }; | |||||
| 9364 | ||||||
| 9365 | jQuery.tim ers = []; | |||||
| 9366 | jQuery.fx = Tween.pr ototype.in it; | |||||
| 9367 | jQuery.fx. tick = fun ction() { | |||||
| 9368 | va r timer, | |||||
| 9369 | time rs = jQuer y.timers, | |||||
| 9370 | i = 0; | |||||
| 9371 | ||||||
| 9372 | fx Now = jQue ry.now(); | |||||
| 9373 | ||||||
| 9374 | fo r ( ; i < timers.len gth; i++ ) { | |||||
| 9375 | time r = timers [ i ]; | |||||
| 9376 | // C hecks the timer has not alread y been rem oved | |||||
| 9377 | if ( !timer() && timers[ i ] === t imer ) { | |||||
| 9378 | timers .splice( i --, 1 ); | |||||
| 9379 | } | |||||
| 9380 | } | |||||
| 9381 | ||||||
| 9382 | if ( !timers .length ) { | |||||
| 9383 | jQue ry.fx.stop (); | |||||
| 9384 | } | |||||
| 9385 | fx Now = unde fined; | |||||
| 9386 | }; | |||||
| 9387 | ||||||
| 9388 | jQuery.fx. timer = fu nction( ti mer ) { | |||||
| 9389 | if ( timer() && jQuery .timers.pu sh( timer ) ) { | |||||
| 9390 | jQue ry.fx.star t(); | |||||
| 9391 | } | |||||
| 9392 | }; | |||||
| 9393 | ||||||
| 9394 | jQuery.fx. interval = 13; | |||||
| 9395 | ||||||
| 9396 | jQuery.fx. start = fu nction() { | |||||
| 9397 | if ( !timerI d ) { | |||||
| 9398 | time rId = setI nterval( j Query.fx.t ick, jQuer y.fx.inter val ); | |||||
| 9399 | } | |||||
| 9400 | }; | |||||
| 9401 | ||||||
| 9402 | jQuery.fx. stop = fun ction() { | |||||
| 9403 | cl earInterva l( timerId ); | |||||
| 9404 | ti merId = nu ll; | |||||
| 9405 | }; | |||||
| 9406 | ||||||
| 9407 | jQuery.fx. speeds = { | |||||
| 9408 | sl ow: 600, | |||||
| 9409 | fa st: 200, | |||||
| 9410 | // Default s peed | |||||
| 9411 | _d efault: 40 0 | |||||
| 9412 | }; | |||||
| 9413 | ||||||
| 9414 | // Back Co mpat <1.8 extension point | |||||
| 9415 | jQuery.fx. step = {}; | |||||
| 9416 | ||||||
| 9417 | if ( jQuer y.expr && jQuery.exp r.filters ) { | |||||
| 9418 | jQ uery.expr. filters.an imated = f unction( e lem ) { | |||||
| 9419 | retu rn jQuery. grep(jQuer y.timers, function( fn ) { | |||||
| 9420 | return elem === fn.elem; | |||||
| 9421 | }).l ength; | |||||
| 9422 | }; | |||||
| 9423 | } | |||||
| 9424 | jQuery.fn. offset = f unction( o ptions ) { | |||||
| 9425 | if ( argumen ts.length ) { | |||||
| 9426 | retu rn options === undef ined ? | |||||
| 9427 | this : | |||||
| 9428 | this.e ach(functi on( i ) { | |||||
| 9429 | jQuery.o ffset.setO ffset( thi s, options , i ); | |||||
| 9430 | }); | |||||
| 9431 | } | |||||
| 9432 | ||||||
| 9433 | va r docElem, win, | |||||
| 9434 | box = { top: 0 , left: 0 }, | |||||
| 9435 | elem = this[ 0 ], | |||||
| 9436 | doc = elem && elem.owner Document; | |||||
| 9437 | ||||||
| 9438 | if ( !doc ) { | |||||
| 9439 | retu rn; | |||||
| 9440 | } | |||||
| 9441 | ||||||
| 9442 | do cElem = do c.document Element; | |||||
| 9443 | ||||||
| 9444 | // Make sure it's not a disconne cted DOM n ode | |||||
| 9445 | if ( !jQuery .contains( docElem, elem ) ) { | |||||
| 9446 | retu rn box; | |||||
| 9447 | } | |||||
| 9448 | ||||||
| 9449 | // If we don 't have gB CR, just u se 0,0 rat her than e rror | |||||
| 9450 | // BlackBerr y 5, iOS 3 (original iPhone) | |||||
| 9451 | if ( typeof elem.getBo undingClie ntRect !== core_stru ndefined ) { | |||||
| 9452 | box = elem.get BoundingCl ientRect() ; | |||||
| 9453 | } | |||||
| 9454 | wi n = getWin dow( doc ) ; | |||||
| 9455 | re turn { | |||||
| 9456 | top: box.top + ( win.pa geYOffset || docElem .scrollTop ) - ( do cElem.clie ntTop || 0 ), | |||||
| 9457 | left : box.left + ( win.p ageXOffset || docEle m.scrollLe ft ) - ( d ocElem.cli entLeft || 0 ) | |||||
| 9458 | }; | |||||
| 9459 | }; | |||||
| 9460 | ||||||
| 9461 | jQuery.off set = { | |||||
| 9462 | ||||||
| 9463 | se tOffset: f unction( e lem, optio ns, i ) { | |||||
| 9464 | var position = jQuery.cs s( elem, " position" ); | |||||
| 9465 | ||||||
| 9466 | // s et positio n first, i n-case top /left are set even o n static e lem | |||||
| 9467 | if ( position === "stati c" ) { | |||||
| 9468 | elem.s tyle.posit ion = "rel ative"; | |||||
| 9469 | } | |||||
| 9470 | ||||||
| 9471 | var curElem = jQuery( el em ), | |||||
| 9472 | curOff set = curE lem.offset (), | |||||
| 9473 | curCSS Top = jQue ry.css( el em, "top" ), | |||||
| 9474 | curCSS Left = jQu ery.css( e lem, "left " ), | |||||
| 9475 | calcul atePositio n = ( posi tion === " absolute" || positio n === "fix ed" ) && j Query.inAr ray("auto" , [curCSST op, curCSS Left]) > - 1, | |||||
| 9476 | props = {}, curP osition = {}, curTop , curLeft; | |||||
| 9477 | ||||||
| 9478 | // n eed to be able to ca lculate po sition if either top or left i s auto and position is either absolute o r fixed | |||||
| 9479 | if ( calculate Position ) { | |||||
| 9480 | curPos ition = cu rElem.posi tion(); | |||||
| 9481 | curTop = curPosi tion.top; | |||||
| 9482 | curLef t = curPos ition.left ; | |||||
| 9483 | } el se { | |||||
| 9484 | curTop = parseFl oat( curCS STop ) || 0; | |||||
| 9485 | curLef t = parseF loat( curC SSLeft ) | | 0; | |||||
| 9486 | } | |||||
| 9487 | ||||||
| 9488 | if ( jQuery.is Function( options ) ) { | |||||
| 9489 | option s = option s.call( el em, i, cur Offset ); | |||||
| 9490 | } | |||||
| 9491 | ||||||
| 9492 | if ( options.t op != null ) { | |||||
| 9493 | props. top = ( op tions.top - curOffse t.top ) + curTop; | |||||
| 9494 | } | |||||
| 9495 | if ( options.l eft != nul l ) { | |||||
| 9496 | props. left = ( o ptions.lef t - curOff set.left ) + curLeft ; | |||||
| 9497 | } | |||||
| 9498 | ||||||
| 9499 | if ( "using" i n options ) { | |||||
| 9500 | option s.using.ca ll( elem, props ); | |||||
| 9501 | } el se { | |||||
| 9502 | curEle m.css( pro ps ); | |||||
| 9503 | } | |||||
| 9504 | } | |||||
| 9505 | }; | |||||
| 9506 | ||||||
| 9507 | ||||||
| 9508 | jQuery.fn. extend({ | |||||
| 9509 | ||||||
| 9510 | po sition: fu nction() { | |||||
| 9511 | if ( !this[ 0 ] ) { | |||||
| 9512 | return ; | |||||
| 9513 | } | |||||
| 9514 | ||||||
| 9515 | var offsetPare nt, offset , | |||||
| 9516 | parent Offset = { top: 0, l eft: 0 }, | |||||
| 9517 | elem = this[ 0 ] ; | |||||
| 9518 | ||||||
| 9519 | // f ixed eleme nts are of fset from window (pa rentOffset = {top:0, left: 0}, because i t is it's only offse t parent | |||||
| 9520 | if ( jQuery.cs s( elem, " position" ) === "fix ed" ) { | |||||
| 9521 | // we assume tha t getBound ingClientR ect is ava ilable whe n computed position is fixed | |||||
| 9522 | offset = elem.ge tBoundingC lientRect( ); | |||||
| 9523 | } el se { | |||||
| 9524 | // Get *real* of fsetParent | |||||
| 9525 | offset Parent = t his.offset Parent(); | |||||
| 9526 | ||||||
| 9527 | // Get correct o ffsets | |||||
| 9528 | offset = this.of fset(); | |||||
| 9529 | if ( ! jQuery.nod eName( off setParent[ 0 ], "htm l" ) ) { | |||||
| 9530 | parentOf fset = off setParent. offset(); | |||||
| 9531 | } | |||||
| 9532 | ||||||
| 9533 | // Add offsetPar ent border s | |||||
| 9534 | parent Offset.top += jQuer y.css( off setParent[ 0 ], "bor derTopWidt h", true ) ; | |||||
| 9535 | parent Offset.lef t += jQuer y.css( off setParent[ 0 ], "bor derLeftWid th", true ); | |||||
| 9536 | } | |||||
| 9537 | ||||||
| 9538 | // S ubtract pa rent offse ts and ele ment margi ns | |||||
| 9539 | // n ote: when an element has margi n: auto th e offsetLe ft and mar ginLeft | |||||
| 9540 | // a re the sam e in Safar i causing offset.lef t to incor rectly be 0 | |||||
| 9541 | retu rn { | |||||
| 9542 | top: offset.top - parent Offset.top - jQuery. css( elem, "marginTo p", true ) , | |||||
| 9543 | left: offset.lef t - parent Offset.lef t - jQuery .css( elem , "marginL eft", true ) | |||||
| 9544 | }; | |||||
| 9545 | }, | |||||
| 9546 | ||||||
| 9547 | of fsetParent : function () { | |||||
| 9548 | retu rn this.ma p(function () { | |||||
| 9549 | var of fsetParent = this.of fsetParent || docume nt.documen tElement; | |||||
| 9550 | while ( offsetPa rent && ( !jQuery.no deName( of fsetParent , "html" ) && jQuery .css( offs etParent, "position" ) === "sta tic" ) ) { | |||||
| 9551 | offsetPa rent = off setParent. offsetPare nt; | |||||
| 9552 | } | |||||
| 9553 | return offsetPar ent || doc ument.docu mentElemen t; | |||||
| 9554 | }); | |||||
| 9555 | } | |||||
| 9556 | }); | |||||
| 9557 | ||||||
| 9558 | ||||||
| 9559 | // Create scrollLeft and scrol lTop metho ds | |||||
| 9560 | jQuery.eac h( {scroll Left: "pag eXOffset", scrollTop : "pageYOf fset"}, fu nction( me thod, prop ) { | |||||
| 9561 | va r top = /Y /.test( pr op ); | |||||
| 9562 | ||||||
| 9563 | jQ uery.fn[ m ethod ] = function( val ) { | |||||
| 9564 | retu rn jQuery. access( th is, functi on( elem, method, va l ) { | |||||
| 9565 | var wi n = getWin dow( elem ); | |||||
| 9566 | ||||||
| 9567 | if ( v al === und efined ) { | |||||
| 9568 | return w in ? (prop in win) ? win[ prop ] : | |||||
| 9569 | win.docume nt.documen tElement[ method ] : | |||||
| 9570 | elem[ meth od ]; | |||||
| 9571 | } | |||||
| 9572 | ||||||
| 9573 | if ( w in ) { | |||||
| 9574 | win.scro llTo( | |||||
| 9575 | !top ? val : jQuery( win ).scr ollLeft(), | |||||
| 9576 | top ? val : jQuery( win ).scro llTop() | |||||
| 9577 | ); | |||||
| 9578 | ||||||
| 9579 | } else { | |||||
| 9580 | elem[ me thod ] = v al; | |||||
| 9581 | } | |||||
| 9582 | }, m ethod, val , argument s.length, null ); | |||||
| 9583 | }; | |||||
| 9584 | }); | |||||
| 9585 | ||||||
| 9586 | function g etWindow( elem ) { | |||||
| 9587 | re turn jQuer y.isWindow ( elem ) ? | |||||
| 9588 | elem : | |||||
| 9589 | elem .nodeType === 9 ? | |||||
| 9590 | elem.d efaultView || elem.p arentWindo w : | |||||
| 9591 | false; | |||||
| 9592 | } | |||||
| 9593 | // Create innerHeigh t, innerWi dth, heigh t, width, outerHeigh t and oute rWidth met hods | |||||
| 9594 | jQuery.eac h( { Heigh t: "height ", Width: "width" }, function( name, typ e ) { | |||||
| 9595 | jQ uery.each( { padding : "inner" + name, co ntent: typ e, "": "ou ter" + nam e }, funct ion( defau ltExtra, f uncName ) { | |||||
| 9596 | // m argin is o nly for ou terHeight, outerWidt h | |||||
| 9597 | jQue ry.fn[ fun cName ] = function( margin, va lue ) { | |||||
| 9598 | var ch ainable = arguments. length && ( defaultE xtra || ty peof margi n !== "boo lean" ), | |||||
| 9599 | extra = defaultExt ra || ( ma rgin === t rue || val ue === tru e ? "margi n" : "bord er" ); | |||||
| 9600 | ||||||
| 9601 | return jQuery.ac cess( this , function ( elem, ty pe, value ) { | |||||
| 9602 | var doc; | |||||
| 9603 | ||||||
| 9604 | if ( jQu ery.isWind ow( elem ) ) { | |||||
| 9605 | // As of 5 /8/2012 th is will yi eld incorr ect result s for Mobi le Safari, but there | |||||
| 9606 | // isn't a whole lot we can do . See pull request a t this URL for discu ssion: | |||||
| 9607 | // https:/ /github.co m/jquery/j query/pull /764 | |||||
| 9608 | return ele m.document .documentE lement[ "c lient" + n ame ]; | |||||
| 9609 | } | |||||
| 9610 | ||||||
| 9611 | // Get d ocument wi dth or hei ght | |||||
| 9612 | if ( ele m.nodeType === 9 ) { | |||||
| 9613 | doc = elem .documentE lement; | |||||
| 9614 | ||||||
| 9615 | // Either scroll[Wid th/Height] or offset [Width/Hei ght] or cl ient[Width /Height], whichever is greates t | |||||
| 9616 | // unfortu nately, th is causes bug #3838 in IE6/8 o nly, but t here is cu rrently no good, sma ll way to fix it. | |||||
| 9617 | return Mat h.max( | |||||
| 9618 | el em.body[ " scroll" + name ], do c[ "scroll " + name ] , | |||||
| 9619 | el em.body[ " offset" + name ], do c[ "offset " + name ] , | |||||
| 9620 | do c[ "client " + name ] | |||||
| 9621 | ); | |||||
| 9622 | } | |||||
| 9623 | ||||||
| 9624 | return v alue === u ndefined ? | |||||
| 9625 | // Get wid th or heig ht on the element, r equesting but not fo rcing pars eFloat | |||||
| 9626 | jQuery.css ( elem, ty pe, extra ) : | |||||
| 9627 | ||||||
| 9628 | // Set wid th or heig ht on the element | |||||
| 9629 | jQuery.sty le( elem, type, valu e, extra ) ; | |||||
| 9630 | }, typ e, chainab le ? margi n : undefi ned, chain able, null ); | |||||
| 9631 | }; | |||||
| 9632 | }) ; | |||||
| 9633 | }); | |||||
| 9634 | // Limit s cope pollu tion from any deprec ated API | |||||
| 9635 | // (functi on() { | |||||
| 9636 | ||||||
| 9637 | // })(); | |||||
| 9638 | // Expose jQuery to the global object | |||||
| 9639 | window.jQu ery = wind ow.$ = jQu ery; | |||||
| 9640 | ||||||
| 9641 | // Expose jQuery as an AMD mod ule, but o nly for AM D loaders that | |||||
| 9642 | // underst and the is sues with loading mu ltiple ver sions of j Query | |||||
| 9643 | // in a pa ge that al l might ca ll define( ). The loa der will i ndicate | |||||
| 9644 | // they ha ve special allowance s for mult iple jQuer y versions by | |||||
| 9645 | // specify ing define .amd.jQuer y = true. Register a s a named module, | |||||
| 9646 | // since j Query can be concate nated with other fil es that ma y use defi ne, | |||||
| 9647 | // but not use a pro per concat enation sc ript that understand s anonymou s | |||||
| 9648 | // AMD mod ules. A na med AMD is safest an d most rob ust way to register. | |||||
| 9649 | // Lowerca se jquery is used be cause AMD module nam es are der ived from | |||||
| 9650 | // file na mes, and j Query is n ormally de livered in a lowerca se file na me. | |||||
| 9651 | // Do this after cre ating the global so that if an AMD modul e wants to call | |||||
| 9652 | // noConfl ict to hid e this ver sion of jQ uery, it w ill work. | |||||
| 9653 | if ( typeo f define = == "functi on" && def ine.amd && define.am d.jQuery ) { | |||||
| 9654 | de fine( "jqu ery", [], function ( ) { return jQuery; } ); | |||||
| 9655 | } | |||||
| 9656 | ||||||
| 9657 | })( window ); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.