Closed inliquid closed 4 years ago
Thanks for reporting.
This is due to syscall/js
API changes in Go 1.14 (documented here). In order to fix this issue and preserve compatibility with 1.13, we must use build constraints. Either by making a copy of the entire dom.go file, or by creating relevant helpers.
/cc @neelance @cherrymui FYI, the Go 1.14 change to require use of Equal
method to compare js.Value
values has a noticeable effect on on large switches. E.g.:
switch c := o.Get("constructor"); c {
case js.Global().Get("AnimationEvent"):
return &AnimationEvent{ev}
case js.Global().Get("AudioProcessingEvent"):
return &AudioProcessingEvent{ev}
case js.Global().Get("BeforeInputEvent"):
return &BeforeInputEvent{ev}
case js.Global().Get("BeforeUnloadEvent"):
return &BeforeUnloadEvent{ev}
case js.Global().Get("BlobEvent"):
return &BlobEvent{ev}
case js.Global().Get("ClipboardEvent"):
return &ClipboardEvent{ev}
case js.Global().Get("CloseEvent"):
return &CloseEvent{BasicEvent: ev}
case js.Global().Get("CompositionEvent"):
return &CompositionEvent{ev}
case js.Global().Get("CSSFontFaceLoadEvent"):
return &CSSFontFaceLoadEvent{ev}
case js.Global().Get("CustomEvent"):
return &CustomEvent{ev}
...
Needs to be rewritten into something like:
switch c := o.Get("constructor"); {
case c.Equal(js.Global().Get("AnimationEvent"):
return &AnimationEvent{ev}
case c.Equal(js.Global().Get("AudioProcessingEvent")):
return &AudioProcessingEvent{ev}
case c.Equal(js.Global().Get("BeforeInputEvent")):
return &BeforeInputEvent{ev}
case c.Equal(js.Global().Get("BeforeUnloadEvent")):
return &BeforeUnloadEvent{ev}
case c.Equal(js.Global().Get("BlobEvent")):
return &BlobEvent{ev}
case c.Equal(js.Global().Get("ClipboardEvent")):
return &ClipboardEvent{ev}
case c.Equal(js.Global().Get("CloseEvent")):
return &CloseEvent{BasicEvent: ev}
case c.Equal(js.Global().Get("CompositionEvent")):
return &CompositionEvent{ev}
case c.Equal(js.Global().Get("CSSFontFaceLoadEvent")):
return &CSSFontFaceLoadEvent{ev}
case c.Equal(js.Global().Get("CustomEvent")):
return &CustomEvent{ev}
...
Just sharing this observation.
When building a
v2
-based program with go1.14: