JS kotlin.dom: deprecate asElementList harder.
Minor: correct exception message.
This commit is contained in:
@@ -70,7 +70,7 @@ fun Document?.elements(namespaceUri: String, localName: String): List<Element> {
|
||||
*
|
||||
* If you want to get a snapshot filtered to contain elements only it's better to use [filterElements] function.
|
||||
*/
|
||||
@Deprecated("This API is going to be removed", level = DeprecationLevel.WARNING)
|
||||
@Deprecated("This API is going to be removed, use asList() as a close replacement instead.", ReplaceWith("asList() as List<Element>", "org.w3c.dom.asList"), level = DeprecationLevel.ERROR)
|
||||
public fun NodeList.asElementList(): List<Element> = ElementListAsList(this)
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,6 +29,6 @@ public fun <T> ItemArrayLike<T>.asList(): List<T> = object : AbstractList<T>() {
|
||||
|
||||
override fun get(index: Int): T = when {
|
||||
index in 0..lastIndex -> this@asList.item(index) as T
|
||||
else -> throw IndexOutOfBoundsException("index $index is not in range [0..$lastIndex)")
|
||||
else -> throw IndexOutOfBoundsException("index $index is not in range [0..$lastIndex]")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user