This repository has been archived by the owner on Aug 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
api.xml
14853 lines (14279 loc) · 769 KB
/
api.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0"?>
<api>
<categories>
<category name="Ajax">
<category name="Global Ajax Event Handlers"/>
<category name="Helper Functions"/>
<category name="Low-Level Interface"/>
<category name="Shorthand Methods"/>
</category>
<category name="Attributes"/>
<category name="Core"/>
<category name="CSS"/>
<category name="Data"/>
<category name="Dimensions"/>
<category name="Effects">
<category name="Basics"/>
<category name="Custom"/>
<category name="Fading"/>
<category name="Sliding"/>
</category>
<category name="Events">
<category name="Browser Events"/>
<category name="Document Loading"/>
<category name="Event Handler Attachment"/>
<category name="Event Object"/>
<category name="Form Events"/>
<category name="Keyboard Events"/>
<category name="Mouse Events"/>
</category>
<category name="Forms"/>
<category name="Manipulation">
<category name="Class Attribute"/>
<category name="Copying"/>
<category name="DOM Insertion"/>
<category name="DOM Insertion, Around"/>
<category name="DOM Insertion, Inside"/>
<category name="DOM Insertion, Outside"/>
<category name="DOM Removal"/>
<category name="DOM Replacement"/>
<category name="General Attributes"/>
<category name="Style Properties"/>
</category>
<category name="Miscellaneous">
<category name="Collection Manipulation"/>
<category name="Data Storage"/>
<category name="DOM Element Methods"/>
<category name="Setup Methods"/>
</category>
<category name="Offset"/>
<category name="Plugin Authoring"/>
<category name="Properties">
<category name="Properties of jQuery Object Instances"/>
<category name="Properties of the Global jQuery Object"/>
</category>
<category name="Selectors">
<category name="Attribute"/>
<category name="Basic"/>
<category name="Basic Filter"/>
<category name="Child Filter"/>
<category name="Content Filter"/>
<category name="Form"/>
<category name="Hierarchy"/>
<category name="Visibility Filter"/>
</category>
<category name="Traversing">
<category name="Filtering"/>
<category name="Miscellaneous Traversing"/>
<category name="Tree Traversal"/>
</category>
<category name="Utilities"/>
<category name="Version">
<category name="Version 1.0"/>
<category name="Version 1.0.4"/>
<category name="Version 1.1"/>
<category name="Version 1.1.2"/>
<category name="Version 1.1.3"/>
<category name="Version 1.1.4"/>
<category name="Version 1.2"/>
<category name="Version 1.2.3"/>
<category name="Version 1.2.6"/>
<category name="Version 1.3"/>
<category name="Version 1.4"/>
<category name="Version 1.4.1"/>
<category name="Version 1.4.2"/>
</category>
</categories>
<entries>
<entry type="method" name="undelegate" return="jQuery">
<desc><![CDATA[Remove a handler from the event for all elements which match the current selector, now or in the future, based upon a specific set of root elements.]]></desc>
<signature>
<added>1.4.2</added>
</signature>
<signature>
<added>1.4.2</added>
<argument name="selector" type="String">
<desc><![CDATA[A selector which will be used to filter the event results.]]></desc>
</argument>
<argument name="eventType" type="String">
<desc><![CDATA[A string containing a JavaScript event type, such as "click" or "keydown"]]></desc>
</argument>
</signature>
<signature>
<added>1.4.2</added>
<argument name="selector" type="String">
<desc><![CDATA[A selector which will be used to filter the event results.]]></desc>
</argument>
<argument name="eventType" type="String">
<desc><![CDATA[A string containing a JavaScript event type, such as "click" or "keydown"]]></desc>
</argument>
<argument name="handler" type="Function">
<desc><![CDATA[A function to execute at the time the event is triggered.]]></desc>
</argument>
</signature>
<longdesc><![CDATA[
<p>Undelegate is a way of removing event handlers that have been bound using <a href="/delegate">.delegate()</a>. It works virtually identically to <a href="/die">.die()</a> with the addition of a selector filter argument (which is required for delegation to work).</p>
]]></longdesc>
<example>
<desc><![CDATA[Can bind and unbind events to the colored button.]]></desc>
<code><![CDATA[
function aClick() {
$("div").show().fadeOut("slow");
}
$("#bind").click(function () {
$("body").delegate("#theone", "click", aClick)
.find("#theone").text("Can Click!");
});
$("#unbind").click(function () {
$("body").undelegate("#theone", "click", aClick)
.find("#theone").text("Does nothing...");
});
]]></code>
<css><![CDATA[
button { margin:5px; }
button#theone { color:red; background:yellow; }
]]></css>
<html><![CDATA[<button id="theone">Does nothing...</button>
<button id="bind">Bind Click</button>
<button id="unbind">Unbind Click</button>
<div style="display:none;">Click!</div>]]></html>
</example>
<example>
<desc><![CDATA[To unbind all delegated events from all paragraphs, write:]]></desc>
<code><![CDATA[$("p").undelegate()]]></code>
</example>
<example>
<desc><![CDATA[To unbind all delegated click events from all paragraphs, write:]]></desc>
<code><![CDATA[$("p").undelegate( "click" )]]></code>
</example>
<example>
<desc><![CDATA[To undelegate just one previously bound handler, pass the function in as the third argument:]]></desc>
<code><![CDATA[var foo = function () {
// code to handle some kind of event
};
$("body").delegate("p", "click", foo); // ... now foo will be called when paragraphs are clicked ...
$("body").undelegate("p", "click", foo); // ... foo will no longer be called.]]></code>
</example>
<category name="Event Handler Attachment"/>
<category name="Version 1.4.2"/>
</entry>
<entry type="method" name="delegate" return="jQuery">
<desc><![CDATA[Attach a handler to the event for all elements which match the current selector, now or in the future, based upon a specific set of root elements.]]></desc>
<signature>
<added>1.4.2</added>
<argument name="selector" type="String">
<desc><![CDATA[A selector to filter the elements that trigger the event.]]></desc>
</argument>
<argument name="eventType" type="String">
<desc><![CDATA[A string containing one or more space-separated JavaScript event types, such as "click" or "keydown," or custom event names.]]></desc>
</argument>
<argument name="handler" type="Function">
<desc><![CDATA[A function to execute at the time the event is triggered.]]></desc>
</argument>
</signature>
<signature>
<added>1.4.2</added>
<argument name="selector" type="String">
<desc><![CDATA[A selector to filter the elements that trigger the event.]]></desc>
</argument>
<argument name="eventType" type="String">
<desc><![CDATA[A string containing one or more space-separated JavaScript event types, such as "click" or "keydown," or custom event names.]]></desc>
</argument>
<argument name="eventData" type="Object">
<desc><![CDATA[A map of data that will be passed to the event handler.]]></desc>
</argument>
<argument name="handler" type="Function">
<desc><![CDATA[A function to execute at the time the event is triggered.]]></desc>
</argument>
</signature>
<longdesc><![CDATA[
<p>Delegate is an alternative to using the <a href="/live">.live()</a> method, allowing for each binding of event delegation to specific DOM elements. For example the following delegate code:</p>
<pre>$("table").delegate("td", "hover", function(){
$(this).toggleClass("hover");
});</pre>
<p>Is equivalent to the following code written using <code>.live()</code>:</p>
<pre>$("table").each(function(){
$("td", this).live("hover", function(){
$(this).toggleClass("hover");
});
});</pre>
<p>See also the <a href="/undelegate">.undelegate()</a> method for a way of removing event handlers added in <a href="/delegate">.delegate()</a>.</p>
]]></longdesc>
<example>
<desc><![CDATA[Click a paragraph to add another. Note that .delegate() binds the click event to all paragraphs - even new ones.]]></desc>
<code><![CDATA[
$("body").delegate("p", "click", function(){
$(this).after("<p>Another paragraph!</p>");
});
]]></code>
<css><![CDATA[
p { background:yellow; font-weight:bold; cursor:pointer;
padding:5px; }
p.over { background: #ccc; }
span { color:red; }
]]></css>
<html><![CDATA[<p>Click me!</p>
<span></span>]]></html>
</example>
<example>
<desc><![CDATA[To display each paragraph's text in an alert box whenever it is clicked:]]></desc>
<code><![CDATA[$("body").delegate("p", "click", function(){
alert( $(this).text() );
});]]></code>
</example>
<example>
<desc><![CDATA[To cancel a default action and prevent it from bubbling up, return false:]]></desc>
<code><![CDATA[$("body").delegate("a", "click", function() { return false; })]]></code>
</example>
<example>
<desc><![CDATA[To cancel only the default action by using the preventDefault method.]]></desc>
<code><![CDATA[$("body").delegate("a", "click", function(event){
event.preventDefault();
});]]></code>
</example>
<example>
<desc><![CDATA[Can bind custom events too.]]></desc>
<code><![CDATA[
$("body").delegate("p", "myCustomEvent", function(e, myName, myValue){
$(this).text("Hi there!");
$("span").stop().css("opacity", 1)
.text("myName = " + myName)
.fadeIn(30).fadeOut(1000);
});
$("button").click(function () {
$("p").trigger("myCustomEvent");
});
]]></code>
<css><![CDATA[
p { color:red; }
span { color:blue; }
]]></css>
<html><![CDATA[<p>Has an attached custom event.</p>
<button>Trigger custom event</button>
<span style="display:none;"></span>]]></html>
</example>
<category name="Event Handler Attachment"/>
<category name="Version 1.4.2"/>
</entry>
<entry type="method" name="jQuery.error" return="">
<signature>
<added>1.4.1</added>
<argument name="message" type="String">
<desc><![CDATA[The message to send out.]]></desc>
</argument>
</signature>
<desc><![CDATA[Takes a string and throws an exception containing it.]]></desc>
<longdesc><![CDATA[
<p>This method exists primarily for plugin developers who wish to override it and provide a better display (or more information) for the error messages.</p>
]]></longdesc>
<example>
<desc><![CDATA[Override jQuery.error for display in Firebug.]]></desc>
<code><![CDATA[jQuery.error = console.error;]]></code>
</example>
<category name="Plugin Authoring"/>
<category name="Version 1.4.1"/>
</entry>
<entry type="method" name="jQuery.parseJSON" return="Object">
<signature>
<added>1.4.1</added>
<argument name="json" type="String">
<desc><![CDATA[The JSON string to parse.]]></desc>
</argument>
</signature>
<desc><![CDATA[Takes a well-formed JSON string and returns the resulting JavaScript object.]]></desc>
<longdesc><![CDATA[
<p>Passing in a malformed JSON string will result in an exception being thrown. For example, the following are all malformed JSON strings:</p>
<ul>
<li><code>{test: 1}</code> (test does not have double quotes around it).</li>
<li><code>{'test': 1}</code> ('test' is using single quotes instead of double quotes).</li>
</ul>
<p>Additionally if you pass in nothing, an empty string, null, or undefined, 'null' will be returned from parseJSON.</p>
]]></longdesc>
<example>
<desc><![CDATA[Parse a JSON string.]]></desc>
<code><![CDATA[var obj = jQuery.parseJSON('{"name":"John"}');
alert( obj.name === "John" );]]></code>
</example>
<category name="Utilities"/>
<category name="Version 1.4.1"/>
</entry>
<entry type="method" name="jQuery.proxy" return="Function">
<signature>
<added>1.4</added>
<argument name="function" type="Function">
<desc><![CDATA[The function whose context will be changed.]]></desc>
</argument>
<argument name="context" type="Object">
<desc><![CDATA[The object to which the context (`this`) of the function should be set.]]></desc>
</argument>
</signature>
<signature>
<added>1.4</added>
<argument name="context" type="Object">
<desc><![CDATA[The object to which the context of the function should be set.]]></desc>
</argument>
<argument name="name" type="String">
<desc><![CDATA[The name of the function whose context will be changed (should be a property of the 'context' object.]]></desc>
</argument>
</signature>
<desc><![CDATA[Takes a function and returns a new one that will always have a particular context.]]></desc>
<longdesc><![CDATA[
<p>This method is most useful for attaching event handlers to an element where the context is pointing back to a different object. Additionally, jQuery makes sure that even if you bind the function returned from jQuery.proxy() it will still unbind the correct function, if passed the original.</p>
]]></longdesc>
<example>
<desc><![CDATA[Enforce the context of the function.]]></desc>
<code><![CDATA[var obj = {
name: "John",
test: function() {
alert( this.name );
$("#test").unbind("click", obj.test);
}
};
$("#test").click( jQuery.proxy( obj, "test" ) );
// This also works:
// $("#test").click( jQuery.proxy( obj.test, obj ) );]]></code>
</example>
<category name="Event Handler Attachment"/>
<category name="Utilities"/>
<category name="Version 1.4"/>
</entry>
<entry type="method" name="focusout" return="jQuery">
<desc><![CDATA[Bind an event handler to the "focusout" JavaScript event.]]></desc>
<signature>
<added>1.4</added>
<argument name="handler(eventObject)" type="Function">
<desc><![CDATA[A function to execute each time the event is triggered.]]></desc>
</argument>
</signature>
<longdesc><![CDATA[
<p>This method is a shortcut for <code>.bind('focusout', handler)</code>.</p>
<p>The <code>focusout</code> event is sent to an element when it, or any element inside of it, loses focus. This is distinct from the <a href="/blur">blur</a> event in that it supports detecting the loss of focus from parent elements (in other words, it supports events bubbling).</p>
<p>This event will likely be used together with the <a href="/focusin">focusin</a> event.</p>
]]></longdesc>
<example>
<desc><![CDATA[Watch for a loss of focus to occur within the paragraphs on the page.]]></desc>
<css><![CDATA[span {display:none;}]]></css>
<code><![CDATA[
$("p").focusout(function() {
$(this).find("span").css('display','inline').fadeOut(1000);
});
]]></code>
<html><![CDATA[
<p>
<input type="text" />
<span>focusout fire</span>
</p>
<p>
<input type="password" />
<span>focusout fire</span>
</p>]]></html>
</example>
<category name="Keyboard Events"/>
<category name="Mouse Events"/>
<category name="Version 1.4"/>
</entry>
<entry type="method" name="focusin" return="jQuery">
<desc><![CDATA[Bind an event handler to the "focusin" JavaScript event.]]></desc>
<signature>
<added>1.4</added>
<argument name="handler(eventObject)" type="Function">
<desc><![CDATA[A function to execute each time the event is triggered.]]></desc>
</argument>
</signature>
<longdesc><![CDATA[
<p>This method is a shortcut for <code>.bind('focusin', handler)</code>.</p>
<p>The <code>focusin</code> event is sent to an element when it, or any element inside of it, gains focus. This is distinct from the <a href="/focus">focus</a> event in that it supports detecting the focus event on parent elements.</p>
<p>This event will likely be used together with the <a href="/focusout">focusout</a> event.</p>
]]></longdesc>
<example>
<desc><![CDATA[Watch for a focus to occur within the paragraphs on the page.]]></desc>
<css><![CDATA[span {display:none;}]]></css>
<code><![CDATA[
$("p").focusin(function() {
$(this).find("span").css('display','inline').fadeOut(1000);
});
]]></code>
<html><![CDATA[<p><input type="text" /> <span>focusin fire</span></p>
<p><input type="password" /> <span>focusin fire</span></p>]]></html>
</example>
<category name="Keyboard Events"/>
<category name="Mouse Events"/>
<category name="Version 1.4"/>
</entry>
<entry type="method" name="has" return="jQuery">
<signature>
<added>1.4</added>
<argument name="selector" type="String">
<desc><![CDATA[A string containing a selector expression to match elements against.]]></desc>
</argument>
</signature>
<signature>
<added>1.4</added>
<argument name="contained" type="Element">
<desc><![CDATA[A DOM element to match elements against.]]></desc>
</argument>
</signature>
<desc><![CDATA[Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.]]></desc>
<longdesc><![CDATA[
<p>Given a jQuery object that represents a set of DOM elements, the <code>.has()</code> method constructs a new jQuery object from a subset of the matching elements. The supplied selector is tested against the descendants of the matching elements; the element will be included in the result if any of its descendant elements matches the selector.</p>
<p>Consider a page with a nested list as follows:</p>
<pre>
<ul>
<li>list item 1</li>
<li>list item 2
<ul>
<li>list item 2-a</li>
<li>list item 2-b</li>
</ul>
</li>
<li>list item 3</li>
<li>list item 4</li>
</ul>
</pre>
<p>We can apply this method to the set of list items as follows:</p>
<pre>$('li').has('ul').css('background-color', 'red');</pre>
<p>The result of this call is a red background for item 2, as it is the only <code><li></code> that has a <code><ul></code> among its descendants.</p>
]]></longdesc>
<example>
<desc><![CDATA[Check if an element is inside another.]]></desc>
<code><![CDATA[
$("ul").append("<li>" + ($("ul").has("li").length ? "Yes" : "No") + "</li>");
$("ul").has("li").addClass("full");
]]></code>
<css><![CDATA[
.full { border: 1px solid red; }
]]></css>
<html><![CDATA[
<ul><li>Does the UL contain an LI?</li></ul>
]]></html>
</example>
<category name="Filtering"/>
<category name="Version 1.4"/>
</entry>
<entry type="method" name="jQuery.contains" return="Boolean">
<signature>
<added>1.4</added>
<argument name="container" type="Element">
<desc><![CDATA[The DOM element that may contain the other element.]]></desc>
</argument>
<argument name="contained" type="Element">
<desc><![CDATA[The DOM node that may be contained by the other element.]]></desc>
</argument>
</signature>
<desc><![CDATA[Check to see if a DOM node is within another DOM node.]]></desc>
<longdesc/>
<example>
<desc><![CDATA[Check if an element is inside another.]]></desc>
<code><![CDATA[jQuery.contains(document.documentElement, document.body); // true
jQuery.contains(document.body, document.documentElement); // false]]></code>
</example>
<category name="Utilities"/>
<category name="Version 1.4"/>
</entry>
<entry type="method" name="jQuery.noop" return="Function">
<signature>
<added>1.4</added>
</signature>
<desc><![CDATA[An empty function.]]></desc>
<longdesc><![CDATA[
<p>You can use this empty function when you wish to pass around a function that will do nothing.</p>
<p>This is useful for plugin authors who offer optional callbacks; in the case that no callback is given, something like <code>jQuery.noop</code> could execute.</p>
]]></longdesc>
<category name="Utilities"/>
<category name="Version 1.4"/>
</entry>
<entry type="method" name="delay" return="jQuery">
<signature>
<added>1.4</added>
<argument name="duration" type="Integer">
<desc><![CDATA[An integer indicating the number of milliseconds to delay execution of the next item in the queue.]]></desc>
</argument>
<argument name="queueName" optional="true" type="String">
<desc><![CDATA[A string containing the name of the queue. Defaults to <code>fx</code>, the standard effects queue.]]></desc>
</argument>
</signature>
<desc><![CDATA[Set a timer to delay execution of subsequent items in the queue.]]></desc>
<longdesc><![CDATA[
<p>Added to jQuery in version 1.4, the <code>.delay()</code> method allows us to delay the execution of functions that follow it in the queue. It can be used with the standard effects queue or with a custom queue. </p>
<p>Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings <code>'fast'</code> and <code>'slow'</code> can be supplied to indicate durations of 200 and 600 milliseconds, respectively.</p>
<p>Using the standard effects queue, we can, for example, set an 800-millisecond delay between the <code>.slideUp()</code> and <code>.fadeIn()</code> of <code><div id="foo"></code>:</p>
<pre>$('#foo').slideUp(300).delay(800).fadeIn(400);</pre>
<p>When this statement is executed, the element slides up for 300 milliseconds and then pauses for 800 milliseconds before fading in for 400 milliseconds.</p>
]]></longdesc>
<example>
<desc><![CDATA[Animate the hiding and showing of two divs, delaying the first before showing it.]]></desc>
<css><![CDATA[
div { width: 60px; height: 60px; float: left; }
.first { background-color: #3f3; }
.second { background-color: #33f;}]]></css>
<code><![CDATA[
$("button").click(function() {
$("div.first").slideUp(300).delay(800).fadeIn(400);
$("div.second").slideUp(300).fadeIn(400);
});]]></code>
<html><![CDATA[
<p><button>Run</button></p>
<div class="first"></div>
<div class="second"></div>]]></html>
</example>
<category name="Custom"/>
<category name="Version 1.4"/>
</entry>
<entry type="method" name="parentsUntil" return="jQuery">
<signature>
<added>1.4</added>
<argument name="selector" optional="true" type="Selector">
<desc><![CDATA[A string containing a selector expression to indicate where to stop matching ancestor elements.]]></desc>
</argument>
</signature>
<desc><![CDATA[Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector.]]></desc>
<longdesc><![CDATA[
<p>Given a jQuery object that represents a set of DOM elements, the <code>.parentsUntil()</code> method traverses through the ancestors of these elements until it reaches an element matched by the selector passed in the method's argument. The resulting jQuery object contains all of the ancestors up to but not including the one matched by the <code>.parentsUntil()</code> selector. Consider a page with a basic nested list as follows:</p>
<pre><ul class="level-1">
<li class="item-i">I</li>
<li class="item-ii">II
<ul class="level-2">
<li class="item-a">A</li>
<li class="item-b">B
<ul class="level-3">
<li class="item-1">1</li>
<li class="item-2">2</li>
<li class="item-3">3</li>
</ul>
</li>
<li class="item-c">C</li>
</ul>
</li>
<li class="item-iii">III</li>
</ul>
</pre>
<p>If we begin at item A, we can find its ancestors up to but not including <code><ul class="level-1"></code> as follows:</p>
<pre>$('li.item-a').parentsUntil('.level-1')
.css('background-color', 'red');</pre>
<p>The result of this call is a red background for the level-2 list and the item II. </p>
<p>If the .parentsUntil() selector is not matched, or if no selector is supplied, the returned jQuery object contains all of the previous jQuery object's ancestors. For example, let's say we begin at item A again, but this time we use a selector that is not matched by any of its ancestors:</p>
<pre>$('li.item-a').parentsUntil('.not-here')
.css('background-color', 'red');</pre>
<p>The result of this call is a red background-color style applied to the level-2 list, the item II, the level-1 list, the <code><body></code> element, and the <code><html></code> element.</p>
]]></longdesc>
<example>
<desc><![CDATA[Find the ancestors of <li class="item-a"> up to <ul class="level-1"> and give them a red background color.]]></desc>
<code><![CDATA[
$('li.item-a').parentsUntil('.level-1')
.css('background-color', 'red');
]]></code>
<html><![CDATA[
<ul class="level-1">
<li class="item-i">I</li>
<li class="item-ii">II
<ul class="level-2">
<li class="item-a">A</li>
<li class="item-b">B
<ul class="level-3">
<li class="item-1">1</li>
<li class="item-2">2</li>
<li class="item-3">3</li>
</ul>
</li>
<li class="item-c">C</li>
</ul>
</li>
<li class="item-iii">III</li>
</ul>]]></html>
</example>
<category name="Tree Traversal"/>
<category name="Version 1.4"/>
</entry>
<entry type="method" name="prevUntil" return="jQuery">
<signature>
<added>1.4</added>
<argument name="selector" optional="true" type="Selector">
<desc><![CDATA[A string containing a selector expression to indicate where to stop matching preceding sibling elements.]]></desc>
</argument>
</signature>
<desc><![CDATA[Get all preceding siblings of each element up to but not including the element matched by the selector.]]></desc>
<longdesc><![CDATA[
<p>Given a jQuery object that represents a set of DOM elements, the <code>.prevUntil()</code> method allows us to search through the predecessors of these elements in the DOM tree, stopping when it reaches an element matched by the method's argument. The new jQuery object that is returned contains all previous siblings up to but not including the one matched by the <code>.prevUntil()</code> selector.</p>
<p>If the selector is not matched or is not supplied, all previous siblings will be selected; in these cases it selects the same elements as the <code>.prevAll()</code> method does when no filter selector is provided.</p>
<p>Consider a page with a simple definition list as follows:</p>
<pre>
<dl>
<dt>term 1</dt>
<dd>definition 1-a</dd>
<dd>definition 1-b</dd>
<dd>definition 1-c</dd>
<dd>definition 1-d</dd>
<dt id="term-2">term 2</dt>
<dd>definition 2-a</dd>
<dd>definition 2-b</dd>
<dd>definition 2-c</dd>
<dt>term 3</dt>
<dd>definition 3-a</dd>
<dd>definition 3-b</dd>
</dl>
</pre>
<p>If we begin at the second term, we can find the elements which come after it until a preceding <code><dt></code>.</p>
<pre>$('#term-2').prevUntil('dt').css('background-color', 'red');</pre>
<p>The result of this call is a red background behind definitions <code>1-a</code>, <code>1-b</code>, <code>1-c</code>, and <code>1-d</code>. </p>
]]></longdesc>
<example>
<desc><![CDATA[Find the siblings that precede <dt id="term-2"> up to the preceding <dt> and give them a red background color.]]></desc>
<code><![CDATA[
$("#term-2").prevUntil("dt")
.css("background-color", "red")
]]></code>
<html><![CDATA[<dl>
<dt>term 1</dt>
<dd>definition 1-a</dd>
<dd>definition 1-b</dd>
<dd>definition 1-c</dd>
<dd>definition 1-d</dd>
<dt id="term-2">term 2</dt>
<dd>definition 2-a</dd>
<dd>definition 2-b</dd>
<dd>definition 2-c</dd>
<dt>term 3</dt>
<dd>definition 3-a</dd>
<dd>definition 3-b</dd>
</dl>]]></html>
</example>
<category name="Tree Traversal"/>
<category name="Version 1.4"/>
</entry>
<entry type="method" name="nextUntil" return="jQuery">
<signature>
<added>1.4</added>
<argument name="selector" optional="true" type="Selector">
<desc><![CDATA[A string containing a selector expression to indicate where to stop matching following sibling elements.]]></desc>
</argument>
</signature>
<desc><![CDATA[Get all following siblings of each element up to but not including the element matched by the selector.]]></desc>
<longdesc><![CDATA[
<p>Given a jQuery object that represents a set of DOM elements, the <code>.nextUntil()</code> method allows us to search through the successors of these elements in the DOM tree, stopping when it reaches an element matched by the method's argument. The new jQuery object that is returned contains all following siblings up to but not including the one matched by the <code>.nextUntil()</code> selector.</p>
<p>If the selector is not matched or is not supplied, all following siblings will be selected; in these cases it selects the same elements as the <code>.nextAll()</code> method does when no filter selector is provided.</p>
<p>Consider a page with a simple definition list as follows:</p>
<pre>
<dl>
<dt>term 1</dt>
<dd>definition 1-a</dd>
<dd>definition 1-b</dd>
<dd>definition 1-c</dd>
<dd>definition 1-d</dd>
<dt id="term-2">term 2</dt>
<dd>definition 2-a</dd>
<dd>definition 2-b</dd>
<dd>definition 2-c</dd>
<dt>term 3</dt>
<dd>definition 3-a</dd>
<dd>definition 3-b</dd>
</dl>
</pre>
<p>If we begin at the second term, we can find the elements which come after it until a following <code><dt></code>.</p>
<pre>$('#term-2').nextUntil('dt').css('background-color', 'red');</pre>
<p>The result of this call is a red background behind definitions <code>2-a</code>, <code>2-b</code>, and <code>2-c</code>. </p>
]]></longdesc>
<example>
<desc><![CDATA[Find the siblings that follow <dt id="term-2"> up to the next <dt> and give them a red background color.]]></desc>
<code><![CDATA[
$("#term-2").nextUntil("dt")
.css("background-color", "red")
]]></code>
<html><![CDATA[<dl>
<dt>term 1</dt>
<dd>definition 1-a</dd>
<dd>definition 1-b</dd>
<dd>definition 1-c</dd>
<dd>definition 1-d</dd>
<dt id="term-2">term 2</dt>
<dd>definition 2-a</dd>
<dd>definition 2-b</dd>
<dd>definition 2-c</dd>
<dt>term 3</dt>
<dd>definition 3-a</dd>
<dd>definition 3-b</dd>
</dl>]]></html>
</example>
<category name="Tree Traversal"/>
<category name="Version 1.4"/>
</entry>
<entry type="method" name="event.isImmediatePropagationStopped" return="Boolean">
<signature>
<added>1.3</added>
</signature>
<desc><![CDATA[ Returns whether event.stopImmediatePropagation() was ever called on this event object. ]]></desc>
<longdesc><![CDATA[
<p>This property was introduced in <a href="http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/events.html#Events-Event-isImmediatePropagationStopped">DOM level 3</a>.</p>
]]></longdesc>
<example>
<desc><![CDATA[Checks whether event.stopImmediatePropagation() was called.]]></desc>
<code><![CDATA[$("p").click(function(event){
alert( event.isImmediatePropagationStopped() );
event.stopImmediatePropagation();
alert( event.isImmediatePropagationStopped() );
}); ]]></code>
<html><![CDATA[]]></html>
<results><![CDATA[]]></results>
</example>
<category name="Event Object"/>
<category name="Version 1.3"/>
</entry>
<entry type="method" name="event.stopImmediatePropagation" return="">
<signature>
<added>1.3</added>
</signature>
<desc><![CDATA[ Keeps the rest of the handlers from being executed.
]]></desc>
<longdesc><![CDATA[
<p>This method also stops the bubbling by implicitly calling <code>event.stopPropagation()</code>. Use <code>event.isImmediatePropagationStopped()</code> to know whether this method was ever called (on that event object).</p>
]]></longdesc>
<example>
<desc><![CDATA[Prevents other event handlers from being called.]]></desc>
<css><![CDATA[
p { height: 30px; width: 150px; background-color: #ccf; }
div {height: 30px; width: 150px; background-color: #cfc; }
]]></css>
<code><![CDATA[
$("p").click(function(event){
event.stopImmediatePropagation();
});
$("p").click(function(event){
// This function won't be executed
$(this).css("background-color", "#f00");
});
$("div").click(function(event) {
// This function will be executed
$(this).css("background-color", "#f00");
});]]></code>
<html><![CDATA[<p>paragraph</p>
<div>division</div>]]></html>
</example>
<category name="Event Object"/>
<category name="Version 1.3"/>
</entry>
<entry type="method" name="event.isPropagationStopped" return="Boolean">
<signature>
<added>1.3</added>
</signature>
<desc><![CDATA[ Returns whether <a href="/event.stopPropagation">event.stopPropagation()</a> was ever called on this event object. ]]></desc>
<longdesc><![CDATA[ ]]></longdesc>
<example>
<desc><![CDATA[Checks whether event.stopPropagation() was called]]></desc>
<code><![CDATA[$("p").click(function(event){
alert( event.isPropagationStopped() );
event.stopPropagation();
alert( event.isPropagationStopped() );
}); ]]></code>
<html><![CDATA[]]></html>
<results><![CDATA[]]></results>
</example>
<category name="Event Object"/>
<category name="Version 1.3"/>
</entry>
<entry type="method" name="event.stopPropagation" return="">
<signature>
<added>1.0</added>
</signature>
<desc><![CDATA[ This method prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. ]]></desc>
<longdesc><![CDATA[
<p>We can use <code>.isPropagationStopped()</code> to determine if this method has been called by an event handler that was triggered by this event. </p>
<p>This method works for custom events triggered with <a href="/trigger">trigger()</a>, as well.</p>
<p>Note that this will not prevent other handlers <em>on the same element</em> from running. Use the method <a href="/event.isPropagationStopped">event.isPropagationStopped()</a> to know whether this method was ever called (on that event object). </p>
]]></longdesc>
<example>
<desc><![CDATA[Kill the bubbling on the click event.]]></desc>
<code><![CDATA[$("p").click(function(event){
event.stopPropagation();
// do something
}); ]]></code>
<html><![CDATA[]]></html>
<results><![CDATA[]]></results>
</example>
<category name="Event Object"/>
<category name="Version 1.0"/>
</entry>
<entry type="method" name="event.isDefaultPrevented" return="Boolean">
<signature>
<added>1.3</added>
</signature>
<desc><![CDATA[Returns whether <a href="/event.preventDefault">event.preventDefault()</a> was ever called on this event object. ]]></desc>
<longdesc><![CDATA[ ]]></longdesc>
<example>
<desc><![CDATA[Checks whether event.preventDefault() was called.]]></desc>
<code><![CDATA[$("a").click(function(event){
alert( event.isDefaultPrevented() ); // false
event.preventDefault();
alert( event.isDefaultPrevented() ); // true
}); ]]></code>
</example>
<category name="Event Object"/>
<category name="Version 1.3"/>
</entry>
<entry name="event.preventDefault" type="method" return="undefined">
<signature>
<added>1.0</added>
</signature>
<desc><![CDATA[ If this method is called, the default action of the event will not be triggered. ]]></desc>
<longdesc><![CDATA[
<p>For example, clicked anchors will not take the browser to a new URL. We can use <code>event.isDefaultPrevented()</code> to determine if this method has been called by an event handler that was triggered by this event.</p>
]]></longdesc>
<example>
<desc><![CDATA[Cancel the default action (navigation) of the click.]]></desc>
<code><![CDATA[
$("a").click(function(event) {
event.preventDefault();
$('<div/>')
.append('default ' + event.type + ' prevented')
.appendTo('#log');
});
]]></code>
<html><![CDATA[
<a href="http://jquery.com">default click action is prevented</a>
<div id="log"></div>
]]></html>
</example>
<category name="Event Object"/>
<category name="Version 1.0"/>
</entry>
<entry type="property" name="event.timeStamp" return="Number">
<signature>
<added>1.2.6</added>
</signature>
<desc><![CDATA[ This attribute returns the number of milliseconds since January 1, 1970, when the event is triggered. ]]></desc>
<longdesc><![CDATA[ It can be useful for profiling the performance of certain jQuery functions. ]]></longdesc>
<example>
<desc><![CDATA[Alert the time since click handler last executed.]]></desc>
<code><![CDATA[var last;
$(document.body).click(function(event) {
if( last )
alert( "time since last event " + event.timeStamp - last );
last = event.timeStamp;
}); ]]></code>
<html><![CDATA[]]></html>
<results><![CDATA[]]></results>
</example>
<category name="Event Object"/>
<category name="Version 1.2.6"/>
</entry>
<entry type="property" name="event.result" return="Object">
<signature>
<added>1.3</added>
</signature>
<desc><![CDATA[ This attribute contains the last value returned by an event handler that was triggered by this event, unless the value was <code>undefined</code>. ]]></desc>
<longdesc><![CDATA[ It can be useful for getting previous return values of custom events. ]]></longdesc>
<example>
<desc><![CDATA[Alert previous handler's return value]]></desc>
<code><![CDATA[$("p").click(function(event) {
return "hey"
});
$("p").click(function(event) {
alert( event.result );
}); ]]></code>
<html><![CDATA[]]></html>
<results><![CDATA["hey" ]]></results>
</example>
<category name="Event Object"/>
<category name="Version 1.3"/>
</entry>
<entry type="property" name="event.which" return="String">
<signature>
<added>1.1.3</added>
</signature>
<desc><![CDATA[ For key or button events, this attribute indicates the specific button or key that was pressed. ]]></desc>
<longdesc><![CDATA[
<p><code>event.which</code> normalizes <code>event.keyCode</code> and <code>event.charCode</code>. It is recommended to watch <code>event.which</code> for keyboard key input. For more detail, read about <a href="https://developer.mozilla.org/en/DOM/event.charCode#Notes">event.charCode on the MDC</a>. </p>
]]></longdesc>
<example>
<desc><![CDATA[Log what key was depressed.]]></desc>
<code><![CDATA[$('#whichkey').bind('keydown',function(e){
$('#log').html(e.type + ': ' + e.which );
}); ]]></code>
<html><![CDATA[
<input id="whichkey" value="type something">
<div id="log"></div>]]></html>
<results><![CDATA["keydown" 74 ]]></results>
</example>
<category name="Event Object"/>
<category name="Version 1.1.3"/>
</entry>
<entry type="property" name="event.pageY" return="Number">
<signature>
<added>1.0.4</added>
</signature>
<desc><![CDATA[The mouse position relative to the top edge of the document. ]]></desc>
<longdesc><![CDATA[ ]]></longdesc>
<example>
<desc><![CDATA[Show the mouse position relative to the left and top edges of the document (within this iframe).]]></desc>
<css>body {background-color: #eef; }
div { padding: 20px; }</css>
<html><![CDATA[<div id="log"></div>]]></html>
<code><![CDATA[$(document).bind('mousemove',function(e){
$("#log").text("e.pageX: " + e.pageX + ", e.pageY: " + e.pageY);
}); ]]></code>
</example>
<category name="Event Object"/>
<category name="Version 1.0.4"/>
</entry>
<entry type="property" name="event.pageX" return="Number">
<signature>
<added>1.0.4</added>
</signature>
<desc><![CDATA[The mouse position relative to the left edge of the document. ]]></desc>
<longdesc><![CDATA[ ]]></longdesc>
<example>
<desc><![CDATA[Show the mouse position relative to the left and top edges of the document (within the iframe).]]></desc>
<css>body {background-color: #eef; }
div { padding: 20px; }</css>
<html><![CDATA[<div id="log"></div>]]></html>
<code><![CDATA[$(document).bind('mousemove',function(e){
$("#log").text("e.pageX: " + e.pageX + ", e.pageY: " + e.pageY);
}); ]]></code>
</example>
<category name="Event Object"/>
<category name="Version 1.0.4"/>
</entry>
<entry type="property" name="event.currentTarget" return="Element">
<signature>
<added>1.3</added>
</signature>
<desc><![CDATA[ The current DOM element within the event bubbling phase. ]]></desc>
<longdesc><![CDATA[
<p>This property will always be equal to the <code>this</code> of the function.</p>
]]></longdesc>
<example>
<desc><![CDATA[Alert that currentTarget matches the `this` keyword.]]></desc>
<code><![CDATA[$("p").click(function(event) {
alert( event.currentTarget === this ); // true
}); ]]></code>
</example>
<category name="Event Object"/>
<category name="Version 1.3"/>
</entry>
<entry type="property" name="event.relatedTarget" return="Element">
<signature>
<added>1.1.4</added>
</signature>
<desc><![CDATA[ The other DOM element involved in the event, if any. ]]></desc>
<longdesc><![CDATA[
<p>For <code>mouseout</code>, indicates the element being entered; for <code>mousein</code>, indicates the element being exited. </p>
]]></longdesc>
<example>
<desc><![CDATA[On mouseout of anchors, alert the element type being entered.]]></desc>
<code><![CDATA[$("a").mouseout(function(event) {
alert(event.relatedTarget.nodeName); // "DIV"
}); ]]></code>
</example>
<category name="Event Object"/>
<category name="Version 1.1.4"/>
</entry>
<entry type="property" name="event.data" return="Anything">
<signature>
<added>1.1</added>
</signature>
<desc><![CDATA[ Contains the optional data passed to jQuery.fn.bind when the current executing handler was bound. ]]></desc>
<longdesc><![CDATA[ ]]></longdesc>
<example>
<desc><![CDATA[The description of the example.]]></desc>
<code><![CDATA[$("a").each(function(i) {
$(this).bind('click', {index:i}, function(e){
alert('my index is ' + e.data.index);
});
}); ]]></code>
</example>
<category name="Event Object"/>
<category name="Version 1.1"/>
</entry>
<entry type="property" name="event.target" return="Element">