fixed up the JS generation of the Dom stdlib code
This commit is contained in:
@@ -11,8 +11,8 @@ import java.lang.IndexOutOfBoundsException
|
|||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
|
|
||||||
private val EmptyElementList: List<Element> = Collections.emptyList<Element>()!!
|
private fun emptyElementList(): List<Element> = Collections.emptyList<Element>()!!
|
||||||
private val EmptyNodeList: List<Node> = Collections.emptyList<Node>()!!
|
private fun emptyNodeList(): List<Node> = Collections.emptyList<Node>()!!
|
||||||
|
|
||||||
var Node.text : String
|
var Node.text : String
|
||||||
get() {
|
get() {
|
||||||
@@ -123,7 +123,7 @@ inline fun Document?.elements(namespaceUri: String, localName: String): List<Ele
|
|||||||
inline fun NodeList?.toList(): List<Node> {
|
inline fun NodeList?.toList(): List<Node> {
|
||||||
return if (this == null) {
|
return if (this == null) {
|
||||||
// TODO the following is easier to convert to JS
|
// TODO the following is easier to convert to JS
|
||||||
EmptyNodeList
|
emptyNodeList()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
NodeListAsList(this)
|
NodeListAsList(this)
|
||||||
@@ -133,7 +133,7 @@ inline fun NodeList?.toList(): List<Node> {
|
|||||||
inline fun NodeList?.toElementList(): List<Element> {
|
inline fun NodeList?.toElementList(): List<Element> {
|
||||||
return if (this == null) {
|
return if (this == null) {
|
||||||
// TODO the following is easier to convert to JS
|
// TODO the following is easier to convert to JS
|
||||||
//EmptyElementList
|
//emptyElementList()
|
||||||
ArrayList<Element>()
|
ArrayList<Element>()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -155,13 +155,13 @@ fun Document?.get(selector: String): List<Element> {
|
|||||||
return if (element != null)
|
return if (element != null)
|
||||||
arrayList<Element>(element)
|
arrayList<Element>(element)
|
||||||
else
|
else
|
||||||
EmptyElementList
|
emptyElementList()
|
||||||
} else {
|
} else {
|
||||||
// assume its a vanilla element name
|
// assume its a vanilla element name
|
||||||
elements(selector)
|
elements(selector)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
EmptyElementList
|
emptyElementList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ fun Element.get(selector: String): List<Element> {
|
|||||||
return if (element != null)
|
return if (element != null)
|
||||||
arrayList<Element>(element)
|
arrayList<Element>(element)
|
||||||
else
|
else
|
||||||
EmptyElementList
|
emptyElementList()
|
||||||
} else {
|
} else {
|
||||||
// assume its a vanilla element name
|
// assume its a vanilla element name
|
||||||
elements(selector)
|
elements(selector)
|
||||||
|
|||||||
@@ -43,13 +43,12 @@
|
|||||||
<include name="**/*.kt"/>
|
<include name="**/*.kt"/>
|
||||||
<exclude name="**/*JVM.kt"/>
|
<exclude name="**/*JVM.kt"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
<!--
|
|
||||||
<fileset dir="${basedir}/../../stdlib/test/dom">
|
<fileset dir="${basedir}/../../stdlib/test/dom">
|
||||||
<include name="**/*.kt"/>
|
<include name="**/*.kt"/>
|
||||||
<exclude name="**/DomBuilderTest.kt"/>
|
<exclude name="**/DomBuilderTest.kt"/>
|
||||||
|
<exclude name="**/NextSiblingTest.kt"/>
|
||||||
<exclude name="**/*JVM.kt"/>
|
<exclude name="**/*JVM.kt"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
-->
|
|
||||||
<fileset dir="${basedir}/../../stdlib/test">
|
<fileset dir="${basedir}/../../stdlib/test">
|
||||||
<include name="StringTest.kt"/>
|
<include name="StringTest.kt"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
|
|||||||
Reference in New Issue
Block a user