Skip to content

Commit 009ef14

Browse files
committed
Fix invalid comparison to js.Undefined() in go1.14.
1 parent f312d10 commit 009ef14

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

core/js/js.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ func (v Value) Invoke(args ...interface{}) Value {
198198
panic(message)
199199
}
200200

201+
// IsUndefined reports whether v is the JavaScript value "undefined".
202+
func (v Value) IsUndefined() bool {
203+
panic(message)
204+
}
205+
201206
// JSValue implements Wrapper interface.
202207
func (v Value) JSValue() Value {
203208
panic(message)

dom/helper.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import js "github.com/gowebapi/webapi/core/js"
77
// accound
88
func (t *Element) RequestFullscreenByBrowser() {
99
elem := t.Value_JS
10-
if elem.Get("requestFullscreen") != js.Undefined() {
10+
if !elem.Get("requestFullscreen").IsUndefined() {
1111
elem.Call("requestFullscreen", "")
12-
} else if elem.Get("mozRequestFullScreen") != js.Undefined() { /* Firefox */
12+
} else if !elem.Get("mozRequestFullScreen").IsUndefined() { /* Firefox */
1313
elem.Call("mozRequestFullScreen", "")
14-
} else if elem.Get("webkitRequestFullscreen") != js.Undefined() { /* Chrome, Safari and Opera */
14+
} else if !elem.Get("webkitRequestFullscreen").IsUndefined() { /* Chrome, Safari and Opera */
1515
elem.Call("webkitRequestFullscreen", "")
16-
} else if elem.Get("msRequestFullscreen") != js.Undefined() { /* IE/Edge */
16+
} else if !elem.Get("msRequestFullscreen").IsUndefined() { /* IE/Edge */
1717
elem.Call("msRequestFullscreen", "")
1818
}
1919
}

0 commit comments

Comments
 (0)