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:
James Strachan
2012-07-03 20:14:13 +01:00
parent ffffe84fcb
commit 038f0af68f
@@ -1,7 +1,7 @@
package kotlin.browser package kotlin.browser
import org.w3c.dom.Document
import js.native import js.native
import org.w3c.dom.Document
private var _document: Document? = null 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. * Provides access to the current active browsers DOM for the currently visible page.
*/ */
native public var document: Document native public var document: Document
get() = _document!! get() {
set(value) { // Note this code is only executed on the JVM
_document = value val answer = _document
} return if (answer == null) {
kotlin.dom.createDocument()
} else answer
}
set(value) {
_document = value
}