@@ -96,11 +96,11 @@ trait JQuery extends js.Object {
96
96
97
97
/** For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. <br/>
98
98
* See: <a href="http://api.jquery.com/closest/">jQuery Docs</a> */
99
- def closest (selector : String | Element | JQuery ): JQuery = js.native
99
+ def closest (selector : Selector | Element | JQuery ): JQuery = js.native
100
100
101
101
/** For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. <br/>
102
102
* See: <a href="http://api.jquery.com/closest/">jQuery Docs</a> */
103
- def closest (selector : String , context : Element ): JQuery = js.native
103
+ def closest (selector : Selector , context : Element ): JQuery = js.native
104
104
105
105
/** Get the children of each element in the set of matched elements, including text and comment nodes. <br/>
106
106
* See: <a href="http://api.jquery.com/contents/">jQuery Docs</a> */
@@ -194,7 +194,7 @@ trait JQuery extends js.Object {
194
194
195
195
/** Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. <br/>
196
196
* See: <a href="http://api.jquery.com/find/">jQuery Docs</a> */
197
- def find (selector : String | Element | JQuery ): JQuery = js.native
197
+ def find (selector : Selector | Element | JQuery ): JQuery = js.native
198
198
199
199
/** Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements. <br/>
200
200
* See: <a href="http://api.jquery.com/finish/">jQuery Docs</a> */
@@ -223,7 +223,7 @@ trait JQuery extends js.Object {
223
223
224
224
/** Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. <br/>
225
225
* See: <a href="http://api.jquery.com/has/">jQuery Docs</a> */
226
- def has (selector : String | Element ): JQuery = js.native
226
+ def has (selector : Selector | Element ): JQuery = js.native
227
227
228
228
/** Determine whether any of the matched elements are assigned the given class. <br/>
229
229
* See: <a href="http://api.jquery.com/hasClass/">jQuery Docs</a> */
@@ -275,15 +275,15 @@ trait JQuery extends js.Object {
275
275
276
276
/** Insert every element in the set of matched elements after the target. <br/>
277
277
* See: <a href="http://api.jquery.com/insertAfter/">jQuery Docs</a> */
278
- def insertAfter (selector : String | Element | JQuery ): JQuery = js.native
278
+ def insertAfter (selector : Selector | Element | JQuery ): JQuery = js.native
279
279
280
280
/** Insert every element in the set of matched elements before the target. <br/>
281
281
* See: <a href="http://api.jquery.com/insertBefore/">jQuery Docs</a> */
282
- def insertBefore (selector : String | Element | JQuery ): JQuery = js.native
282
+ def insertBefore (selector : Selector | Element | JQuery ): JQuery = js.native
283
283
284
284
/** Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. <br/>
285
285
* See: <a href="http://api.jquery.com/is/">jQuery Docs</a> */
286
- def is (selector : String | Element | JQuery ): Boolean = js.native
286
+ def is (selector : Selector | Element | JQuery ): Boolean = js.native
287
287
288
288
/** A string containing the jQuery version number. <br/>
289
289
* See: <a href="http://api.jquery.com/jquery/">jQuery Docs</a> */
@@ -375,7 +375,7 @@ trait JQuery extends js.Object {
375
375
376
376
/** Remove elements from the set of matched elements. <br/>
377
377
* See: <a href="http://api.jquery.com/not/">jQuery Docs</a> */
378
- def not (selector : String | JQuery ): JQuery = js.native
378
+ def not (selector : Selector | JQuery ): JQuery = js.native
379
379
380
380
/** Remove elements from the set of matched elements. <br/>
381
381
* See: <a href="http://api.jquery.com/not/">jQuery Docs</a> */
@@ -391,7 +391,7 @@ trait JQuery extends js.Object {
391
391
392
392
/** Remove an event handler. <br/>
393
393
* See: <a href="http://api.jquery.com/off/">jQuery Docs</a> */
394
- def off (jEvent : JQueryEvent , selector : String = js.native): JQuery = js.native
394
+ def off (jEvent : JQueryEvent , selector : Selector = js.native): JQuery = js.native
395
395
396
396
/** Get the closest ancestor element that is positioned. <br/>
397
397
* See: <a href="http://api.jquery.com/offsetParent/">jQuery Docs</a> */
@@ -530,7 +530,7 @@ trait JQuery extends js.Object {
530
530
531
531
/** Get the siblings of each element in the set of matched elements, optionally filtered by a selector. <br/>
532
532
* See: <a href="http://api.jquery.com/siblings/">jQuery Docs</a> */
533
- def siblings (selector : String = js.native): JQuery = js.native
533
+ def siblings (selector : Selector = js.native): JQuery = js.native
534
534
535
535
/** Reduce the set of matched elements to a subset specified by a range of indices. Including `start`, without `end`. <br/>
536
536
* See: <a href="http://api.jquery.com/slice/">jQuery Docs</a> */
@@ -583,11 +583,11 @@ trait JQuery extends js.Object {
583
583
584
584
/** Execute all handlers and behaviors attached to the matched elements for the given event type. <br/>
585
585
* See: <a href="http://api.jquery.com/trigger/">jQuery Docs</a> */
586
- def trigger (event : String | JQueryEvent ): JQuery = js.native
586
+ def trigger (event : EventName | JQueryEvent ): JQuery = js.native
587
587
588
588
/** Execute all handlers attached to an element for an event. <br/>
589
589
* See: <a href="http://api.jquery.com/triggerHandler/">jQuery Docs</a> */
590
- def triggerHandler (event : String | JQueryEvent ): JQuery = js.native
590
+ def triggerHandler (event : EventName | JQueryEvent ): JQuery = js.native
591
591
592
592
/** Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. <br/>
593
593
* See: <a href="http://api.jquery.com/unwrap/">jQuery Docs</a> */
@@ -629,15 +629,15 @@ object JQuery {
629
629
def unregister (): Unit
630
630
}
631
631
632
- case class CallbackParameters (once : Boolean , selector : String , data : js.Any )
633
- case class CallbackRegistrationRef (event : String , callback : JQueryCallback , registration : CallbackRegistration )
632
+ case class CallbackParameters (once : Boolean , selector : Selector , data : js.Any )
633
+ case class CallbackRegistrationRef (event : EventName , callback : JQueryCallback , registration : CallbackRegistration )
634
634
635
635
private val registrations : mutable.Map [Element , mutable.Buffer [CallbackRegistrationRef ]] = mutable.Map [Element , mutable.Buffer [CallbackRegistrationRef ]]()
636
636
637
637
implicit class JQueryWrapper (private val jquery : JQuery ) {
638
638
import js .JSConverters ._
639
639
640
- class OnCallbackRegistration (event : String , callback : JQueryCallback ,
640
+ class OnCallbackRegistration (event : EventName , callback : JQueryCallback ,
641
641
reg : (ThisFunction1 [Element , JQueryEvent , Any ]) => Any ,
642
642
unreg : (String , ThisFunction1 [Element , JQueryEvent , Any ]) => js.Any = (event, c) => jquery.asInstanceOf [js.Dynamic ].off(event, c))
643
643
extends CallbackRegistration {
@@ -1038,63 +1038,63 @@ object JQuery {
1038
1038
1039
1039
/** Attach an event handler function for one or more events to the selected elements. <br/>
1040
1040
* See: <a href="http://api.jquery.com/on/">jQuery Docs</a> */
1041
- def on (event : String , callback : JQueryCallback ): JQuery = {
1041
+ def on (event : EventName , callback : JQueryCallback ): JQuery = {
1042
1042
separateCallbacks(event, callback, new CallbackParameters (false , null , null ))
1043
1043
jquery
1044
1044
}
1045
1045
1046
1046
/** Attach an event handler function for one or more events to the selected elements. <br/>
1047
1047
* See: <a href="http://api.jquery.com/on/">jQuery Docs</a> */
1048
- def on (event : String , data : js.Any , callback : JQueryCallback ): JQuery = {
1048
+ def on (event : EventName , data : js.Any , callback : JQueryCallback ): JQuery = {
1049
1049
separateCallbacks(event, callback, new CallbackParameters (false , null , data))
1050
1050
jquery
1051
1051
}
1052
1052
1053
1053
/** Attach an event handler function for one or more events to the selected elements. <br/>
1054
1054
* See: <a href="http://api.jquery.com/on/">jQuery Docs</a> */
1055
- def on (event : String , selector : String , callback : JQueryCallback ): JQuery = {
1055
+ def on (event : EventName , selector : Selector , callback : JQueryCallback ): JQuery = {
1056
1056
separateCallbacks(event, callback, new CallbackParameters (false , selector, null ))
1057
1057
jquery
1058
1058
}
1059
1059
1060
1060
/** Attach an event handler function for one or more events to the selected elements. <br/>
1061
1061
* See: <a href="http://api.jquery.com/on/">jQuery Docs</a> */
1062
- def on (event : String , selector : String , data : js.Any , callback : JQueryCallback ): JQuery = {
1062
+ def on (event : EventName , selector : Selector , data : js.Any , callback : JQueryCallback ): JQuery = {
1063
1063
separateCallbacks(event, callback, new CallbackParameters (false , selector, data))
1064
1064
jquery
1065
1065
}
1066
1066
1067
1067
/** Attach a handler to an event for the elements. The handler is executed at most once per element per event type. <br/>
1068
1068
* See: <a href="http://api.jquery.com/one/">jQuery Docs</a> */
1069
- def one (event : String , callback : JQueryCallback ): JQuery = {
1069
+ def one (event : EventName , callback : JQueryCallback ): JQuery = {
1070
1070
separateCallbacks(event, callback, new CallbackParameters (true , null , null ))
1071
1071
jquery
1072
1072
}
1073
1073
1074
1074
/** Attach a handler to an event for the elements. The handler is executed at most once per element per event type. <br/>
1075
1075
* See: <a href="http://api.jquery.com/one/">jQuery Docs</a> */
1076
- def one (event : String , data : js.Any , callback : JQueryCallback ): JQuery = {
1076
+ def one (event : EventName , data : js.Any , callback : JQueryCallback ): JQuery = {
1077
1077
separateCallbacks(event, callback, new CallbackParameters (true , null , data))
1078
1078
jquery
1079
1079
}
1080
1080
1081
1081
/** Attach a handler to an event for the elements. The handler is executed at most once per element per event type. <br/>
1082
1082
* See: <a href="http://api.jquery.com/one/">jQuery Docs</a> */
1083
- def one (event : String , selector : String , callback : JQueryCallback ): JQuery = {
1083
+ def one (event : EventName , selector : Selector , callback : JQueryCallback ): JQuery = {
1084
1084
separateCallbacks(event, callback, new CallbackParameters (true , selector, null ))
1085
1085
jquery
1086
1086
}
1087
1087
1088
1088
/** Attach a handler to an event for the elements. The handler is executed at most once per element per event type. <br/>
1089
1089
* See: <a href="http://api.jquery.com/one/">jQuery Docs</a> */
1090
- def one (event : String , selector : String , data : js.Any , callback : JQueryCallback ): JQuery = {
1090
+ def one (event : EventName , selector : Selector , data : js.Any , callback : JQueryCallback ): JQuery = {
1091
1091
separateCallbacks(event, callback, new CallbackParameters (true , selector, data))
1092
1092
jquery
1093
1093
}
1094
1094
1095
1095
/** Remove an event handler. <br/>
1096
1096
* See: <a href="http://api.jquery.com/off/">jQuery Docs</a> */
1097
- def off (event : String , callback : JQueryCallback ): JQuery = {
1097
+ def off (event : EventName , callback : JQueryCallback ): JQuery = {
1098
1098
jquery.asInstanceOf [js.Dynamic ].toArray().asInstanceOf [js.Array [Element ]]
1099
1099
.foreach( el => {
1100
1100
if (registrations.contains(el)) {
@@ -1114,7 +1114,7 @@ object JQuery {
1114
1114
jquery
1115
1115
}
1116
1116
1117
- private def separateCallbacks (event : String , callback : JQueryCallback , params : CallbackParameters ): Unit = {
1117
+ private def separateCallbacks (event : EventName , callback : JQueryCallback , params : CallbackParameters ): Unit = {
1118
1118
1119
1119
type ThisFunctionCallback = ThisFunction1 [Element , JQueryEvent , Any ]
1120
1120
@@ -1136,7 +1136,7 @@ object JQuery {
1136
1136
}))
1137
1137
}
1138
1138
1139
- private def collectRegistration (event : String , callback : JQueryCallback , el : Element , index : Int , params : CallbackParameters , reg : CallbackRegistration ) = {
1139
+ private def collectRegistration (event : EventName , callback : JQueryCallback , el : Element , index : Int , params : CallbackParameters , reg : CallbackRegistration ) = {
1140
1140
val jqueryRegs : mutable.Buffer [CallbackRegistrationRef ] = registrations.getOrElse(el, mutable.Buffer [CallbackRegistrationRef ]())
1141
1141
jqueryRegs += CallbackRegistrationRef (event, callback, reg)
1142
1142
registrations.update(el, jqueryRegs)
@@ -1322,22 +1322,22 @@ object JQuery {
1322
1322
1323
1323
/** Execute all handlers and behaviors attached to the matched elements for the given event type. <br/>
1324
1324
* See: <a href="http://api.jquery.com/trigger/">jQuery Docs</a> */
1325
- def trigger (event : String | JQueryEvent , extraParams : Map [String , Any ]): JQuery =
1325
+ def trigger (event : EventName | JQueryEvent , extraParams : Map [String , Any ]): JQuery =
1326
1326
jquery.asInstanceOf [js.Dynamic ].trigger(event.asInstanceOf [js.Dynamic ], extraParams.toJSDictionary).asInstanceOf [JQuery ]
1327
1327
1328
1328
/** Execute all handlers and behaviors attached to the matched elements for the given event type. <br/>
1329
1329
* See: <a href="http://api.jquery.com/trigger/">jQuery Docs</a> */
1330
- def trigger (event : String | JQueryEvent , extraParams : Seq [Any ]): JQuery =
1330
+ def trigger (event : EventName | JQueryEvent , extraParams : Seq [Any ]): JQuery =
1331
1331
jquery.asInstanceOf [js.Dynamic ].trigger(event.asInstanceOf [js.Dynamic ], extraParams.toJSArray).asInstanceOf [JQuery ]
1332
1332
1333
1333
/** Execute all handlers attached to an element for an event. <br/>
1334
1334
* See: <a href="http://api.jquery.com/triggerHandler/">jQuery Docs</a> */
1335
- def triggerHandler (event : String | JQueryEvent , extraParams : Map [String , Any ]): JQuery =
1335
+ def triggerHandler (event : EventName | JQueryEvent , extraParams : Map [String , Any ]): JQuery =
1336
1336
jquery.asInstanceOf [js.Dynamic ].triggerHandler(event.asInstanceOf [js.Dynamic ], extraParams.toJSDictionary).asInstanceOf [JQuery ]
1337
1337
1338
1338
/** Execute all handlers attached to an element for an event. <br/>
1339
1339
* See: <a href="http://api.jquery.com/triggerHandler/">jQuery Docs</a> */
1340
- def triggerHandler (event : String | JQueryEvent , extraParams : Seq [Any ]): JQuery =
1340
+ def triggerHandler (event : EventName | JQueryEvent , extraParams : Seq [Any ]): JQuery =
1341
1341
jquery.asInstanceOf [js.Dynamic ].triggerHandler(event.asInstanceOf [js.Dynamic ], extraParams.toJSArray).asInstanceOf [JQuery ]
1342
1342
1343
1343
/** Set the value of each element in the set of matched elements. <br/>
0 commit comments