Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
package org.teavm.jso.dom.xml;

import org.teavm.jso.JSProperty;
import org.teavm.jso.dom.xml.mixin.ChildNode;

public interface CharacterData extends Node {
public interface CharacterData extends Node, ChildNode {
@JSProperty
String getData();

Expand Down
7 changes: 2 additions & 5 deletions jso/apis/src/main/java/org/teavm/jso/dom/xml/Document.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
package org.teavm.jso.dom.xml;

import org.teavm.jso.JSProperty;
import org.teavm.jso.dom.xml.mixin.ParentNode;

public interface Document extends Node {
public interface Document extends Node, ParentNode {
@JSProperty
DocumentType getDoctype();

Expand Down Expand Up @@ -54,8 +55,4 @@ public interface Document extends Node {
NodeList<Element> getElementsByTagNameNS(String namespaceURI, String localName);

Element getElementById(String elementId);

Element querySelector(String selectors);

NodeList<? extends Element> querySelectorAll(String selectors);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package org.teavm.jso.dom.xml;

public interface DocumentFragment extends Node {
import org.teavm.jso.dom.xml.mixin.ParentNode;

public interface DocumentFragment extends Node, ParentNode {

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
package org.teavm.jso.dom.xml;

import org.teavm.jso.JSProperty;
import org.teavm.jso.dom.xml.mixin.ChildNode;

public interface DocumentType extends Node {
public interface DocumentType extends Node, ChildNode {
@JSProperty
String getName();

Expand Down
14 changes: 10 additions & 4 deletions jso/apis/src/main/java/org/teavm/jso/dom/xml/Element.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
package org.teavm.jso.dom.xml;

import org.teavm.jso.JSProperty;
import org.teavm.jso.dom.xml.mixin.ChildNode;
import org.teavm.jso.dom.xml.mixin.ParentNode;

public interface Element extends Node {
public interface Element extends Node, ParentNode, ChildNode {
String getAttribute(String name);

void setAttribute(String name, String value);
Expand Down Expand Up @@ -48,10 +50,14 @@ public interface Element extends Node {

boolean hasAttributeNS(String namespaceURI, String localName);

Element querySelector(String selectors);
boolean toggleAttribute(String name);

boolean toggleAttribute(String name, boolean force);

Element closest(String selectors);

boolean matches(String selectors);

NodeList<? extends Element> querySelectorAll(String selectors);

@JSProperty
String getId();

Expand Down
2 changes: 1 addition & 1 deletion jso/apis/src/main/java/org/teavm/jso/dom/xml/Text.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
*/
package org.teavm.jso.dom.xml;

public interface Text extends Node {
public interface Text extends CharacterData {
Text splitText(int offset);
}
26 changes: 26 additions & 0 deletions jso/apis/src/main/java/org/teavm/jso/dom/xml/mixin/ChildNode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2025 Andi Rady Kurniawan.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.jso.dom.xml.mixin;

public interface ChildNode {
void before(Object... nodes);

void after(Object... nodes);

void replaceWith(Object... nodes);

void remove();
}
31 changes: 31 additions & 0 deletions jso/apis/src/main/java/org/teavm/jso/dom/xml/mixin/ParentNode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2025 Andi Rady Kurniawan.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.jso.dom.xml.mixin;

import org.teavm.jso.dom.xml.Element;
import org.teavm.jso.dom.xml.NodeList;

public interface ParentNode {
void prepend(Object... nodes);

void append(Object... nodes);

void replaceChildren(Object... nodes);

Element querySelector(String selectors);

NodeList<? extends Element> querySelectorAll(String selectors);
}