fixed failing test case, so we can use the browser API from JVM code and at least have an empty document to play with
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package kotlin.browser
|
||||
|
||||
import org.w3c.dom.Document
|
||||
import js.native
|
||||
import org.w3c.dom.Document
|
||||
|
||||
private var _document: Document? = null
|
||||
|
||||
@@ -9,7 +9,13 @@ private var _document: Document? = null
|
||||
* Provides access to the current active browsers DOM for the currently visible page.
|
||||
*/
|
||||
native public var document: Document
|
||||
get() = _document!!
|
||||
set(value) {
|
||||
_document = value
|
||||
}
|
||||
get() {
|
||||
// Note this code is only executed on the JVM
|
||||
val answer = _document
|
||||
return if (answer == null) {
|
||||
kotlin.dom.createDocument()
|
||||
} else answer
|
||||
}
|
||||
set(value) {
|
||||
_document = value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user