Skip to content

Fix #219: Fix Event constructors. #367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 16, 2019
3 changes: 1 addition & 2 deletions src/main/scala/org/scalajs/dom/raw/lib.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4829,8 +4829,7 @@ trait MutationEventInit extends EventInit {
"WHATWG DOM")
@js.native
@JSGlobal
class MutationEvent(typeArg: String, init: js.UndefOr[MutationEventInit])
extends Event(typeArg, init) {
class MutationEvent extends Event("", js.undefined) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it has no constructor, its constructor should be marked private. Otherwise there is nothing preventing to do new MutationEvent from the Scala side (with a run-time error).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 879d4ae

Used private[this] instead of private(), thanks to deprecation warning declaring private constructors in native JS classes is deprecated, because they do not behave the same way as in Scala.js-defined JS classes. Use `private[this]` instead. This will become an error in 1.0.0.

def newValue: String = js.native

def attrChange: Int = js.native
Expand Down