-
Notifications
You must be signed in to change notification settings - Fork 19
/
jQueryAPI.zh_CN.xml
8532 lines (8432 loc) · 534 KB
/
jQueryAPI.zh_CN.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" encoding="UTF-8"?>
<api>
<categories>
<category name="Ajax" zh="Ajax">
<category name="Global Ajax Event Handlers" zh="全局Ajax事件"/>
<category name="Helper Functions" zh="辅助函数"/>
<category name="Low-Level Interface" zh="底层接口"/>
<category name="Shorthand Methods" zh="快捷方法"/>
</category>
<category name="Attributes" zh="属性"/>
<category name="Core" zh="核心"/>
<category name="CSS" zh="CSS"/>
<category name="Data" zh="数据"/>
<category name="Dimensions" zh="尺寸"/>
<category name="Effects" zh="动画">
<category name="Basics" zh="基本"/>
<category name="Custom" zh="自定义"/>
<category name="Fading" zh="渐变"/>
<category name="Sliding" zh="滑动"/>
</category>
<category name="Events" zh="事件">
<category name="Browser Events" zh="浏览器事件"/>
<category name="Document Loading" zh="文档加载"/>
<category name="Event Handler Attachment" zh="事件处理"/>
<category name="Event Object" zh="事件对象"/>
<category name="Form Events" zh="表单事件"/>
<category name="Keyboard Events" zh="键盘事件"/>
<category name="Mouse Events" zh="鼠标事件"/>
</category>
<category name="Forms" zh="表单"/>
<category name="Manipulation" zh="操作">
<category name="Class Attribute" zh="Class属性"/>
<category name="Copying" zh="复制"/>
<category name="DOM Insertion" zh="DOM插入"/>
<category name="DOM Insertion, Around" zh="包裹"/>
<category name="DOM Insertion, Inside" zh="内部插入"/>
<category name="DOM Insertion, Outside" zh="外部插入"/>
<category name="DOM Removal" zh="DOM删除"/>
<category name="DOM Replacement" zh="DOM替换"/>
<category name="General Attributes" zh="通用属性"/>
<category name="Style Properties" zh="样式属性"/>
</category>
<category name="Miscellaneous" zh="杂项">
<category name="Collection Manipulation" zh="集合操作"/>
<category name="Data Storage" zh="数据存储"/>
<category name="DOM Element Methods" zh="DOM元素方法"/>
<category name="Setup Methods" zh="设置方法"/>
</category>
<category name="Offset" zh="偏移"/>
<category name="Internals" zh="内部使用"/>
<category name="Properties" zh="属性">
<category name="Properties of jQuery Object Instances" zh="jQuery对象实例属性"/>
<category name="Properties of the Global jQuery Object" zh="全局jQuery对象属性"/>
</category>
<category name="Selectors" zh="选择器">
<category name="Attribute" zh="属性"/>
<category name="Basic" zh="基础"/>
<category name="Basic Filter" zh="简单"/>
<category name="Child Filter" zh="子元素"/>
<category name="Content Filter" zh="内容"/>
<category name="Form" zh="表单"/>
<category name="Hierarchy" zh="层级"/>
<category name="Visibility Filter" zh="可见性"/>
</category>
<category name="Traversing" zh="遍历">
<category name="Filtering" zh="筛选"/>
<category name="Miscellaneous Traversing" zh="其他遍历"/>
<category name="Tree Traversal" zh="树遍历"/>
</category>
<category name="Utilities" zh="工具"/>
<category name="Version" zh="版本">
<category name="Version 1.0" zh="1.0 版"/>
<category name="Version 1.0.4" zh="1.0.4 版"/>
<category name="Version 1.1" zh="1.1 版"/>
<category name="Version 1.1.2" zh="1.1.2 版"/>
<category name="Version 1.1.3" zh="1.1.3 版"/>
<category name="Version 1.1.4" zh="1.1.4 版"/>
<category name="Version 1.2" zh="1.2 版"/>
<category name="Version 1.2.3" zh="1.2.3 版"/>
<category name="Version 1.2.6" zh="1.2.6 版"/>
<category name="Version 1.3" zh="1.3 版"/>
<category name="Version 1.4" zh="1.4 版"/>
<category name="Version 1.4.1" zh="1.4.1 版"/>
<category name="Version 1.4.2" zh="1.4.2 版"/>
<category name="Version 1.4.3" zh="1.4.3 版"/>
<category name="Version 1.4.4" zh="1.4.4 版"/>
</category>
</categories>
<entries>
<entry type="method" name="fadeToggle">
<desc>通过透明度动画来显示或隐藏匹配的元素。</desc>
<signature>
<argument name="duration">
<desc>字符串("slow"或 "fast")或表示动画时长的毫秒数值</desc>
</argument>
<argument name="easing">
<desc>要使用的缓冲效果的名称,默认值是 "swing"。jQuery 内置提供 "linear" 和 "swing" 两种效果,如果要使用更多缓冲效果,需要插件支持。</desc>
</argument>
<argument name="callback">
<desc>在动画完成时执行的函数。</desc>
</argument>
</signature>
<longdesc>
<p><code>.fadeOut()</code> 方法对匹配元素的透明度生成动画效果。当透明度变成 0 之后,再把 <code>display</code> 样式属性设置成 <code>none</code> 以确保这个元素不再对页面布局产生影响。</p>
<p>duration 参数可以提供一个毫秒数,代表动画运行的时间,时间越长动画越慢。还可以提供字符串 <code>'fast'</code> 和 <code>'slow'</code> ,分别对应了 <code>200</code> 和 <code>600</code> 毫秒。如果没有设置 <code>duration</code> 参数,或者设置成其他无法识别的字符串,就会使用默认值 400 毫秒。</p>
<p>缓冲函数确定了动画在不同的位置的速度。jQuery默认只提供两个缓冲效果:<code>swing</code> 和 <code>linear</code>。更多特效需要使用插件。可以访问 <a href="http://jqueryui.com">jQuery UI 网站</a> 来获得更多信息。</p>
<p>如果提供了回调函数,那么当动画结束时,会调用这个函数。通常用来几个不同的动画依次完成。这个函数不接受任何参数,但是 <code>this</code> 会设成将要执行动画的那个元素。如果对多个元素设置动画,那么要非常注意,回调函数会在每一个动画完成的元素上都执行一次,而不是对这组动画整体才执行一次。</p>
</longdesc>
<example>
<desc>第一段落渐隐或渐显,用时 600 毫秒,并且是线性缓冲效果。而第二个段落渐隐渐显用时 200 毫秒, 并且在每次动画完成后插入一个 "finished"。</desc>
</example>
</entry>
<entry type="method" name="jQuery.type">
<desc>Determine the internal JavaScript [[Class]] of an object.</desc>
<signature>
<argument name="obj">
<desc>Object to get the internal JavaScript [[Class]] of.</desc>
</argument>
</signature>
<longdesc>
<p>A number of different aspects are utilized to determine the exact return value for an object. The logic can be determined as follows:</p>
<ul>
<li>If the object is undefined or null then "undefined" or "null" is returned accordingly.</li>
<li>If the object has an internal [[Class]] equivalent to one of the browser's built-in objects we return the associated name. (<a href="http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/">More details about this technique.</a>)<ul>
<li>jQuery.type(true) === "boolean"</li>
<li>jQuery.type(3) === "number"</li>
<li>jQuery.type("test") === "string"</li>
<li>jQuery.type(function(){}) === "function"</li>
<li>jQuery.type([]) === "array"</li>
<li>jQuery.type(new Date()) === "date"</li>
<li>jQuery.type(/test/) === "regexp"</li>
</ul>
</li>
<li>Everything else will return "object" as its type.</li>
</ul>
</longdesc>
<example>
<desc>Finds out if the parameter is a RegExp.</desc>
</example>
</entry>
<entry type="method" name="jQuery.isWindow">
<desc>Determine whether the argument is a window.</desc>
<signature>
<argument name="obj">
<desc>Object to test whether or not it is a window.</desc>
</argument>
</signature>
<longdesc>
<p>This is used in a number of places in jQuery to determine if we're operating against a browser window (such as the current window or an iframe).</p>
</longdesc>
<example>
<desc>Finds out if the parameter is a window.</desc>
</example>
</entry>
<entry type="method" name="toggle">
<desc>Bind two or more handlers to the matched elements, to be executed on alternate clicks.</desc>
<signature>
<argument name="handler(eventObject)">
<desc>A function to execute every even time the element is clicked.</desc>
</argument>
<argument name="handler(eventObject)">
<desc>A function to execute every odd time the element is clicked.</desc>
</argument>
<argument name="handler(eventObject)">
<desc>Additional handlers to cycle through after clicks.</desc>
</argument>
</signature>
<longdesc>
<p>The <code>.toggle()</code> method binds a handler for the <code>click</code> event, so the rules outlined for the triggering of <code>click</code> apply here as well.</p>
<pre>For example, consider the HTML:
<div id="target">
Click here
</div></pre>
<p class="image">
<img src="images/0042_05_05.png" alt=""/>
</p>
<p>Event handlers can then be bound to the <code><div></code>:</p>
<pre>$('#target').toggle(function() {
alert('First handler for .toggle() called.');
}, function() {
alert('Second handler for .toggle() called.');
});</pre>
<p>As the element is clicked repeatedly, the messages alternate:</p>
<p>
<span class="output">First handler for .toggle() called.</span>
<br/>
<span class="output">Second handler for .toggle() called.</span>
<br/>
<span class="output">First handler for .toggle() called.</span>
<br/>
<span class="output">Second handler for .toggle() called.</span>
<br/>
<span class="output">First handler for .toggle() called.</span>
</p>
<p>If more than two handlers are provided, <code>.toggle()</code> will cycle among all of them. For example, if there are three handlers, then the first handler will be called on the first click, the fourth click, the seventh click, and so on.</p>
<blockquote><p>Note: jQuery also provides an animation method named <a href="http://api.jquery.com/toggle/">.toggle()</a> that toggles the visibility of elements. Whether the animation or the event method is fired depends on the set of arguments passed.</p></blockquote>
<p>The <code>.toggle()</code> method is provided for convenience. It is relatively straightforward to implement the same behavior by hand, and this can be necessary if the assumptions built into <code>.toggle()</code> prove limiting. For example, <code>.toggle()</code> is not guaranteed to work correctly if applied twice to the same element. Since <code>.toggle()</code> internally uses a <code>click</code> handler to do its work, we must unbind <code>click</code> to remove a behavior attached with <code>.toggle()</code>, so other <code>click</code> handlers can be caught in the crossfire. The implementation also calls <code>.preventDefault()</code> on the event, so links will not be followed and buttons will not be clicked if <code>.toggle()</code> has been called on the element.</p>
</longdesc>
<example>
<desc>Click to toggle highlight on the list item.</desc>
</example>
<example>
<desc>To toggle a style on table cells:</desc>
</example>
</entry>
<entry type="property" name="jQuery.fx.interval">
<desc>The rate (in milliseconds) at which animations fire.</desc>
<signature/>
<longdesc>
<p>This property can be manipulated to adjust the number of frames per second at which animations will run. The default is 13 milliseconds. Making this a lower number could make the animations run smoother in faster browsers (such as Chrome) but there may be performance and CPU implications of doing so.</p>
<p>Since jQuery uses one global interval, no animation should be running or all animations should stop for the change of this property to take effect.</p>
</longdesc>
<example>
<desc>Cause all animations to run with less frames.</desc>
</example>
</entry>
<entry type="property" name="event.namespace">
<desc>当事件出发时指定命名空间。</desc>
<signature/>
<longdesc><p>这个属性对插件作者比较有用。可以根据不同的事件命名空间,来完成不同的任务。</p></longdesc>
<example>
<desc>检测使用的事件命名空间。</desc>
</example>
</entry>
<entry type="method" name="undelegate">
<desc>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/>
<signature>
<argument name="selector">
<desc>A selector which will be used to filter the event results.</desc>
</argument>
<argument name="eventType">
<desc>A string containing a JavaScript event type, such as "click" or "keydown"</desc>
</argument>
</signature>
<signature>
<argument name="selector">
<desc>A selector which will be used to filter the event results.</desc>
</argument>
<argument name="eventType">
<desc>A string containing a JavaScript event type, such as "click" or "keydown"</desc>
</argument>
<argument name="handler">
<desc>每当事件触发时执行的函数。</desc>
</argument>
</signature>
<longdesc>
<p>Undelegate is a way of removing event handlers that have been bound using <a href="delegate.htm">.delegate()</a>. It works virtually identically to <a href="die.htm">.die()</a> with the addition of a selector filter argument (which is required for delegation to work).</p>
</longdesc>
<example>
<desc>Can bind and unbind events to the colored button.</desc>
</example>
<example>
<desc>To unbind all delegated events from all paragraphs, write:</desc>
</example>
<example>
<desc>To unbind all delegated click events from all paragraphs, write:</desc>
</example>
<example>
<desc>To undelegate just one previously bound handler, pass the function in as the third argument:</desc>
</example>
</entry>
<entry type="method" name="delegate">
<desc>Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.</desc>
<signature>
<argument name="selector">
<desc>A selector to filter the elements that trigger the event.</desc>
</argument>
<argument name="eventType">
<desc>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">
<desc>每当事件触发时执行的函数。</desc>
</argument>
</signature>
<signature>
<argument name="selector">
<desc>A selector to filter the elements that trigger the event.</desc>
</argument>
<argument name="eventType">
<desc>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">
<desc>将要传递给事件处理函数的数据映射。</desc>
</argument>
<argument name="handler">
<desc>每当事件触发时执行的函数。</desc>
</argument>
</signature>
<longdesc>
<p>Delegate is an alternative to using the <a href="live.htm">.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.htm">.undelegate()</a> method for a way of removing event handlers added in <a href="delegate.htm">.delegate()</a>.</p>
<p>Passing and handling event data works <a href="http://api.jquery.com/bind/#passing-event-data">the same way as it does for .bind()</a>.</p>
</longdesc>
<example>
<desc>Click a paragraph to add another. Note that .delegate() binds the click event to all paragraphs - even new ones.</desc>
</example>
<example>
<desc>To display each paragraph's text in an alert box whenever it is clicked:</desc>
</example>
<example>
<desc>To cancel a default action and prevent it from bubbling up, return false:</desc>
</example>
<example>
<desc>To cancel only the default action by using the preventDefault method.</desc>
</example>
<example>
<desc>Can bind custom events too.</desc>
</example>
</entry>
<entry type="method" name="jQuery.error">
<desc>接受一个字符串,并抛出包含这个字符串的异常。</desc>
<signature>
<argument name="message">
<desc>将要发出的消息.</desc>
</argument>
</signature>
<longdesc>
<p>这个方法主要是为了让插件开发人员可以重载此方法,并以更好的方式显示错误消息,或者提供更多相关信息。</p>
</longdesc>
<example>
<desc>重载 jQuery.error 以便可以在 Firebug 中显示。</desc>
</example>
</entry>
<entry type="method" name="jQuery.parseJSON">
<desc>接受一个标准格式的 JSON 字符串,并返回解析后的 JavaScript 对象。</desc>
<signature>
<argument name="json">
<desc>将要解析的 JSON 字符串。</desc>
</argument>
</signature>
<longdesc>
<p>传入格式有误的 JSON 字符串可能导致抛出异常。例如,下面这些 JSON 字符串格式都不对:</p>
<ul>
<li>
<code>{test: 1}</code> (test 没有使用双引号包裹).</li>
<li>
<code>{'test': 1}</code> ('test' 用了单引号而不是双引号包裹).</li>
</ul>
<p>另外,如果你什么都不传入,或者传入空字符串、null、undefined 等,parseJSON 都会返回 null 。如果浏览器原生实现了 <code>JSON.parse</code>, jQuery 则会使用它来解析字符串。更多关于JSON格式的细节请参考 <a href="http://json.org/">http://json.org/</a>
</p>
</longdesc>
<example>
<desc>解析一个 JSON 字符串。</desc>
</example>
</entry>
<entry type="method" name="jQuery.proxy">
<desc>接受一个函数,然后返回一个新函数,并且这个新函数始终保持了特定的上下文语境。</desc>
<signature>
<argument name="function">
<desc>将要改变上下文语境的函数。</desc>
</argument>
<argument name="context">
<desc>函数的上下文语境(`this`)会被设置成这个 object 对象。</desc>
</argument>
</signature>
<signature>
<argument name="context">
<desc>函数的上下文语境会被设置成这个 object 对象。</desc>
</argument>
<argument name="name">
<desc>将要改变上下文语境的函数名(这个函数必须是前一个参数 'context' 对象的属性)</desc>
</argument>
</signature>
<longdesc>
<p>这个方法通常在向一个元素上附加事件处理函数时,上下文语境实际是指向另一个对象的情况下使用。另外,jQuery 能够确保即使你绑定的函数是经过 jQuery.proxy() 处理过的函数,你依然可以用原先的函数来正确地取消绑定。</p>
</longdesc>
<example>
<desc>强制修改函数的上下文语境</desc>
</example>
</entry>
<entry type="method" name="focusout">
<desc>为 "focusout" 事件绑定一个处理函数。</desc>
<signature>
<argument name="handler(eventObject)">
<desc>每当事件触发时执行的函数。</desc>
</argument>
</signature>
<signature>
<argument name="eventData">
<desc>将要传递给事件处理函数的数据映射。</desc>
</argument>
<argument name="handler(eventObject)">
<desc>每当事件触发时执行的函数。</desc>
</argument>
</signature>
<longdesc>
<p>这个方法是 <code>.bind('focusout', handler)</code> 的快捷方式。</p>
<p><code>focusout</code> 事件会在元素(或者其内部的任何元素)失去焦点焦点时触发。这跟 <a href="blur.htm">blur</a> 事件的显著区别在于,它可以在父元素上检测子元素失去焦点的情况(换而言之,它支持事件冒泡)。</p>
<p>这个事件通常会跟 <a href="focusin.htm">focusin</a> 事件一起使用。</p>
</longdesc>
<example>
<desc>监视段落内部失去焦点的情况。请注意 <code>focusout</code> 计数和 <code>blur</code> 计数的差异。</desc>
</example>
</entry>
<entry type="method" name="focusin">
<desc>为 "focusin" 事件绑定一个处理函数。</desc>
<signature>
<argument name="handler(eventObject)">
<desc>每当事件触发时执行的函数。</desc>
</argument>
</signature>
<signature>
<argument name="eventData">
<desc>将要传递给事件处理函数的数据映射。</desc>
</argument>
<argument name="handler(eventObject)">
<desc>每当事件触发时执行的函数。</desc>
</argument>
</signature>
<longdesc>
<p>这个方法是 <code>.bind('focusin', handler)</code>的快捷方式。</p>
<p><code>focusin</code> 事件会在元素(或者其内部的任何元素)获得焦点焦点时触发。这跟 <a href="focus.htm">focus</a> 事件的显著区别在于,它可以在父元素上检测子元素获得焦点的情况(换而言之,它支持事件冒泡)。</p>
<p>这个事件通常会跟 <a href="focusout.htm">focusout</a> 事件一起使用。</p>
</longdesc>
<example>
<desc>监控页面上段落内获得焦点的情况。</desc>
</example>
</entry>
<entry type="method" name="has">
<desc>保留包含特定后代的元素,去掉那些不含有指定后代的元素。</desc>
<signature>
<argument name="selector">
<desc>一个用于匹配元素的选择器字符串。</desc>
</argument>
</signature>
<signature>
<argument name="contained">
<desc>用于匹配元素的DOM元素。</desc>
</argument>
</signature>
<longdesc>
<p>如果提供一个jQuery对象代表DOM元素集合, <code>.has()</code> 方法会用其子集创建一个新的jQuery对象。提供的选择器会一一测试原先那些元素的后代,含有匹配后代的元素会保留在结果中。</p>
<p>下面是一个嵌套列表的页面:</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>我们可以用如下方式对列表项集合应用这个方法:</p>
<pre>$('li').has('ul').css('background-color', 'red');</pre>
<p>结果是 item 2 背景变成了红色,因为只有这个 <code><li></code> 含有 <code><ul></code> 后代。</p>
</longdesc>
<example>
<desc>检测是否一个元素在另一个之内。</desc>
</example>
</entry>
<entry type="method" name="jQuery.contains">
<desc>检测一个DOM节点是否包含另一个DOM节点。</desc>
<signature>
<argument name="container">
<desc>可能包含其它元素的DOM元素。</desc>
</argument>
<argument name="contained">
<desc>可能被其它元素包含的DOM节点。</desc>
</argument>
</signature>
<longdesc/>
<example>
<desc>检测是否一个元素在另一个之内。</desc>
</example>
</entry>
<entry type="method" name="jQuery.noop">
<desc>一个空函数。</desc>
<signature/>
<longdesc>
<p>你可以在希望仅仅传递一个函数而不做任何事情时,传递这个空函数。</p>
<p>这对插件作者很有用。如果你设置了一个可选的回调函数,那么如果用户调用时没提供这个函数,那么就可以用 <code>jQuery.noop</code> 替代。</p>
</longdesc>
</entry>
<entry type="method" name="delay">
<desc>设置一个延时来推迟执行队列中之后的项目。</desc>
<signature>
<argument name="duration">
<desc>以毫秒为单位的整数,用于设定队列推迟执行的时间。</desc>
</argument>
<argument name="queueName">
<desc>队列名的字符串。默认是动画队列 <code>fx</code> 。</desc>
</argument>
</signature>
<longdesc>
<p>jQuery 1.4新增, <code>.delay()</code> 用于将队列中的函数延时执行。它既可以推迟动画队列中函数的执行,也可以用于自定义队列。只有在队列中的连续事件可以被延时,因此不带参数的 <code>.show()</code> 和 <code>.hide()</code> 就不会有延时,因为他们没有使用动画队列。</p>
<p>毫秒为单位的延时,数字越大,动画越慢。字符串 <code>'fast'</code> 和 <code>'slow'</code> 分别代表200和600毫秒的延时。</p>
<p>例如,我们可以在 <code><div id="foo"></code> 的 <code>.slideUp()</code> 和 <code>.fadeIn()</code> 动画之间添加800毫秒的延时 :</p>
<pre>$('#foo').slideUp(300).delay(800).fadeIn(400);</pre>
<p>当这句语句执行后,元素会有300毫秒的卷起动画,接着暂停800毫秒,再出现400毫秒淡入动画。</p>
<blockquote><p><strong><code>.delay()</code> 用在jQuery动画或者类似队列中是再好不过的了。但是,由于其本身的限制,比如无法取消延时,所以不应完全用来替代 JavaScript 原生的 <a href="https://developer.mozilla.org/en/DOM/window.setTimeout">setTimeout</a> 函数,后者更适用于通常情况。</strong></p></blockquote>
</longdesc>
<example>
<desc>隐藏再显示两个div。其中绿色的div再次出现得更慢。</desc>
</example>
</entry>
<entry type="method" name="parentsUntil">
<desc>查找当前元素的所有的前辈元素,直到遇到选择器匹配的元素为止,不包括那个匹配到的元素。</desc>
<signature>
<argument name="selector">
<desc>选择器字符串,用于确定到哪个前辈元素时停止匹配。</desc>
</argument>
</signature>
<longdesc>
<p>如果提供一个jQuery对象代表DOM元素集合, <code>.parentsUntil()</code> 方法会找遍所有这些元素的前辈元素,直到遇到了跟参数匹配的元素才会停止。返回的jQuery对象中包含了所有找到的前辈元素,除了与 <code>.parentsUntil()</code> 选择器匹配的那个元素。考虑如下的嵌套列表:</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>如果我们从项目 A 开始找它的前辈,但不包括 <code><ul class="level-1"></code> ,就可以用下面代码:</p>
<pre>$('li.item-a').parentsUntil('.level-1')
.css('background-color', 'red');</pre>
<p>结果就是 level-2 列表和项目 II 的背景变红。 </p>
<p>如果提供给 .parentsUntil() 的选择器没有匹配到任何东西,或者干脆没有提供选择器,那么返回的对象会是这个对象所有的前辈元素。例如再次从项目 A 开始找,但这次使用一个匹配不到任何东西的选择器:</p>
<pre>$('li.item-a').parentsUntil('.not-here')
.css('background-color', 'red');</pre>
<p>其结果是给 level-2 列表, 项目 II, level-1 列表, <code><body></code> 元素和 <code><html></code> 元素都设置了红色背景。</p>
</longdesc>
<example>
<desc>查找 <li class="item-a"> 的前辈,直到 <ul class="level-1"> 为止,并给它们设置红色背景。</desc>
</example>
</entry>
<entry type="method" name="prevUntil">
<desc>查找当前元素之前所有的同辈元素,直到遇到选择器匹配的元素为止,不包括那个匹配到的元素。</desc>
<signature>
<argument name="selector">
<desc>选择器字符串,用于确定到哪个排在前面的同辈元素时停止匹配。</desc>
</argument>
</signature>
<longdesc>
<p>如果提供的jQuery代表了一组DOM元素, <code>.prevUntil()</code> 方法会找遍所有元素所在的DOM树中排在它们前面的元素,直到遇到了一个跟提供的参数匹配的元素的时候才会停下来。这个新jQuery对象里包含了前面所有找到的同辈元素,但不包括提供给 <code>.prevUntil()</code> 的选择器匹配到的元素。</p>
<p>如果提供的选择器没有匹配到任何东西,或者干脆没有提供选择器,那么排在前面的所有同辈元素都会被选中。这就跟用没有提供参数的 <code>.prevAll()</code> 效果一样。</p>
<p>考虑如下的定义列表:</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>如果我们从 term 2 开始,查找在它之前的所有元素,直到 <code><dt></code>为止。</p>
<pre>$('#term-2').prevUntil('dt').css('background-color', 'red');</pre>
<p>其结果是使 definitions <code>1-a</code>, <code>1-b</code>, <code>1-c</code>, 和 <code>1-d</code> 的背景变为红色。</p>
</longdesc>
<example>
<desc>查找排在 <dt id="term-2"> 之前的同辈元素,直到 <dt> 为止,并把它们的背景都设成红色。</desc>
</example>
</entry>
<entry type="method" name="nextUntil">
<desc>查找当前元素之前所有的同辈元素,直到遇到选择器匹配的元素为止,不包括那个匹配到的元素。</desc>
<signature>
<argument name="selector">
<desc>选择器字符串,用于确定到哪个跟在后面的同辈元素时停止匹配。</desc>
</argument>
</signature>
<longdesc><p>如果提供的jQuery代表了一组DOM元素, <code>.nextUntil()</code> 方法会找遍所有元素所在的DOM树中跟在它们后面的元素,直到遇到了一个跟提供的参数匹配的元素时才会停下来。这个新jQuery对象里包含了后面所有找到的同辈元素,但不包括提供给 <code>.nextUntil()</code> 的选择器匹配到的元素。</p>
<p>如果提供的选择器没有匹配到任何东西,或者干脆没有提供选择器,那么排在后面的所有同辈元素都会被选中。这就跟用没有提供参数的 <code>.nextAll()</code> 效果一样。</p>
<p>考虑如下的定义列表:</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>如果我们从 term 2 开始,查找在它之后的所有元素,直到 <code><dt></code>为止</p>
<pre>$('#term-2').nextUntil('dt').css('background-color', 'red');</pre>
<p>其结果是使 definition <code>2-a</code>, <code>2-b</code>, and <code>2-c</code> 的背景变为红色。</p>
</longdesc>
<example>
<desc>查找跟在 <dt id="term-2"> 之后的同辈元素,直到 <dt> 为止,并把它们的背景都设成红色。</desc>
</example>
</entry>
<entry type="method" name="event.isImmediatePropagationStopped">
<desc>根据事件对象中是否调用过 <a href="event.stopImmediatePropagation.htm">event.stopImmediatePropagation()</a> 方法来返回一个布尔值。</desc>
<signature/>
<longdesc>
<p>这个事件方法在 <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>检测 event.stopImmediatePropagation() 是否被调用过。</desc>
</example>
</entry>
<entry type="method" name="event.stopImmediatePropagation">
<desc>阻止剩余的事件处理函数执行并且防止事件冒泡到DOM树上。</desc>
<signature/>
<longdesc>
<p>除了阻止元素上其它的事件处理函数的执行,这个方法还会通过在内部调用 <code>event.stopPropagation()</code> 来停止事件冒泡。如果仅仅想要停止事件冒泡到前辈元素上,而让这个元素上的其它事件处理函数继续执行,我们可以使用 <code><a href="event.stopPropagation.htm">event.stopPropagation()</a></code> 来代替。</p>
<p>使用 <code><a href="event.isImmediatePropagationStopped.htm">event.isImmediatePropagationStopped()</a></code> 来确定这个方法是否(在那个事件对象上)调用过了。</p>
</longdesc>
<example>
<desc>阻止调用其它事件处理函数。</desc>
</example>
</entry>
<entry type="method" name="event.isPropagationStopped">
<desc>根据事件对象中是否调用过 <a href="event.stopPropagation.htm">event.stopPropagation()</a> 方法来返回一个布尔值。</desc>
<signature/>
<longdesc>
<p>这个事件方法在 <a href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/events.html#Events-Event-isPropagationStopped">W3C DOM Level 3 specification</a> 有介绍。</p>
</longdesc>
<example>
<desc>检测 event.stopPropagation() 是否被调用过。</desc>
</example>
</entry>
<entry type="method" name="event.stopPropagation">
<desc>防止事件冒泡到DOM树上,也就是不触发的任何前辈元素上的事件处理函数。</desc>
<signature/>
<longdesc>
<p>我们可以用 <code><a href="event.isPropagationStopped.htm">event.isPropagationStopped()</a></code> 来确定这个方法是否(在那个事件对象上)调用过了。</p>
<p>这个方法对 <a href="trigger.htm">trigger()</a> 来自定义的事件同样有效。</p>
<p>注意,这不会阻止<em>同一个元素上</em>的其它事件处理函数的运行。</p>
</longdesc>
<example>
<desc>灭掉click事件的冒泡。</desc>
</example>
</entry>
<entry type="method" name="event.isDefaultPrevented">
<desc>根据事件对象中是否调用过 <a href="event.preventDefault.htm">event.preventDefault()</a> 方法来返回一个布尔值。</desc>
<signature/>
<longdesc> </longdesc>
<example>
<desc>检测 event.preventDefault() 是否被调用过。</desc>
</example>
</entry>
<entry type="method" name="event.preventDefault">
<desc>阻止默认事件行为的触发。</desc>
<signature/>
<longdesc>
<p>举例来说,在执行这个方法后,如果点击一个锚点<code><a /></code>,就不会让浏览器跳转到新的 URL 去了。我们可以用 <code>event.isDefaultPrevented()</code> 来确定这个方法是否(在那个事件对象上)调用过了。</p>
</longdesc>
<example>
<desc>取消点击的默认行为(导航)。</desc>
</example>
</entry>
<entry type="property" name="event.timeStamp">
<desc>事件触发时距离1970年1月1日的毫秒数。</desc>
<signature/>
<longdesc><p>通过在代码中两处获得 <code>event.timeStamp</code> 的值并记录他们的差值,可以很方便的检测某个jQuery函数的性能。</p> </longdesc>
<example>
<desc>显示两次点击之间的时间。</desc>
</example>
</entry>
<entry type="property" name="event.result">
<desc>当前事件最后触发的那个处理函数的返回值,除非值是 <code>undefined</code> 。</desc>
<signature/>
<longdesc><p>这个属性经常用于获取自定义事件的前一个返回值。</p></longdesc>
<example>
<desc>显示前一个事件处理函数的返回值。</desc>
</example>
</entry>
<entry type="property" name="event.which">
<desc>针对键盘和鼠标事件,这个属性能确定你到底按的是哪个键。</desc>
<signature/>
<longdesc>
<p>
<code>event.which</code> 将 <code>event.keyCode</code> 和 <code>event.charCode</code> 标准化了。推荐用 <code>event.which</code> 来监视键盘输入。更多细节请参阅: <a href="https://developer.mozilla.org/en/DOM/event.charCode#Notes">event.charCode on the MDC</a>. </p>
</longdesc>
<example>
<desc>记录按键</desc>
</example>
</entry>
<entry type="property" name="event.pageY">
<desc>鼠标相对于文档顶部的坐标。</desc>
<signature/>
<longdesc> </longdesc>
<example>
<desc>显示鼠标相对于文档(框架中)顶部和左边的坐标。</desc>
</example>
</entry>
<entry type="property" name="event.pageX">
<desc>鼠标相对于文档左部的坐标。</desc>
<signature/>
<longdesc> </longdesc>
<example>
<desc>显示鼠标相对于文档(框架中)顶部和左边的坐标。</desc>
</example>
</entry>
<entry type="property" name="event.currentTarget">
<desc>事件冒泡阶段当前所在DOM元素。</desc>
<signature/>
<longdesc>
<p>这个属性通常与函数的 <code>this</code> 相同。</p>
<p><em>如果你使用了 <a href="jQuery.proxy.htm">jQuery.proxy</a> 或其他方式操作了作用域, <code>this</code> 会等于你所指定的内容,而不再是 <code>event.currentTarget</code></em>。</p>
</longdesc>
<example>
<desc>如果 currentTarget 完全等同于 `this` 则弹出警告框。</desc>
</example>
</entry>
<entry type="property" name="event.relatedTarget">
<desc>在事件中涉及的其它任何DOM元素。</desc>
<signature/>
<longdesc>
<p>对于 <code>mouseout</code> 事件,它指向被进入的元素;对于 <code>mousein</code> 事件,它指向被离开的元素。</p>
</longdesc>
<example>
<desc>对于锚点的 mouseout 事件,显示被进入的元素类型。</desc>
</example>
</entry>
<entry type="property" name="event.data">
<desc>在绑定事件时传给 bind 函数的可选数据。</desc>
<signature/>
<longdesc> </longdesc>
<example>
<desc>显示传入的数据</desc>
</example>
</entry>
<entry type="property" name="event.target">
<desc>最初触发事件的DOM元素。</desc>
<signature/>
<longdesc>
<p><code>event.target</code> 属性指向的对象可能是事件绑定时的那个对象,也可能是它的子孙元素。通常通过比较 <code>event.target</code> 和 <code>this</code> 来确定事件是不是由于冒泡而触发的。经常用于事件冒泡时处理事件委托。</p>
</longdesc>
<example>
<desc>显示点击元素的标签名。</desc>
</example>
<example>
<desc>实现一个简单的事件委托:给无序列表增加一个点击事件处理函数,然后它的子元素li的子元素都隐藏起来。当点击这个ul其中一个子元素li的时候,来回切换显示(参见 <a href="toggle.htm">toggle()</a>)li的子元素。</desc>
</example>
</entry>
<entry type="property" name="event.type">
<desc>描述事件类型。</desc>
<signature/>
<longdesc> </longdesc>
<example>
<desc>点击所有锚点后弹出事件类型。</desc>
</example>
</entry>
<entry type="property" name="jQuery.fx.off">
<desc>禁用页面上所有的动画。</desc>
<signature/>
<longdesc>
<p>把这个属性设置为 <code>true</code> 后,所有动画方法会立即停止特效,并把元素设置成动画的最终状态。有时候确实有必要这样做,比如:</p>
<ul>
<li>jQuery 用在资源较少的设备。</li>
<li>一些用户由于动画效果而遇到了可访问性问题。(参考文章 <a href="http://www.jdeegan.phlegethon.org/turn_off_animation.htm">Turn Off Animation</a> 以获取更多信息。)</li>
</ul>
<p>当把这个属性设成 <code>false</code> 之后,可以重新开启所有动画。</p>
</longdesc>
<example>
<desc>切换开启或关闭动画。</desc>
</example>
</entry>
<entry type="method" name="each">
<desc>迭代jQuery对象,为每个匹配的元素执行函数。</desc>
<signature>
<argument name="function(index, Element)">
<desc>为每个匹配元素执行的函数</desc>
</argument>
</signature>
<longdesc>
<p><code>.each()</code> 方法用来让DOM循环结构更简单更不易出错。它会迭代jQuery对象中的每一个DOM元素。每次回调函数执行时,会传递当前循环次数作为参数(从0开始计数)。更重要的是,回调函数是在当前DOM元素为上下文的语境中触发的。因此关键字 <code>this</code> 总是指向这个元素。</p>
<p>假设页面上有这样一个简单的无序列表。</p>
<pre><ul>
<li>foo</li>
<li>bar</li>
</ul>
</pre>
<p>我们可以选中并迭代这些列表:</p>
<pre>$('li').each(function(index) {
alert(index + ': ' + $(this).text());
});
</pre>
<p>列表中每一项会显示在下面的消息中:</p>
<p>
<span class="output">0: foo</span>
<br/>
<span class="output">1: bar</span>
</p>
<p>我们可以通过返回 <code>false</code>以便在回调函数内中止循环。</p>
</longdesc>
<example>
<desc>遍历三个div并设置它们的color属性。</desc>
</example>
<example>
<desc>如果你不想要普通的DOM元素,而想获得的是jQuery对象的话,使用$(this) 函数。例如:</desc>
</example>
<example>
<desc>你可以使用 'return' 来提前结束 each() 循环。</desc>
</example>
</entry>
<entry type="method" name="pushStack">
<desc>将一个DOM元素集合加入到jQuery栈。</desc>
<signature>
<argument name="elements">
<desc>将要压入jQuery栈的元素,用于生成一个新的jQuery对象。</desc>
</argument>
</signature>
<signature>
<argument name="elements">
<desc>将要压入jQuery栈的元素,用于生成一个新的jQuery对象。</desc>
</argument>
<argument name="name">
<desc>用于生成元素数组的jQuery方法名。</desc>
</argument>
<argument name="arguments">
<desc>传递给jQuery方法的参数(用于序列化)。</desc>
</argument>
</signature>
<longdesc/>
<example>
<desc>Add some elements onto the jQuery stack, then pop back off again.</desc>
</example>
</entry>
<entry type="method" name="jQuery.globalEval">
<desc>全局执行一些JavaScript代码。</desc>
<signature>
<argument name="code">
<desc>将要执行的 JavaScript 代码。</desc>
</argument>
</signature>
<longdesc>
<p>这个方法与普通 JavaScript 中 <code>eval()</code> 的不同之处在于,它是在全局的上下文语境中执行的代码,这对于动态载入外部脚本非常重要。</p>
</longdesc>
<example>
<desc>全局地执行脚本。</desc>
</example>
</entry>
<entry type="method" name="jQuery.isXMLDoc">
<desc>检测一个DOM节点是否在一个XML文档中(或者本身就是一个XML文档)。</desc>
<signature>
<argument name="node">
<desc>用于检测是否在XML文档中的DOM节点。</desc>
</argument>
</signature>
<longdesc/>
<example>
<desc>检测一个对象是否在一个XML文档之中。</desc>
</example>
</entry>
<entry type="method" name="jQuery.removeData">
<desc>移除先前存储的数据片段。</desc>
<signature>
<argument name="element">
<desc>将要移除数据的DOM元素。</desc>
</argument>
<argument name="name">
<desc>将要移除的数据片段名。</desc>
</argument>
</signature>
<longdesc>
<p>
<strong>注意:</strong> 这是一个底层方法,使用 <code><a href="removeData.htm">.removeData()</a></code> 更方便。</p>
<p><code>jQuery.removeData()</code> 允许我们移除先前用 <code><a href="jQuery.data.htm">jQuery.data()</a></code> 设置的数据。如果提供了name参数,则 <code>jQuery.removeData()</code> 删除那个指定的值,如果不带参数,则删除所有数据。</p>
</longdesc>
<example>
<desc>设置两个数据,然后再删除其中一个。</desc>
</example>
</entry>
<entry type="method" name="jQuery.data">
<desc>在指定的元素上随心所欲的存放数据。</desc>
<signature>
<argument name="element">
<desc>用于存放数据的DOM元素。</desc>
</argument>
<argument name="key">
<desc>将要设置的数据片段名。</desc>
</argument>
<argument name="value">
<desc>新的数据值。</desc>
</argument>
</signature>
<longdesc>
<p>
<strong>注意:</strong> 这是一个底层方法,使用 <code><a href="data.htm">.data()</a></code> 更方便。</p>
<p><code>jQuery.data()</code> 方法允许我们安全地将任何类型的数据附加到DOM元素上而不用担心循环引用和内存泄露之类的问题。我们在单个元素上设置几个独立的数据,并且以后还可以分别检索到:</p>
<pre>jQuery.data(document.body, 'foo', 52);
jQuery.data(document.body, 'bar', 'test');</pre>
</longdesc>
<example>
<desc>在一个DIV元素上存放数据,然后检索这个数据。</desc>
</example>
</entry>
<entry type="method" name="jQuery.data">
<desc>返回用 <code>jQuery.data(element, name, value)</code> 存放在元素上的指定数据,或者元素上的所有数据。</desc>
<signature>
<argument name="element">
<desc>将要查询数据的DOM元素。</desc>
</argument>
<argument name="key">
<desc>存放的数据名。</desc>
</argument>
</signature>
<signature>
<argument name="element">
<desc>将要查询数据的DOM元素。</desc>
</argument>
</signature>
<longdesc>
<p>
<strong>注意:</strong> 这是一个底层方法,使用 <code><a href="data.htm">.data()</a></code> 更方便。</p>
<p><code>jQuery.data()</code> 方法允许我们安全地将任何类型的数据附加到DOM元素上而不用担心循环引用和内存泄露之类的问题。 我们可以分别在DOM元素上获取几个独立的数据,或者一次获取一组:</p>
<pre>alert(jQuery.data( document.body, 'foo' ));
alert(jQuery.data( document.body ));</pre>
<p>上面两行中alert的数据都是先前给 <code>body</code> 设置的。如果先前没有设置过,则返回一个空字符串。</p>
<p>调用 <code>jQuery.data(element)</code> 可以返回一个JavaScript对象,包含元素上所有存放的数据。注意jQuery本身也在内部使用这个方法存放数据,比如事件处理函数,所以返回的对象中会包含不是你自己代码存放的数据。</p>
<p>
<strong>HTML 5 data- 属性</strong>
</p>
<p>从 jQuery 1.4.3 起,<a href="http://ejohn.org/blog/html-5-data-attributes/">HTML 5 data- 属性</a> 中的数据会自动添加进 jQuery 的 data 对象</p>
<p>例如下面的 HTML:</p>
<pre><div data-role="page" data-hidden="true" data-options='{"name":"John"}'></div></pre>
<p>如下所有的 jQuery 代码都可以正常使用。</p>
<pre>$("div").data("role") === "page";
$("div").data("hidden") === true;
$("div").data("options").name === "John";</pre>
<p>Note that strings are left intact while JavaScript values are converted to their associated value (this includes booleans, numbers, objects, arrays, and null). When the data attribute is an object (starts with '{') or array (starts with '[') then <code>jQuery.parseJSON</code> is used to parse the string; it must follow valid JSON syntax <em>including quoted property names</em>. The data- attributes are pulled in the first time the data property is accessed and then are no longer accessed or mutated (all data values are then stored internally in jQuery).</p>
</longdesc>
<example>
<desc>获取存放在元素上名叫 "blah" 的数据。</desc>
</example>
</entry>
<entry type="method" name="jQuery.dequeue">
<desc>为匹配的元素执行队列中下一个函数。</desc>
<signature>
<argument name="element">
<desc>一个DOM元素,会从它附带的函数队列中弹出并执行一个函数。</desc>
</argument>
<argument name="queueName">
<desc>包含队列名的字符串。默认值是 <code>fx</code> ,即动画效果队列。</desc>
</argument>
</signature>
<longdesc>
<p>
<strong>注意:</strong> 这是一个底层方法,应当使用更合适的 <code><a href="dequeue.htm">.dequeue()</a></code> 来代替。</p>
<p>当调用 <code>jQuery.dequeue()</code> 时,队列中的下一个函数会从队列中移出并执行。这个函数应当在内部直接或间接调用 <code>jQuery.dequeue()</code> 以便队列得以继续执行下去。</p>
</longdesc>
<example>
<desc>使用 dequeue 来结束一个自定义的队列函数,以便能够让队列继续运行下去。</desc>
</example>
</entry>
<entry type="method" name="jQuery.queue">
<desc>显示匹配元素上将要执行的函数队列。</desc>
<signature>
<argument name="element">
<desc>将要检测附加队列的DOM元素。</desc>
</argument>
<argument name="queueName">