Skip to content

Commit f61fdfd

Browse files
Merge pull request #11 from janpfeifer/fix_go1.14
Fix invalid comparison to js.Undefined() in go1.14.
2 parents f312d10 + 3eda0cf commit f61fdfd

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
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: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
package dom
22

3-
import js "github.com/gowebapi/webapi/core/js"
4-
53
// RequestFullscreenByBrowser is an alternative way to
6-
// request fullscreen that is taking different browser into
7-
// accound
4+
// request fullscreen that works for different browsers.
85
func (t *Element) RequestFullscreenByBrowser() {
96
elem := t.Value_JS
10-
if elem.Get("requestFullscreen") != js.Undefined() {
7+
if !elem.Get("requestFullscreen").IsUndefined() {
118
elem.Call("requestFullscreen", "")
12-
} else if elem.Get("mozRequestFullScreen") != js.Undefined() { /* Firefox */
9+
} else if !elem.Get("mozRequestFullScreen").IsUndefined() { /* Firefox */
1310
elem.Call("mozRequestFullScreen", "")
14-
} else if elem.Get("webkitRequestFullscreen") != js.Undefined() { /* Chrome, Safari and Opera */
11+
} else if !elem.Get("webkitRequestFullscreen").IsUndefined() { /* Chrome, Safari and Opera */
1512
elem.Call("webkitRequestFullscreen", "")
16-
} else if elem.Get("msRequestFullscreen") != js.Undefined() { /* IE/Edge */
13+
} else if !elem.Get("msRequestFullscreen").IsUndefined() { /* IE/Edge */
1714
elem.Call("msRequestFullscreen", "")
1815
}
1916
}

0 commit comments

Comments
 (0)