Skip to content

Commit b9efc2e

Browse files
committed
Drop ERROR deprecations in JS library that were introduced in 1.1-rc
(cherry picked from commit 6e8f227)
1 parent 9e0d317 commit b9efc2e

File tree

5 files changed

+0
-284
lines changed

5 files changed

+0
-284
lines changed

js/js.libraries/src/dom/Builder.kt

Lines changed: 0 additions & 31 deletions
This file was deleted.

js/js.libraries/src/dom/Dom.kt

Lines changed: 0 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -13,133 +13,11 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
@file:Suppress("DEPRECATION_ERROR")
1716
package kotlin.dom
1817

1918
import org.w3c.dom.*
2019
import kotlin.collections.*
2120

22-
// DEPRECATED in 1.1-RC, drop after 1.1
23-
24-
/** Returns the children of the element as a list */
25-
@Deprecated("Use childNodes() function with safe call", ReplaceWith("this?.childNodes()?.asList().orEmpty()", "org.w3c.dom.asList"), level = DeprecationLevel.ERROR)
26-
fun Element?.children(): List<Node> {
27-
return this?.childNodes?.asList() ?: emptyList()
28-
}
29-
30-
/** Returns the child elements of this element */
31-
@Deprecated("Use childNodes() function with safe call and filter it after", level = DeprecationLevel.ERROR)
32-
fun Element?.childElements(): List<Element> = this?.childNodes?.filterElements() ?: emptyList()
33-
34-
/** Returns the child elements of this element with the given name. */
35-
@Deprecated("Use childNodes() function with safe call and filter it after", level = DeprecationLevel.ERROR)
36-
fun Element?.childElements(name: String): List<Element> = this?.childNodes?.filterElements()?.filter { it.nodeName == name } ?: emptyList()
37-
38-
/** Returns all the descendant elements given the local element name. */
39-
@Deprecated("Use getElementsByTagName() instead", ReplaceWith("getElementsByTagName(localName).asList()", "org.w3c.dom.asList"), level = DeprecationLevel.ERROR)
40-
fun Element.elements(localName: String = "*"): List<Element> {
41-
return this.getElementsByTagName(localName).asList()
42-
}
43-
44-
/** Returns all the descendant elements given the local element name */
45-
@JsName("deprecated_document_elements")
46-
@Deprecated("Use getElementsByTagName() function with safe call", ReplaceWith("this?.getElementsByTagName(localName)?.asList().orEmpty()", "org.w3c.dom.asList"), level = DeprecationLevel.ERROR)
47-
fun Document?.elements(localName: String = "*"): List<Element> {
48-
return this?.elements(localName).orEmpty()
49-
}
50-
51-
/** Returns all the descendant elements given the namespace URI and local element name. */
52-
@Deprecated("Use getElementsByTagNameNS() function instead", ReplaceWith("this?.getElementsByTagNameNS(namespaceUri, localName)?.asList().orEmpty()", "org.w3c.dom.asList"), level = DeprecationLevel.ERROR)
53-
public fun Element.elements(namespaceUri: String, localName: String): List<Element> {
54-
return this.getElementsByTagNameNS(namespaceUri, localName).asList()
55-
}
56-
57-
/** Returns all the descendant elements given the namespace URI and local element name */
58-
@Deprecated("Use getElementsByTagNameNS() function with safe call", ReplaceWith("this?.getElementsByTagNameNS(namespaceUri, localName)?.asList().orEmpty()", "org.w3c.dom.asList"), level = DeprecationLevel.ERROR)
59-
fun Document?.elements(namespaceUri: String, localName: String): List<Element> {
60-
return this?.getElementsByTagNameNS(namespaceUri, localName)?.asList() ?: emptyList()
61-
}
62-
63-
// END OF DEPRECATED
64-
65-
/**
66-
* Returns a view of this [NodeList] as a list of elements assuming that it contains only elements.
67-
*
68-
* An attempt to get an element with [List.get] indexed accessor of the returned list
69-
* will result in [ClassCastException] being thrown if that node is not an element.
70-
*
71-
* If you want to get a snapshot filtered to contain elements only it's better to use [filterElements] function.
72-
*/
73-
@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)
74-
public fun NodeList.asElementList(): List<Element> = ElementListAsList(this)
75-
76-
/**
77-
* Returns a list containing only [Element] nodes.
78-
*/
79-
@Deprecated("Use filter function instead", ReplaceWith("filter { it.isElement } as List<Element>"), level = DeprecationLevel.ERROR)
80-
public fun List<Node>.filterElements(): List<Element> {
81-
@Suppress("UNCHECKED_CAST")
82-
return filter { it.isElement } as List<Element>
83-
}
84-
85-
/**
86-
* Returns a list containing only [Element] nodes.
87-
*/
88-
@Deprecated("Use filter function instead", ReplaceWith("asList().filter { it.isElement } as List<Element>", "org.w3c.dom.asList"), level = DeprecationLevel.ERROR)
89-
public fun NodeList.filterElements(): List<Element> = asList().filterElements()
90-
91-
92-
93-
private class ElementListAsList(private val nodeList: NodeList) : AbstractList<Element>() {
94-
override fun get(index: Int): Element {
95-
val node = nodeList.item(index)
96-
if (node == null) {
97-
throw IndexOutOfBoundsException("NodeList does not contain a node at index: " + index)
98-
} else if (node.nodeType == Node.ELEMENT_NODE) {
99-
return node as Element
100-
} else {
101-
throw ClassCastException("Node is not an Element as expected but is $node")
102-
}
103-
}
104-
105-
override val size: Int get() = nodeList.length
106-
}
107-
108-
/** Returns an [Iterator] over the next siblings of this node. */
109-
@Deprecated("This API is going to be removed", level = DeprecationLevel.ERROR)
110-
public fun Node.nextSiblings(): Iterable<Node> = NextSiblings(this)
111-
112-
private class NextSiblings(private var node: Node) : Iterable<Node> {
113-
override fun iterator(): Iterator<Node> = object : AbstractIterator<Node>() {
114-
override fun computeNext(): Unit {
115-
val nextValue = node.nextSibling
116-
if (nextValue != null) {
117-
setNext(nextValue)
118-
node = nextValue
119-
} else {
120-
done()
121-
}
122-
}
123-
}
124-
}
125-
126-
/** Returns an [Iterator] over the next siblings of this node. */
127-
@Deprecated("This API is going to be removed", level = DeprecationLevel.ERROR)
128-
public fun Node.previousSiblings(): Iterable<Node> = PreviousSiblings(this)
129-
130-
private class PreviousSiblings(private var node: Node) : Iterable<Node> {
131-
override fun iterator(): Iterator<Node> = object : AbstractIterator<Node>() {
132-
override fun computeNext(): Unit {
133-
val nextValue = node.previousSibling
134-
if (nextValue != null) {
135-
setNext(nextValue)
136-
node = nextValue
137-
} else {
138-
done()
139-
}
140-
}
141-
}
142-
}
14321

14422
/**
14523
* Gets a value indicating whether this node is a TEXT_NODE or a CDATA_SECTION_NODE.

js/js.libraries/src/dom/DomEvents.kt

Lines changed: 0 additions & 73 deletions
This file was deleted.

js/js.libraries/src/dom/DomJS.kt

Lines changed: 0 additions & 20 deletions
This file was deleted.

js/js.libraries/src/dom/Mutations.kt

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,6 @@ public fun Node.clear() {
99
}
1010
}
1111

12-
/**
13-
* Removes this node from parent node. Does nothing if no parent node
14-
*/
15-
@Deprecated("Use parentNode?.removeChild(this) instead.", ReplaceWith("this.also { it.parentNode?.removeChild(it) }"), level = DeprecationLevel.ERROR)
16-
public fun Node.removeFromParent() {
17-
parentNode?.removeChild(this)
18-
}
19-
20-
@Deprecated("Use appendChild instead", ReplaceWith("appendChild(node)"), level = DeprecationLevel.ERROR)
21-
operator fun Node.plus(child: Node): Node {
22-
appendChild(child)
23-
return this
24-
}
25-
26-
@Deprecated("Use appendText instead", ReplaceWith("appendText(text)"), level = DeprecationLevel.ERROR)
27-
operator fun Element.plus(text: String): Element = appendText(text)
28-
29-
@Deprecated("Use appendText instead", ReplaceWith("appendText(text)"), level = DeprecationLevel.ERROR)
30-
operator fun Element.plusAssign(text: String): Unit {
31-
appendText(text)
32-
}
33-
34-
/** Returns the owner document of the element or uses the provided document */
35-
@Deprecated("Use ownerDocument property instead", ReplaceWith("this.ownerDocument ?: doc ?: error(\"no ownerDocument\")"), level = DeprecationLevel.ERROR)
36-
fun Node.ownerDocument(doc: Document? = null): Document = when {
37-
nodeType == Node.DOCUMENT_NODE -> this as Document
38-
else -> doc ?: ownerDocument ?: throw IllegalArgumentException("Neither node contains nor parameter doc provides an owner document for $this")
39-
}
40-
41-
4212
/**
4313
* Creates text node and append it to the element.
4414
*
@@ -48,11 +18,3 @@ fun Element.appendText(text: String): Element {
4818
appendChild(ownerDocument!!.createTextNode(text))
4919
return this
5020
}
51-
52-
/**
53-
* Appends the node to the specified parent element
54-
*/
55-
@Deprecated("Use parent.appendChild instead", ReplaceWith("this.let(parent::appendChild)"), level = DeprecationLevel.ERROR)
56-
fun Node.appendTo(parent: Element) {
57-
parent.appendChild(this)
58-
}

0 commit comments

Comments
 (0)