diff --git a/js/js.libraries/src/dom/html/htmlcore.kt b/js/js.libraries/src/core/htmlDom.kt
similarity index 99%
rename from js/js.libraries/src/dom/html/htmlcore.kt
rename to js/js.libraries/src/core/htmlDom.kt
index 56491cd4035..8c9c7166d79 100644
--- a/js/js.libraries/src/dom/html/htmlcore.kt
+++ b/js/js.libraries/src/core/htmlDom.kt
@@ -1,15 +1,17 @@
package js.dom.html
-import js.native
-import js.noImpl
-import js.dom.core.*
+import org.w3c.dom.*
+
+native
+public val window: Window = noImpl
+
+native
+public var document: HTMLDocument = noImpl
public native trait Object {
-
}
public native trait Image : HTMLImageElement {
-
}
public native trait Navigator {
@@ -82,16 +84,11 @@ public native trait Selection {
}
-public native trait document {
- public native var styleSheets: Array = js.noImpl
-}
-
public native trait CSSRule {
public native var selectorText: String = js.noImpl
}
public native trait Stylesheet {
-
}
public native trait History {
diff --git a/js/js.libraries/src/dom/domcore.kt b/js/js.libraries/src/dom/domcore.kt
deleted file mode 100644
index b86b44b2404..00000000000
--- a/js/js.libraries/src/dom/domcore.kt
+++ /dev/null
@@ -1,260 +0,0 @@
-package js.dom.core
-
-import js.native
-import js.noImpl
-
-public native trait DOMImplementationRegistry {
- public native fun getDOMImplementation(features: String): Unit = js.noImpl
- public native fun getDOMImplementationList(features: String): Unit = js.noImpl
-}
-
-public native trait DOMException {
- public native var code: Double = js.noImpl
-}
-
-public native trait DOMStringList {
- public native val length: Double = js.noImpl
- public native fun item(index: Number): String = js.noImpl
- public native fun contains(str: String): Boolean = js.noImpl
-}
-
-public native trait NameList {
- public native val length: Double = js.noImpl
- public native fun getName(index: Number): String = js.noImpl
- public native fun getNamespaceURI(index: Number): String = js.noImpl
- public native fun contains(str: String): Boolean = js.noImpl
- public native fun containsNS(namespaceURI: String, name: String): Boolean = js.noImpl
-}
-
-public native trait DOMImplementationList {
- public native val length: Double = js.noImpl
- public native fun item(index: Number): DOMImplementation? = js.noImpl
-}
-
-public native trait DOMImplementationSource {
- public native fun getDOMImplementation(features: String): DOMImplementation? = js.noImpl
- public native fun getDOMImplementationList(features: String): DOMImplementationList? = js.noImpl
-}
-
-public native trait DOMImplementation {
- public native fun hasFeature(feature: String, version: String): Boolean = js.noImpl
- public native fun createDocumentType(qualifiedName: String, publicId: String, systemId: String): DocumentType? = js.noImpl
- public native fun createDocument(namespaceURI: String, qualifiedName: String, doctype: DocumentType): Document? = js.noImpl
- public native fun getFeature(feature: String, version: String): Any? = js.noImpl
-}
-
-public native trait DocumentFragment : Node {
-
-}
-
-public native trait Document : Node {
- public native val doctype: DocumentType = js.noImpl
- public native val implementation: DOMImplementation = js.noImpl
- public native val documentElement: Element = js.noImpl
- public native val inputEncoding: String = js.noImpl
- public native val xmlEncoding: String = js.noImpl
- public native var xmlStandalone: Boolean = js.noImpl
- public native var xmlVersion: String = js.noImpl
- public native var strictErrorChecking: Boolean = js.noImpl
- public native var documentURI: String = js.noImpl
- public native val domConfig: DOMConfiguration = js.noImpl
- public native fun createElement(tagName: String): Element? = js.noImpl
- public native fun createDocumentFragment(): DocumentFragment? = js.noImpl
- public native fun createTextNode(data: String): Text? = js.noImpl
- public native fun createComment(data: String): Comment? = js.noImpl
- public native fun createCDATASection(data: String): CDATASection? = js.noImpl
- public native fun createProcessingInstruction(target: String, data: String): ProcessingInstruction? = js.noImpl
- public native fun createAttribute(name: String): Attr? = js.noImpl
- public native fun createEntityReference(name: String): EntityReference? = js.noImpl
- public native fun getElementsByTagName(tagname: String): NodeList = js.noImpl
- public native fun importNode(importedNode: Node, deep: Boolean): Node? = js.noImpl
- public native fun createElementNS(namespaceURI: String, qualifiedName: String): Element? = js.noImpl
- public native fun createAttributeNS(namespaceURI: String, qualifiedName: String): Attr? = js.noImpl
- public native fun getElementsByTagNameNS(namespaceURI: String, localName: String): NodeList = js.noImpl
- public native fun getElementById(elementId: String): Element? = js.noImpl
- public native fun adoptNode(source: Node): Node? = js.noImpl
- public native fun normalizeDocument(): Unit = js.noImpl
- public native fun renameNode(n: Node, namespaceURI: String, qualifiedName: String): Node? = js.noImpl
-}
-
-public native trait Node {
- public native val nodeName: String = js.noImpl
- public native var nodeValue: String = js.noImpl
- public native val nodeType: Double = js.noImpl
- public native val parentNode: Node = js.noImpl
- public native val childNodes: NodeList = js.noImpl
- public native val firstChild: Node = js.noImpl
- public native val lastChild: Node = js.noImpl
- public native val previousSibling: Node = js.noImpl
- public native val nextSibling: Node = js.noImpl
- public native val attributes: NamedNodeMap = js.noImpl
- public native val ownerDocument: Document = js.noImpl
- public native val namespaceURI: String = js.noImpl
- public native var prefix: String = js.noImpl
- public native val localName: String = js.noImpl
- public native val baseURI: String = js.noImpl
- public native var textContent: String = js.noImpl
- public native fun insertBefore(newChild: Node, refChild: Node): Node? = js.noImpl
- public native fun replaceChild(newChild: Node, refChild: Node): Node? = js.noImpl
- public native fun removeChild(oldChild: Node): Node? = js.noImpl
- public native fun appendChild(newChild: Node): Node? = js.noImpl
- public native fun hasChildNodes(): Boolean = js.noImpl
- public native fun cloneNode(deep: Node): Node? = js.noImpl
- public native fun normalize(): Unit = js.noImpl
- public native fun isSupported(feature: String, version: String): Boolean = js.noImpl
- public native fun hasAttributes(): Boolean = js.noImpl
- public native fun compareDocumentPosition(other: Node): Node? = js.noImpl
- public native fun isSameNode(other: Node): Boolean = js.noImpl
- public native fun lookupPrefix(namespaceURI: String): String = js.noImpl
- public native fun isDefaultNamespace(namespaceURI: String): String = js.noImpl
- public native fun lookupNamespaceURI(prefix: String): String = js.noImpl
- public native fun isEqualNode(arg: Node): Boolean = js.noImpl
- public native fun getFeature(feature: String, version: String): Any? = js.noImpl
- public native fun setUserData(key: String, data: Any, handler: UserDataHandler): Unit = js.noImpl
- public native fun getUserData(key: String): Unit = js.noImpl
-}
-
-public native trait NodeList {
- public native val length: Double = js.noImpl
- public native fun item(index: Number): Node? = js.noImpl
-}
-
-public native trait NamedNodeMap {
- public native val length: Double = js.noImpl
- public native fun getNamedItem(name: String): Node? = js.noImpl
- public native fun setNamedItem(arg: Node): Node? = js.noImpl
- public native fun removeNamedItem(name: String): Node? = js.noImpl
- public native fun item(index: Number): Node? = js.noImpl
- public native fun getNamedItemNS(namespaceURI: String, localName: String): Node? = js.noImpl
- public native fun setNamedItemNS(arg: Node): Node? = js.noImpl
- public native fun removeNamedItemNS(namespaceURI: String, localName: String): Node? = js.noImpl
-}
-
-public native trait CharacterData : Node {
- public native var data: String = js.noImpl
- public native val length: Double = js.noImpl
- public native fun substringData(offset: Number, count: Number): String = js.noImpl
- public native fun appendData(arg: String): Unit = js.noImpl
- public native fun insertData(offset: Number, arg: String): Unit = js.noImpl
- public native fun deleteData(offset: Number, count: Number): Unit = js.noImpl
- public native fun replaceData(offset: Number, count: Number, arg: String): Unit = js.noImpl
-}
-
-public native trait Attr : Node {
- public native val name: String = js.noImpl
- public native val specified: Boolean = js.noImpl
- public native val value: String = js.noImpl
- public native val ownerElement: Element = js.noImpl
- public native val schemaTypeInfo: TypeInfo = js.noImpl
- public native val isId: Boolean = js.noImpl
-}
-
-public native trait Element : Node {
- public native val tagName: String = js.noImpl
- public native val schemaTypeInfo: TypeInfo = js.noImpl
- public native fun getAttribute(name: String): String = js.noImpl
- public native fun setAttribute(name: String, value: String): Unit = js.noImpl
- public native fun removeAttribute(name: String): Unit = js.noImpl
- public native fun getAttributeNode(name: String): Attr? = js.noImpl
- public native fun setAttributeNode(newAttr: Attr): Attr? = js.noImpl
- public native fun removeAttributeNode(oldAttr: Attr): Attr? = js.noImpl
- public native fun getElementsByTagName(name: String): NodeList = js.noImpl
- public native fun getAttributeNS(namespaceURI: String, localName: String): String = js.noImpl
- public native fun setAttributeNS(namespaceURI: String, qualifiedName: String, value: String): Unit = js.noImpl
- public native fun removeAttributeNS(namespaceURI: String, localName: String): Unit = js.noImpl
- public native fun getAttributeNodeNS(namespaceURI: String, localName: String): Unit = js.noImpl
- public native fun setAttributeNodeNS(newAttr: Attr): Unit = js.noImpl
- public native fun getElementsByTagNameNS(namespaceURI: String, localName: String): NodeList = js.noImpl
- public native fun hasAttribute(name: String): Boolean = js.noImpl
- public native fun hasAttributeNS(namespaceURI: String, localName: String): Boolean = js.noImpl
- public native fun setIdAttribute(name: String, isId: Boolean): Unit = js.noImpl
- public native fun setIdAttributeNS(namespaceURI: String, localName: String, isId: Boolean): Unit = js.noImpl
- public native fun setIdAttributeNode(idAttr: Attr, isId: Boolean): Unit = js.noImpl
-}
-
-public native trait Text : CharacterData {
- public native val isElementContentWhitespace: Boolean = js.noImpl
- public native val wholeText: String = js.noImpl
- public native fun splitText(offset: Number): Text? = js.noImpl
- public native fun replaceWholeText(content: String): Text? = js.noImpl
-}
-
-public native trait Comment : CharacterData {
-
-}
-
-public native trait TypeInfo {
- public native val typeName: String = js.noImpl
- public native val typeNamespace: String = js.noImpl
- public native fun isDerivedFrom(typeNamespaceArg: String, typeNameArg: String, derivationMethod: Number): Boolean = js.noImpl
-}
-
-public native trait UserDataHandler {
- public native fun handle(param1: Number, param2: String, param3: Any, param4: Node, param5: Node): Unit = js.noImpl
-}
-
-public native trait DOMError {
- public native var severity: Double = js.noImpl
- public native var message: String = js.noImpl
- public native var `type`: String = js.noImpl
- public native var relatedException: Any = js.noImpl
- public native var relatedData: Any = js.noImpl
- public native var location: DOMLocator = js.noImpl
-}
-
-public native trait DOMErrorHandler {
- public native fun handler(error: DOMError): Boolean = js.noImpl
-}
-
-public native trait DOMLocator {
- public native var lineNumber: Double = js.noImpl
- public native var columnNumber: Double = js.noImpl
- public native var byteOffset: Double = js.noImpl
- public native var utf16Offset: Double = js.noImpl
- public native var relatedNode: Node = js.noImpl
- public native var uri: String = js.noImpl
-}
-
-public native trait DOMConfiguration {
- public native var parameterNames: DOMStringList = js.noImpl
- public native fun setParameter(name: String, value: Any): Unit = js.noImpl
- public native fun getParameter(name: String): Unit = js.noImpl
- public native fun canSetParameter(name: String, value: Any): Boolean = js.noImpl
-}
-
-public native trait CDATASection : Text {
-
-}
-
-public native trait DocumentType : Node {
- public native val name: String = js.noImpl
- public native val entities: NamedNodeMap = js.noImpl
- public native val notations: NamedNodeMap = js.noImpl
- public native val publicId: String = js.noImpl
- public native val systemId: String = js.noImpl
- public native val internalSubset: String = js.noImpl
-}
-
-public native trait Notation : Node {
- public native val publicId: String = js.noImpl
- public native val systemId: String = js.noImpl
-}
-
-public native trait Entity : Node {
- public native val publicId: String = js.noImpl
- public native val systemId: String = js.noImpl
- public native val notationName: String = js.noImpl
- public native val inputEncoding: String = js.noImpl
- public native val xmlEncoding: String = js.noImpl
- public native val xmlVersion: String = js.noImpl
-}
-
-public native trait EntityReference : Node {
-
-}
-
-public native trait ProcessingInstruction : Node {
- public native val target: String = js.noImpl
- public native var data: String = js.noImpl
-}
-
diff --git a/js/js.libraries/src/dom/html/window.kt b/js/js.libraries/src/dom/html/window.kt
deleted file mode 100644
index 6b9f0c90b63..00000000000
--- a/js/js.libraries/src/dom/html/window.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-package js.dom.html
-
-import js.noImpl
-
-native
-public val window : Window = js.noImpl
\ No newline at end of file
diff --git a/js/js.libraries/src/dom/html5/canvas.kt b/js/js.libraries/src/html5/canvas.kt
similarity index 99%
rename from js/js.libraries/src/dom/html5/canvas.kt
rename to js/js.libraries/src/html5/canvas.kt
index 7a7b5f2eb9f..421f7b359ba 100644
--- a/js/js.libraries/src/dom/html5/canvas.kt
+++ b/js/js.libraries/src/html5/canvas.kt
@@ -3,7 +3,7 @@ package js.dom.html5
import js.native
import js.noImpl
import js.dom.html.HTMLElement
-import js.dom.core.Element
+import org.w3c.dom.Element
public native trait HTMLCanvasElement : HTMLElement {
public native var width: Double = js.noImpl
diff --git a/js/js.libraries/src/jquery/common.kt b/js/js.libraries/src/jquery/common.kt
index 1694a185181..4c3a13ca2e3 100644
--- a/js/js.libraries/src/jquery/common.kt
+++ b/js/js.libraries/src/jquery/common.kt
@@ -1,6 +1,6 @@
package js.jquery;
-import js.dom.core.Element
+import org.w3c.dom.Element
native
public public class JQuery() {
diff --git a/js/js.libraries/src/stdlib/browser.kt b/js/js.libraries/src/stdlib/browser.kt
index 872910a51b4..95ea9504c07 100644
--- a/js/js.libraries/src/stdlib/browser.kt
+++ b/js/js.libraries/src/stdlib/browser.kt
@@ -1,11 +1,9 @@
package kotlin.browser
-import js.native
-import js.library
import org.w3c.dom.Document
/**
* Provides access to the current active browsers DOM for the currently visible page.
*/
-native("document") public var document: Document = null!!
+native public var document: Document = noImpl
diff --git a/js/js.libraries/src/stdlib/domCode.kt b/js/js.libraries/src/stdlib/domCode.kt
index 325cd39a9ce..8d8bd316cab 100644
--- a/js/js.libraries/src/stdlib/domCode.kt
+++ b/js/js.libraries/src/stdlib/domCode.kt
@@ -4,11 +4,10 @@ import org.w3c.dom.Document
import org.w3c.dom.Node
public fun createDocument(): Document {
- return browser.document.implementation.createDocument(null, null, null)
+ return js.dom.html.document.implementation.createDocument(null, null, null)
}
-native public val Node.outerHTML: String
-get() = js.noImpl
+native public val Node.outerHTML: String = js.noImpl
/** Converts the node to an XML String */
public fun Node.toXmlString(): String = this.outerHTML
diff --git a/js/js.translator/src/org/jetbrains/k2js/config/Config.java b/js/js.translator/src/org/jetbrains/k2js/config/Config.java
index ab9e5bce389..a51cf6a48eb 100644
--- a/js/js.translator/src/org/jetbrains/k2js/config/Config.java
+++ b/js/js.translator/src/org/jetbrains/k2js/config/Config.java
@@ -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",
diff --git a/js/js.translator/testFiles/stdlib/cases/browserDocumentAccess.kt b/js/js.translator/testFiles/stdlib/cases/browserDocumentAccess.kt
index 2fb5dea4368..0aefd318baf 100644
--- a/js/js.translator/testFiles/stdlib/cases/browserDocumentAccess.kt
+++ b/js/js.translator/testFiles/stdlib/cases/browserDocumentAccess.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
-}
+}
\ No newline at end of file