@@ -3,7 +3,7 @@ package io.scalajs.jquery
3
3
import io .scalajs .JsNumber
4
4
import io .scalajs .dom .html .HTMLElement
5
5
import io .scalajs .dom .html .css .CSSSelector
6
- import io .scalajs .dom .{Element , Event , Node }
6
+ import io .scalajs .dom .{Element , Event , Node , Text }
7
7
8
8
import scala .scalajs .js
9
9
import scala .scalajs .js .annotation .JSBracketAccess
@@ -42,16 +42,27 @@ trait JQueryElement extends HTMLElement {
42
42
// Methods
43
43
// /////////////////////////////////////////////////////////////
44
44
45
+ /**
46
+ * Create a new jQuery object with elements added to the set of matched elements.
47
+ * @param selector could be any of the following:
48
+ * <ul>
49
+ * <li>selector: A string representing a selector expression to find additional elements to add to the set of matched elements.</li>
50
+ * <li>elements: One or more elements to add to the set of matched elements.</li>
51
+ * <li>html: An HTML fragment to add to the set of matched elements.</li>
52
+ * <li>selection: An existing jQuery object to add to the set of matched elements..</li>
53
+ * </ul>
54
+ */
55
+ def add (selector : Selector | CSSSelector | HTMLElement * ): this .type = js.native
56
+
45
57
/**
46
58
* The add() method adds elements to an existing group of elements.
47
- * @param element Required. Specifies a selector expression, a jQuery object, one or more elements
48
- * or an HTML snippet to be added to an existing group of elements
49
- * @param context Optional. Specifies the point in the document at which the selector expression
50
- * should begin matching
59
+ * @param selector Required. Specifies a selector expression, a jQuery object, one or more elements
60
+ * or an HTML snippet to be added to an existing group of elements
61
+ * @param context Optional. Specifies the point in the document at which the selector expression
62
+ * should begin matching
51
63
* @return self reference
52
64
*/
53
- def add (element : Element | Selector | CSSSelector | js.Any , context : Element | js.Any = js.native): this .type =
54
- js.native
65
+ def add (selector : HTMLElement | Selector | CSSSelector , context : HTMLElement ): this .type = js.native
55
66
56
67
/**
57
68
* Add the previous set of elements on the stack to the current set, optionally filtered by a selector.
@@ -78,9 +89,7 @@ trait JQueryElement extends HTMLElement {
78
89
* @param speed The optional speed parameter can take the following values: "slow", "fast", or milliseconds.
79
90
* @param callback The optional callback parameter is a function to be executed after toggle() completes.
80
91
*/
81
- def animate (params : AnimateOptions | js.Any ,
82
- speed : String | JsNumber = js.native,
83
- callback : js.Function ): this .type = js.native
92
+ def animate (params : AnimateOptions | js.Any , speed : String | JsNumber = js.native, callback : js.Function ): this .type = js.native
84
93
85
94
/**
86
95
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
@@ -144,8 +153,7 @@ trait JQueryElement extends HTMLElement {
144
153
* containing one or more events to attach to the elements, and
145
154
* functions to run when the event occurs
146
155
*/
147
- def bind (event : String , data : js.Any = js.native, function : js.Function , map : js.Any = js.native): this .type =
148
- js.native
156
+ def bind (event : String , data : js.Any = js.native, function : js.Function , map : js.Any = js.native): this .type = js.native
149
157
150
158
/**
151
159
* Attach a handler to an event for the elements.
@@ -194,7 +202,7 @@ trait JQueryElement extends HTMLElement {
194
202
* Bind an event handler to the "change" JavaScript event, or trigger that event on an element.
195
203
* @param callback A function to execute each time the event is triggered.
196
204
*/
197
- def change (callback : js.Function1 [Event , Any ] = js.native): this .type = js.native
205
+ def change [ A ] (callback : js.Function1 [Event , A ] = js.native): this .type = js.native
198
206
199
207
/**
200
208
* Get the children of each element in the set of matched elements, optionally filtered by a selector.
@@ -480,8 +488,7 @@ trait JQueryElement extends HTMLElement {
480
488
* @param selector A selector which should match the one originally passed to [[JQueryElement.on .on() ]] when attaching event handlers.
481
489
* @param handler A handler function previously attached for the event(s), or the special value false.
482
490
*/
483
- def off (events : String , selector : String = js.native, handler : js.Function1 [Event , Unit ] = js.native): this .type =
484
- js.native
491
+ def off (events : String , selector : String = js.native, handler : js.Function1 [Event , Unit ] = js.native): this .type = js.native
485
492
486
493
/**
487
494
* Get the current coordinates of the first element in the set of matched elements, relative to the document.
@@ -511,19 +518,15 @@ trait JQueryElement extends HTMLElement {
511
518
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand
512
519
* for a function that simply does return false.
513
520
*/
514
- def on (events : String ,
515
- selector : String = js.native,
516
- data : js.Any = js.native,
517
- handler : js.Function = js.native): this .type = js.native
521
+ def on (events : String , selector : String = js.native, data : js.Any = js.native, handler : js.Function = js.native): this .type = js.native
518
522
519
523
/**
520
524
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
521
525
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
522
526
* @param data Data to be passed to the handler in event.data when an event is triggered.
523
527
* @param handler A function to execute at the time the event is triggered.
524
528
*/
525
- def one (events : String , data : js.Any = js.native, handler : js.Function1 [Event , Unit ] = js.native): this .type =
526
- js.native
529
+ def one (events : String , data : js.Any = js.native, handler : js.Function1 [Event , Unit ] = js.native): this .type = js.native
527
530
528
531
def outerHeight (): Integer = js.native
529
532
@@ -568,7 +571,7 @@ trait JQueryElement extends HTMLElement {
568
571
* @param content One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to
569
572
* insert at the beginning of each element in the set of matched elements.
570
573
*/
571
- def prepend (content : js. Any , content1 : js.Any * ): this .type = js.native
574
+ def prepend (content : ( String | HTMLElement | Text | js.Array [ String | HTMLElement | Text ]) * ): this .type = js.native
572
575
573
576
/**
574
577
* Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
@@ -579,12 +582,6 @@ trait JQueryElement extends HTMLElement {
579
582
*/
580
583
def prepend (fn : js.Function ): this .type = js.native
581
584
582
- /**
583
- * Inserts content at the beginning of the selected elements
584
- * @param content the specified content
585
- */
586
- def prepend (content : js.Any ): this .type = js.native
587
-
588
585
/**
589
586
* Get the immediately preceding sibling of each element in the set of matched elements. If a selector is provided,
590
587
* it retrieves the previous sibling only if it matches that selector.
@@ -614,13 +611,7 @@ trait JQueryElement extends HTMLElement {
614
611
* @param propertyName The name of the property to get.
615
612
* @return the property value
616
613
*/
617
- def prop [T <: js.Any ](propertyName : String ): T = js.native
618
-
619
- /**
620
- * Get the value of a property for the first element in the set of matched elements.
621
- * @param name The name of the property to get.
622
- */
623
- def prop (name : String ): Boolean = js.native
614
+ def prop (propertyName : String ): String = js.native
624
615
625
616
/**
626
617
* Set one or more properties for the set of matched elements.
@@ -888,4 +879,4 @@ trait JQueryElement extends HTMLElement {
888
879
*/
889
880
def wrap (function : js.Function ): this .type = js.native
890
881
891
- }
882
+ }
0 commit comments