Skip to content

Commit c18e27e

Browse files
committed
change Length to appropriate type, change interface{} in Each() to the
appropriate JQuery type
1 parent 0b9bed7 commit c18e27e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

jquery.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ type JQuery struct {
5353
o js.Object
5454
Jquery string `js:"jquery"`
5555
Selector string `js:"selector"` //deprecated according jquery docs
56-
Length string `js:"length"`
56+
Length int `js:"length"`
5757
Context string `js:"context"`
5858
}
5959

@@ -199,8 +199,10 @@ func Unique(arr js.Object) js.Object {
199199
}
200200

201201
//methods
202-
func (j JQuery) Each(fn func(int, interface{}) interface{}) JQuery {
203-
j.o = j.o.Call("each", fn)
202+
func (j JQuery) Each(fn func(int, JQuery)) JQuery {
203+
j.o = j.o.Call("each", func(idx int, elem js.Object) {
204+
fn(idx, NewJQuery(elem))
205+
})
204206
return j
205207
}
206208

0 commit comments

Comments
 (0)