forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zepto.d.ts
1666 lines (1408 loc) · 50 KB
/
zepto.d.ts
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
// Type definitions for Zepto 1.0-rc.1
// Project: http://zeptojs.com/
// Definitions by: Josh Baldwin <https://github.com/jbaldwin/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/*
zepto-1.0rc1.d.ts may be freely distributed under the MIT license.
Copyright (c) 2013 Josh Baldwin https://github.com/jbaldwin/zepto.d.ts
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
interface ZeptoStatic {
/**
* Core
**/
/**
* Create a Zepto collection object by performing a CSS selector, wrapping DOM nodes, or creating elements from an HTML string.
* @param selector
* @param context
* @return
**/
(selector: string, context?: any): ZeptoCollection;
/**
* @see ZeptoStatic();
* @param collection
**/
(collection: ZeptoCollection): ZeptoCollection;
/**
* @see ZeptoStatic();
* @param element
**/
(element: HTMLElement): ZeptoCollection;
/**
* @see ZeptoStatic();
* @param htmlString
**/
(htmlString: string): ZeptoCollection;
/**
* @see ZeptoStatic();
* @param attributes
**/
(htmlString: string, attributes: any): ZeptoCollection;
/**
* @see ZeptoStatic();
* @param object
**/
(object: any): ZeptoCollection; // window and document tests break without this
/**
* Turn a dasherized string into “camel case”. Doesn’t affect already camel-cased strings.
* @param str
* @return
**/
camelCase(str: string): string;
/**
* Check if the parent node contains the given DOM node. Returns false if both are the same node.
* @param parent
* @param node
* @return
**/
contains(parent: HTMLElement, node: HTMLElement): boolean;
/**
* Iterate over array elements or object key-value pairs. Returning false from the iterator function stops the iteration.
* @param collection
* @param fn
**/
each(collection: any[], fn: (index: number, item: any) => boolean): void;
/**
* @see ZeptoStatic.each
**/
each(collection: any, fn: (key: string, value: any) => boolean): void;
/**
* Extend target object with properties from each of the source objects, overriding the properties on target.
* By default, copying is shallow. An optional true for the first argument triggers deep (recursive) copying.
* @param target
* @param sources
* @return
**/
extend(target: any, ...sources: any[]): any;
/**
* @see ZeptoStatic.extend
* @param deep
**/
extend(deep: boolean, target: any, ...sources: any[]): any;
/**
* Zepto.fn is an object that holds all of the methods that are available on Zepto collections, such as addClass(), attr(), and other. Adding a function to this object makes that method available on every Zepto collection.
**/
fn: any;
/**
* Get a new array containing only the items for which the callback function returned true.
* @param items
* @param fn
* @return
**/
grep(items: any[], fn: (item: any) => boolean): any[];
/**
* Get the position of element inside an array, or -1 if not found.
* @param element
* @param array
* @param fromIndex
* @return
**/
inArray(element: any, array: any[], fromIndex?: number): number;
/**
* True if the object is an array.
* @param object
* @return
**/
isArray(object: any): boolean;
/**
* True if the object is a function.
* @param object
* @return
**/
isFunction(object: any): boolean;
/**
* True if the object is a “plain” JavaScript object, which is only true for object literals and objects created with new Object.
* @param object
* @return
**/
isPlainObject(object: any): boolean;
/**
* True if the object is a window object. This is useful for iframes where each one has its own window, and where these objects fail the regular obj === window check.
* @param object
* @return
**/
isWindow(object: any): boolean;
/**
* Iterate through elements of collection and return all results of running the iterator function, with null and undefined values filtered out.
* @param collection
* @param fn
* @return
**/
map(collection: any[], fn: (item: any, index: number) => any): any[];
/**
* Alias for the native JSON.parse method.
* @param str
* @retrun
**/
parseJSON(str: string): any;
/**
* Remove whitespace from beginning and end of a string; just like String.prototype.trim().
* @param str
* @return
**/
trim(str: string): string;
/**
* Get string type of an object. Possible types are: null undefined boolean number string function array date regexp object error.
* For other objects it will simply report “object”. To find out if an object is a plain JavaScript object, use isPlainObject.
* @param object
* @return
**/
type(object: any): string;
/**
* Event
**/
/**
* Create and initialize a DOM event of the specified type. If a properties object is given, use it to extend the new event object. The event is configured to bubble by default; this can be turned off by setting the bubbles property to false.
* An event initialized with this function can be triggered with trigger.
* @param type
* @param properties
* @return
**/
Event(type: string, properties: any): Event;
/**
* Get a function that ensures that the value of this in the original function refers to the context object. In the second form, the original function is read from the specific property of the context object.
**/
proxy(fn: Function, context: any): Function;
/**
* Ajax
**/
/**
* Perform an Ajax request. It can be to a local resource, or cross-domain via HTTP access control support in browsers or JSONP.
* Options:
* type (default: “GET”): HTTP request method (“GET”, “POST”, or other)
* url (default: current URL): URL to which the request is made
* data (default: none): data for the request; for GET requests it is appended to query string of the URL. Non-string objects will get serialized with $.param
* processData (default: true): whether to automatically serialize data for non-GET requests to string
* contentType (default: “application/x-www-form-urlencoded”): the Content-Type of the data being posted to the server (this can also be set via headers). Pass false to skip setting the default value.
* dataType (default: none): response type to expect from the server (“json”, “jsonp”, “xml”, “html”, or “text”)
* timeout (default: 0): request timeout in milliseconds, 0 for no timeout
* headers: object of additional HTTP headers for the Ajax request
* async (default: true): set to false to issue a synchronous (blocking) request
* global (default: true): trigger global Ajax events on this request
* context (default: window): context to execute callbacks in
* traditional (default: false): activate traditional (shallow) serialization of data parameters with $.param
* If the URL contains =? or dataType is “jsonp”, the request is performed by injecting a <script> tag instead of using XMLHttpRequest (see JSONP). This has the limitation of contentType, dataType, headers, and async not being supported.
* @param options
* @return
**/
ajax(options: ZeptoAjaxSettings): XMLHttpRequest;
/**
* Perform a JSONP request to fetch data from another domain.
* This method has no advantages over $.ajax and should not be used.
* @param options Ajax settings to use with JSONP call.
* @deprecated use $.ajax instead.
**/
ajaxJSONP(options: ZeptoAjaxSettings): XMLHttpRequest;
/**
* Object containing the default settings for Ajax requests. Most settings are described in $.ajax. The ones that are useful when set globally are:
* @example
* timeout (default: 0): set to a non-zero value to specify a default timeout for Ajax requests in milliseconds
* global (default: true): set to false to prevent firing Ajax events
* xhr (default: XMLHttpRequest factory): set to a function that returns instances of XMLHttpRequest (or a compatible object)
* accepts: MIME types to request from the server for specific dataType values:
* script: “text/javascript, application/javascript”
* json: “application/json”
* xml: “application/xml, text/xml”
* html: “text/html”
* text: “text/plain”
**/
ajaxSettings: ZeptoAjaxSettings;
/**
* Perform an Ajax GET request. This is a shortcut for the $.ajax method.
* @param url URL to send the HTTP GET request to.
* @param fn Callback function when the HTTP GET request is completed.
* @return The XMLHttpRequest object.
**/
get (url: string, fn: (data: any, status: string, xhr: XMLHttpRequest) => void ): XMLHttpRequest;
/**
* @see ZeptoStatic.get
* @param data See ZeptoAjaxSettings.data
**/
get (url: string, data: any, fn: (data: any, status: string, xhr: XMLHttpRequest) => void ): XMLHttpRequest;
/**
* Get JSON data via Ajax GET request. This is a shortcut for the $.ajax method.
* @param url URL to send the HTTP GET request to.
* @param fn Callback function when the HTTP GET request is completed.
* @return The XMLHttpRequest object.
**/
getJSON(url: string, fn: (data: any, status: string, xhr: XMLHttpRequest) => void ): XMLHttpRequest;
/**
* @see ZeptoStatic.getJSON
* @param data See ZeptoAjaxSettings.data
**/
getJSON(url: string, data: any, fn: (data: any, status: string, xhr: XMLHttpRequest) => void ): XMLHttpRequest;
/**
* Serialize an object to a URL-encoded string representation for use in Ajax request query strings and post data. If shallow is set, nested objects are not serialized and nested array values won’t use square brackets on their keys.
* Also accepts an array in serializeArray format, where each item has “name” and “value” properties.
* @param object Serialize this object to URL-encoded string representation.
* @param shallow Only serialize the first level of `object`.
* @return Seralized URL-encoded string representation of `object`.
**/
param(object: any, shallow?: boolean): string;
/**
* Perform an Ajax POST request. This is a shortcut for the $.ajax method.
* @param url URL to send the HTTP POST request to.
* @param fn Callback function when the HTTP POST request is completed.
* @return The XMLHttpRequest object.
**/
post(url: string, fn: (data: any, status: string, xhr: XMLHttpRequest) => void , dataType?: string): XMLHttpRequest;
/**
* @see ZeptoStatic.post
* @param data See ZeptoAjaxSettings.data
**/
post(url: string, data: any, fn: (data: any, status: string, xhr: XMLHttpRequest) => void , dataType?: string): XMLHttpRequest;
/**
* Effects
**/
/**
* Global settings for animations.
**/
fx: ZeptoEffects;
/**
* Detect
**/
/**
* The following boolean flags are set to true if they apply, if not they're either set to 'false' or 'undefined'. We recommend accessing them with `!!` prefixed to coerce to a boolean.
**/
os: {
/**
* OS version.
**/
version: string;
/**
* General device type
**/
phone: boolean;
tablet: boolean;
/**
* Specific OS
**/
ios: boolean;
android: boolean;
webos: boolean;
blackberry: boolean;
bb10: boolean;
rimtabletos: boolean;
/**
* Specific device type
**/
iphone: boolean;
ipad: boolean;
touchpad: boolean;
kindle: boolean;
};
/**
* The following boolean flags are set to true if they apply, if not they're either set to 'false' or 'undefined'. We recommend accessing them with `!!` prefixed to coerce to a boolean.
**/
browser: {
/**
* Browser version.
**/
version: string;
/**
* Specific browser
**/
chrome: boolean;
firefox: boolean;
silk: boolean;
playbook: boolean;
};
}
interface ZeptoEffects {
/**
* (default false in browsers that support CSS transitions): set to true to disable all animate() transitions.
**/
off: boolean;
/**
* An object with duration settings for animations.
* Change existing values or add new properties to affect animations that use a string for setting duration.
**/
speeds: ZeptoEffectsSpeeds;
}
interface ZeptoEffectsSpeeds {
/**
* Default = 400ms.
**/
_default: number;
/**
* Default = 200ms.
**/
fast: number;
/**
* Default = 600ms.
**/
slow: number;
}
interface ZeptoCollection {
/**
* Core
**/
/**
* Modify the current collection by adding the results of performing the CSS selector on the whole document, or, if context is given, just inside context elements.
* @param selector
* @param context
* @return Self object.
**/
add(selector: string, context?: any): ZeptoCollection;
/**
* Add class name to each of the elements in the collection. Multiple class names can be given in a space-separated string.
* @param name
* @return Self object.
**/
addClass(name: string): ZeptoCollection;
/**
* Add content to the DOM after each elements in the collection. The content can be an HTML string, a DOM node or an array of nodes.
* @param content
* @return Self object.
**/
after(content: string): ZeptoCollection;
/*
* @see ZeptoCollection.after
**/
after(content: HTMLElement): ZeptoCollection;
/**
* @see ZeptoCollection.after
**/
after(content: HTMLElement[]): ZeptoCollection;
/**
* @see ZeptoCollection.after
**/
after(content: ZeptoCollection): ZeptoCollection;
/**
* Append content to the DOM inside each individual element in the collection. The content can be an HTML string, a DOM node or an array of nodes.
* @param content
* @return Self object.
**/
append(content: string): ZeptoCollection;
/**
* @see ZeptoCollection.append
**/
append(content: HTMLElement): ZeptoCollection;
/**
* @see ZeptoCollection.append
**/
append(content: HTMLElement[]): ZeptoCollection;
/**
* @see ZeptoCollection.append
**/
append(content: ZeptoCollection): ZeptoCollection;
/**
* Append elements from the current collection to the target element. This is like append, but with reversed operands.
* @param target
* @return Self object.
**/
appendTo(target: string): ZeptoCollection;
/**
* @see ZeptoCollection.appendTo
**/
appendTo(target: HTMLElement): ZeptoCollection;
/**
* @see ZeptoCollection.appendTo
**/
appendTo(target: HTMLElement[]): ZeptoCollection;
/**
* @see ZeptoCollection.appendTo
**/
appendTo(target: ZeptoCollection): ZeptoCollection;
/**
* Read or set DOM attributes. When no value is given, reads specified attribute from the first element in the collection. When value is given, sets the attribute to that value on each element in the collection. When value is null, the attribute is removed (like with removeAttr). Multiple attributes can be set by passing an object with name-value pairs.
* To read DOM properties such as checked or selected, use prop.
* @param name
* @return
**/
attr(name: string): string;
/**
* @see ZeptoCollection.attr
* @param value
**/
attr(name: string, value: any): ZeptoCollection;
/**
* @see ZeptoCollection.attr
* @param fn
* @param oldValue
**/
attr(name: string, fn: (index: number, oldValue: any) => void ): ZeptoCollection;
/**
* @see ZeptoCollection.attr
* @param object
**/
attr(object: any): ZeptoCollection;
/**
* Add content to the DOM before each element in the collection. The content can be an HTML string, a DOM node or an array of nodes.
* @param content
* @return Self object.
**/
before(content: string): ZeptoCollection;
/**
* @see ZeptoCollection.before
**/
before(content: HTMLElement): ZeptoCollection;
/**
* @see ZeptoCollection.before
**/
before(content: HTMLElement[]): ZeptoCollection;
/**
* @see ZeptoCollection.before
**/
before(content: ZeptoCollection): ZeptoCollection;
/**
* Get immediate children of each element in the current collection. If selector is given, filter the results to only include ones matching the CSS selector.
* @param selector
* @return Children elements.
**/
children(selector?: string): ZeptoCollection;
/**
* Duplicate all elements in the collection via deep clone.
* (!) This method doesn't have an option for copying data and event handlers over to the new elements, as it has in jQuery.
* @return Clone of the self object.
**/
clone(): ZeptoCollection;
/**
* Traverse upwards from the current element to find the first element that matches the selector. If context node is given, consider only elements that are its descendants. This method is similar to parents(selector), but it only returns the first ancestor matched.
* If a Zepto collection or element is given, the resulting element will have to match one of the given elements instead of a selector.
* @param selector
* @param context
* @return Closest element from the selector and context.
**/
closest(selector: string, context?: any): ZeptoCollection;
/**
* Modify the collection by adding elements to it. If any of the arguments is an array, its elements are merged into the current collection.
* (!) This is a Zepto-provided method that is not part of the jQuery API.
* @param nodes
* @return Self object.
**/
concat(...nodes: any[]): ZeptoCollection;
/**
* Get the children of each element in the collection, including text and comment nodes.
* @return Children including text and comment nodes.
**/
contents(): ZeptoCollection;
/**
* Read or set CSS properties on DOM elements. When no value is given, returns the CSS property from the first element in the collection. When a value is given, sets the property to that value on each element of the collection. Multiple properties can be set by passing an object to the method.
* When a value for a property is blank (empty string, null, or undefined), that property is removed. When a unitless number value is given, “px” is appended to it for properties that require units.
* @param property
* @return
**/
css(property: string): any;
/**
* @see ZeptoCollection.css
* @param value
**/
css(property: string, value: any): ZeptoCollection;
/**
* @see ZeptoCollection.css
* @param properties
**/
css(properties: any): ZeptoCollection;
/**
* Read or write data-* DOM attributes. Behaves like attr, but prepends data- to the attribute name.
* When reading attribute values, the following conversions apply:
* “true”, “false”, and “null” are converted to corresponding types;
* number values are converted to actual numeric types;
* JSON values are parsed, if it’s valid JSON;
* everything else is returned as string.
* (!) Zepto's basic implementation of `data()` only stores strings. To store arbitrary objects, include the optional "data" module in your custom build of Zepto.
* @param name
* @return
**/
data(name: string): any;
/**
* @see ZeptoCollection.data
* @param value
**/
data(name: string, value: any): ZeptoCollection;
/**
* Iterate through every element of the collection. Inside the iterator function, this keyword refers to the current item (also passed as the second argument to the function). If the iterator function returns false, iteration stops.
* @param fn
* @param item
* @return Self object.
**/
each(fn: (index: number, item: any) => boolean): ZeptoCollection;
/**
* Clear DOM contents of each element in the collection.
* @return Self object.
**/
empty(): ZeptoCollection;
/**
* Get the item at position specified by index from the current collection.
* @param index
* @return Item specified by index in this collection.
**/
eq(index: number): ZeptoCollection;
/**
* Filter the collection to contain only items that match the CSS selector. If a function is given, return only elements for which the function returns a truthy value. Inside the function, the this keyword refers to the current element.
* For the opposite, see not.
* @param selector
* @return Filtered collection.
**/
filter(selector: string): ZeptoCollection;
/**
* @see ZeptoCollection.filter
* @param fn
**/
filter(fn: (index: number) => boolean): ZeptoCollection;
/**
* Find elements that match CSS selector executed in scope of nodes in the current collection.
* If a Zepto collection or element is given, filter those elements down to only ones that are descendants of element in the current collection.
* @param selector
* @return Found items.
**/
find(selector: string): ZeptoCollection;
/**
* @see ZeptoCollection.find
* @param collection
**/
find(collection: ZeptoCollection): ZeptoCollection;
/**
* @see ZeptoCollection.find
* @param element
**/
find(element: Element): ZeptoCollection;
/**
* Get the first element of the current collection.
* @return First element in the current collection.
**/
first(): ZeptoCollection;
/**
* Iterate through every element of the collection. Similar to each, but the arguments for the iterator functions are different, and returning false from the iterator won’t stop the iteration.
* (!) This is a Zepto-provided method that is not part of the jQuery API.
* @param fn
* @return
**/
forEach(fn: (item: any, index: number, array: any[]) => void ): ZeptoCollection;
/**
* Get all elements or a single element from the current collection. When no index is given, returns all elements in an ordinary array. When index is specified, return only the element at that position. This is different than eq in the way that the returned node is not wrapped in a Zepto collection.
* @return
**/
get (): HTMLElement[];
/**
* @see ZeptoCollection.get
* @param index
**/
get (index: number): HTMLElement;
/**
* Filter the current collection to include only elements that have any number of descendants that match a selector, or that contain a specific DOM node.
* @param selector
* @return
**/
has(selector: string): ZeptoCollection;
/**
* @see ZeptoCollection.has
* @param node
**/
has(node: HTMLElement): ZeptoCollection;
/**
* Check if any elements in the collection have the specified class.
* @param name
* @return
**/
hasClass(name: string): boolean;
/**
* Get the height of the first element in the collection; or set the height of all elements in the collection.
* @return
**/
height(): number;
/**
* @see ZeptoCollection.height
* @param value
**/
height(value: number): ZeptoCollection;
/**
* @see ZeptoCollection.height
* @param fn
**/
height(fn: (index: number, oldHeight: number) => void ): ZeptoCollection;
/**
* Hide elements in this collection by setting their display CSS property to none.
* @return
**/
hide(): ZeptoCollection;
/**
* Get or set HTML contents of elements in the collection. When no content given, returns innerHTML of the first element. When content is given, use it to replace contents of each element. Content can be any of the types described in append.
* @return
**/
html(): string;
/**
* @see ZeptoCollection.html
* @param content
**/
html(content: string): ZeptoCollection;
/**
* @see ZeptoCollection.html
* @param content
**/
html(content: HTMLElement): ZeptoCollection;
/**
* @see ZeptoCollection.html
* @param content
**/
html(content: HTMLElement[]): ZeptoCollection;
/**
* @see ZeptoCollection.html
* @param fn
**/
html(fn: (index: number, oldHtml: string) => void ): ZeptoCollection;
/**
* Get the position of an element. When no element is given, returns position of the current element among its siblings. When an element is given, returns its position in the current collection. Returns -1 if not found.
* @param element
* @return
**/
index(element?: string): number;
/**
* @see ZeptoCollection.index
* @param element
**/
index(element?: HTMLElement): number;
/**
* @see ZeptoCollection.index
* @param element
**/
index(element?: any): number; // not sure so leaving in for now
/**
* Get the position of an element in the current collection. If fromIndex number is given, search only from that position onwards. Returns the 0-based position when found and -1 if not found. Use of index is recommended over this method.
* (!) This is a Zepto-provided method that is not part of the jQuery API.
* @see ZeptoCollection.index
* @param element
* @param fromIndex
* @return
**/
indexOf(element: string, fromIndex?: number): number;
/**
* @see ZeptoCollection.indexOf
* @param element
**/
indexOf(element: HTMLElement, fromIndex?: number): number;
/**
* @see ZeptoCollection.indexOf
* @param element
**/
indexOf(element: any, fromIndex?: number): number; // not sure so leaving in for now
/**
* Insert elements from the current collection after the target element in the DOM. This is like after, but with reversed operands.
* @param target
* @return
**/
insertAfter(target: string): ZeptoCollection;
/**
* @see ZeptoCollection.insertAfter
* @param target
**/
insertAfter(target: HTMLElement): ZeptoCollection;
/**
* Insert elements from the current collection before each of the target elements in the DOM. This is like before, but with reversed operands.
* @param target
* @return
**/
insertBefore(target: string): ZeptoCollection;
/**
* @see ZeptoCollection.insertBefore
* @param target
**/
insertBefore(target: HTMLElement): ZeptoCollection;
/**
* Check if the first element of the current collection matches the CSS selector. For basic support of jQuery’s non-standard pseudo-selectors such as :visible, include the optional “selector” module.
* (!) jQuery CSS extensions are not supported. The optional "selector" module only provides limited support for few of the most used ones.
* @param selector
* @return
**/
is(selector?: string): boolean;
/**
* Get the last element of the current collection.
* @return
**/
last(): ZeptoCollection;
/**
* Iterate through all elements and collect the return values of the iterator function. Inside the iterator function, this keyword refers to the current item (also passed as the second argument to the function).
* Returns a collection of results of iterator function, with null and undefined values filtered out.
* @param fn
* @return
**/
map(fn: (index: number, item: any) => any): ZeptoCollection;
/**
* Get the next sibling—optinally filtered by selector—of each element in the collection.
* @param selector
* @return
**/
next(selector?: string): ZeptoCollection;
/**
* Filter the current collection to get a new collection of elements that don’t match the CSS selector. If another collection is given instead of selector, return only elements not present in it. If a function is given, return only elements for which the function returns a falsy value. Inside the function, the this keyword refers to the current element.
* For the opposite, see filter.
* @param selector
* @return
**/
not(selector: string): ZeptoCollection;
/**
* @see ZeptoCollection.not
* @param collection
**/
not(collection: ZeptoCollection): ZeptoCollection;
/**
* @see ZeptoCollection.not
* @param fn
**/
not(fn: (index: number) => boolean): ZeptoCollection;
/**
* Get position of the element in the document. Returns an object with properties: top, left, width and height.
* When given an object with properties left and top, use those values to position each element in the collection relative to the document.
* @return
**/
offset(): ZeptoCoordinates;
/**
* @see ZeptoCollection.offset
* @param coordinates
**/
offset(coordinates: ZeptoCoordinates): ZeptoCollection;
/**
* @see ZeptoCollection.offset
* @param fn
**/
offset(fn: (index: number, oldOffset: number) => void ): ZeptoCollection;
/**
* Find the first ancestor element that is positioned, meaning its CSS position value is “relative”, “absolute” or “fixed”.
* @return
**/
offsetParent(): ZeptoCollection;
/**
* Get immediate parents of each element in the collection. If CSS selector is given, filter results to include only ones matching the selector.
* @param selector
* @return
**/
parent(selector?: string): ZeptoCollection;
/**
* Get all ancestors of each element in the collection. If CSS selector is given, filter results to include only ones matching the selector.
* To get only immediate parents, use parent. To only get the first ancestor that matches the selector, use closest.
* @param selector
* @return
**/
parents(selector?: string): ZeptoCollection;
/**
* Get values from a named property of each element in the collection, with null and undefined values filtered out.
* (!) This is a Zepto-provided method that is not part of the jQuery API.
* @param property
* @return
**/
pluck(property: string): string[];
/**
* Get the position of the first element in the collection, relative to the offsetParent. This information is useful when absolutely positioning an element to appear aligned with another.
* Returns an object with properties: top, left.
* @return
**/
position(): ZeptoPosition;
/**
* Prepend content to the DOM inside each element in the collection. The content can be an HTML string, a DOM node or an array of nodes.
* @param content
* @return
**/
prepend(content: string): ZeptoCollection;
/**
* @see ZeptoCollection.prepend
* @param content
**/
prepend(content: HTMLElement): ZeptoCollection;
/**
* @see ZeptoCollection.prepend
* @param content
**/
prepend(content: HTMLElement[]): ZeptoCollection;
/**
* @see ZeptoCollection.prepend
* @param content
**/
prepend(content: ZeptoCollection): ZeptoCollection;
/**
* Prepend elements of the current collection inside each of the target elements. This is like prepend, only with reversed operands.
* @param content
* @return
**/
prependTo(content: string): ZeptoCollection;
/**
* @see ZeptoCollection.prependTo
* @param content
**/
prependTo(content: HTMLElement): ZeptoCollection;
/**
* @see ZeptoCollection.prependTo
* @param content
**/
prependTo(content: HTMLElement[]): ZeptoCollection;
/**
* @see ZeptoCollection.prependTo
* @param content
**/
prependTo(content: ZeptoCollection): ZeptoCollection;