JS backend: use generated code(org.w3c.*) for browser API.
#KT-2983 in progress (cherry picked from commit 8b839a9)
This commit is contained in:
@@ -70,10 +70,8 @@ public abstract class Config {
|
||||
"/core/kotlin.kt",
|
||||
"/core/math.kt",
|
||||
"/core/string.kt",
|
||||
"/dom/domcore.kt",
|
||||
"/dom/html/htmlcore.kt",
|
||||
"/dom/html5/canvas.kt",
|
||||
"/dom/html/window.kt",
|
||||
"/core/htmlDom.kt",
|
||||
"/html5/canvas.kt",
|
||||
"/jquery/common.kt",
|
||||
"/jquery/ui.kt",
|
||||
"/junit/core.kt",
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package test.browser
|
||||
|
||||
import kotlin.browser.document
|
||||
import js.dom.html.document
|
||||
import org.w3c.dom.Node
|
||||
|
||||
fun foo(): String {
|
||||
val element = document.getElementById("foo")
|
||||
if (element != null) {
|
||||
val textNode = document.createTextNode("Some Dynamically Created Content!!!")
|
||||
element.appendChild(textNode)
|
||||
if (textNode.nodeType != Node.TEXT_NODE) return "The type of the node is ${textNode.nodeType}, ${Node.TEXT_NODE} was expected"
|
||||
}
|
||||
val element = document.getElementById("foo")!!
|
||||
val textNode = document.createTextNode("Some Dynamically Created Content!!!")
|
||||
element.appendChild(textNode)
|
||||
if (textNode.nodeType != Node.TEXT_NODE) return "The type of the node is ${textNode.nodeType}, ${Node.TEXT_NODE} was expected"
|
||||
if (element.nodeType != Node.ELEMENT_NODE) return "The type of the node is ${element.nodeType}, ${Node.ELEMENT_NODE} was expected"
|
||||
return element.textContent
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user