https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
n

natpryce

02/27/2019, 8:26 AM
On the JVM platform, the org.w3c.dom API is defined as interfaces (e.g.
public interface Document extends Node
). On the JS platform it is defined as abstract classes (e.g.
public external open class Document : Node, ...
). This makes it impossible to write multiplatform code that uses DOM elements, and also impossible to write expect/actual declarations for DOM elements in common code. Is there a workaround or other API that can be used to work with XML in multiplatform projects?
i

ilya.gorbunov

02/27/2019, 10:24 PM
In the meantime you can declare expect abstract classes and suppress errors about expect/actual mismatch for interfaces. We're going to allow providing actual interface for an abstract expect class in the future: https://youtrack.jetbrains.com/issue/KT-28473
2 Views