jso apis: turn DOM interfaces into abstract classes

This would make it possible to test HTMLElement for particular type with instanceof
This commit is contained in:
Alexey Andreev 2024-04-12 13:00:05 +02:00
parent 6a09f181c7
commit 272f55b383
27 changed files with 424 additions and 442 deletions

View File

@ -17,6 +17,8 @@ package org.teavm.jso.crypto;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
import org.teavm.jso.JSTopLevel;
import org.teavm.jso.typedarrays.Int16Array;
import org.teavm.jso.typedarrays.Int32Array;
import org.teavm.jso.typedarrays.Int8Array;
@ -28,7 +30,8 @@ public abstract class Crypto implements JSObject {
@JSBody(script = "return crypto != null;")
public static native boolean isSupported();
@JSBody(script = "return crypto;")
@JSProperty("crypto")
@JSTopLevel
public static native Crypto current();
public abstract String randomUUID();

View File

@ -18,55 +18,55 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
import org.teavm.jso.dom.types.DOMTokenList;
public interface HTMLAnchorElement extends HTMLElement {
public abstract class HTMLAnchorElement extends HTMLElement {
@JSProperty
String getHref();
public abstract String getHref();
@JSProperty
void setHref(String value);
public abstract void setHref(String value);
@JSProperty
String getTarget();
public abstract String getTarget();
@JSProperty
void setTarget(String value);
public abstract void setTarget(String value);
@JSProperty
String getRel();
public abstract String getRel();
@JSProperty
void setRel(String value);
public abstract void setRel(String value);
@JSProperty
DOMTokenList getTokenList();
public abstract DOMTokenList getTokenList();
@JSProperty
String getMedia();
public abstract String getMedia();
@JSProperty
void setMedia(String value);
public abstract void setMedia(String value);
@JSProperty
String getHreflang();
public abstract String getHreflang();
@JSProperty
void setHreflang(String value);
public abstract void setHreflang(String value);
@JSProperty
String getType();
public abstract String getType();
@JSProperty
void setType(String value);
public abstract void setType(String value);
@JSProperty
String getText();
public abstract String getText();
@JSProperty
void setText(String value);
public abstract void setText(String value);
@JSProperty
String getDownload();
public abstract String getDownload();
@JSProperty
void setDownload(String download);
public abstract void setDownload(String download);
}

View File

@ -15,10 +15,5 @@
*/
package org.teavm.jso.dom.html;
/**
*
* @author Junji Takakura
*/
public interface HTMLAudioElement extends HTMLMediaElement {
public abstract class HTMLAudioElement extends HTMLMediaElement {
}

View File

@ -17,15 +17,15 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
public interface HTMLBaseElement extends HTMLElement {
public abstract class HTMLBaseElement extends HTMLElement {
@JSProperty
String getHref();
public abstract String getHref();
@JSProperty
void setHref(String href);
public abstract void setHref(String href);
@JSProperty
String getTarget();
public abstract String getTarget();
void setTarget(String target);
public abstract void setTarget(String target);
}

View File

@ -19,26 +19,26 @@ import org.teavm.jso.JSProperty;
import org.teavm.jso.dom.events.Event;
import org.teavm.jso.dom.events.EventListener;
public interface HTMLBodyElement extends HTMLElement {
public abstract class HTMLBodyElement extends HTMLElement {
@JSProperty("onbeforeunload")
void setOnBeforeUnload(EventListener<Event> listener);
public abstract void setOnBeforeUnload(EventListener<Event> listener);
@JSProperty("onerror")
void setOnError(EventListener<Event> listener);
public abstract void setOnError(EventListener<Event> listener);
@JSProperty("onload")
void setOnLoad(EventListener<Event> listener);
public abstract void setOnLoad(EventListener<Event> listener);
@JSProperty("onmessage")
void setOnMessage(EventListener<Event> listener);
public abstract void setOnMessage(EventListener<Event> listener);
@JSProperty("onoffline")
void setOnOffline(EventListener<Event> listener);
public abstract void setOnOffline(EventListener<Event> listener);
@JSProperty("ononline")
void setOnOnline(EventListener<Event> listener);
public abstract void setOnOnline(EventListener<Event> listener);
@JSProperty("ononunload")
void setOnUnload(EventListener<Event> listener);
public abstract void setOnUnload(EventListener<Event> listener);
}

View File

@ -17,43 +17,43 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
public interface HTMLButtonElement extends HTMLElement {
String TYPE_BUTTON = "button";
public abstract class HTMLButtonElement extends HTMLElement {
public static final String TYPE_BUTTON = "button";
String TYPE_RESET = "reset";
public static final String TYPE_RESET = "reset";
String TYPE_SUBMIT = "submit";
public static final String TYPE_SUBMIT = "submit";
@JSProperty
boolean isAutofocus();
public abstract boolean isAutofocus();
@JSProperty
void setAutofocus(boolean autofocus);
public abstract void setAutofocus(boolean autofocus);
@JSProperty
boolean isDisabled();
public abstract boolean isDisabled();
@JSProperty
void setDisabled(boolean disabled);
public abstract void setDisabled(boolean disabled);
@JSProperty
HTMLElement getForm();
public abstract HTMLElement getForm();
@JSProperty
String getName();
public abstract String getName();
@JSProperty
void setName(String name);
public abstract void setName(String name);
@JSProperty
String getValue();
public abstract String getValue();
@JSProperty
void setValue(String value);
public abstract void setValue(String value);
@JSProperty
String getType();
public abstract String getType();
@JSProperty
void setType(String type);
public abstract void setType(String type);
}

View File

@ -19,26 +19,26 @@ import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
import org.teavm.jso.canvas.CanvasImageSource;
public interface HTMLCanvasElement extends HTMLElement, CanvasImageSource {
public abstract class HTMLCanvasElement extends HTMLElement implements CanvasImageSource {
@JSProperty
int getWidth();
public abstract int getWidth();
@JSProperty
void setWidth(int width);
public abstract void setWidth(int width);
@JSProperty
int getHeight();
public abstract int getHeight();
@JSProperty
void setHeight(int height);
public abstract void setHeight(int height);
JSObject getContext(String contextId);
public abstract JSObject getContext(String contextId);
JSObject getContext(String contextId, JSObject attributes);
public abstract JSObject getContext(String contextId, JSObject attributes);
String toDataURL(String type, double quality);
public abstract String toDataURL(String type, double quality);
String toDataURL(String type);
public abstract String toDataURL(String type);
String toDataURL();
public abstract String toDataURL();
}

View File

@ -22,74 +22,74 @@ import org.teavm.jso.dom.events.EventTarget;
import org.teavm.jso.dom.xml.Document;
import org.teavm.jso.dom.xml.NodeList;
public interface HTMLDocument extends Document, EventTarget {
public abstract class HTMLDocument implements Document, EventTarget {
@JSProperty
@Override
HTMLHtmlElement getDocumentElement();
public abstract HTMLHtmlElement getDocumentElement();
@Override
HTMLElement createElement(String tagName);
public abstract HTMLElement createElement(String tagName);
default HTMLElement createElement(String tagName, Consumer<HTMLElement> consumer) {
public final HTMLElement createElement(String tagName, Consumer<HTMLElement> consumer) {
HTMLElement result = createElement(tagName);
consumer.accept(result);
return result;
}
@Override
HTMLElement getElementById(String elementId);
public abstract HTMLElement getElementById(String elementId);
@JSProperty
HTMLBodyElement getBody();
public abstract HTMLBodyElement getBody();
@JSProperty
HTMLHeadElement getHead();
public abstract HTMLHeadElement getHead();
@JSProperty
int getScrollLeft();
public abstract int getScrollLeft();
@JSProperty
int getScrollTop();
public abstract int getScrollTop();
static HTMLDocument current() {
public static HTMLDocument current() {
return Window.current().getDocument();
}
@Override
HTMLElement querySelector(String selectors);
public abstract HTMLElement querySelector(String selectors);
@Override
NodeList<? extends HTMLElement> querySelectorAll(String selectors);
public abstract NodeList<? extends HTMLElement> querySelectorAll(String selectors);
@JSProperty
HTMLElement getActiveElement();
public abstract HTMLElement getActiveElement();
HTMLElement elementFromPoint(int x, int y);
public abstract HTMLElement elementFromPoint(int x, int y);
@JSProperty
boolean isDesignMode();
public abstract boolean isDesignMode();
@JSProperty
void setDesignMode(boolean value);
public abstract void setDesignMode(boolean value);
void execCommand(String commandName, boolean showDefaultUI, String valueArgument);
public abstract void execCommand(String commandName, boolean showDefaultUI, String valueArgument);
void execCommand(String commandName);
public abstract void execCommand(String commandName);
@JSProperty
String getCookie();
public abstract String getCookie();
@JSProperty
void setCookie(String cookie);
public abstract void setCookie(String cookie);
@JSProperty
String getTitle();
public abstract String getTitle();
@JSProperty
void setTitle(String title);
public abstract void setTitle(String title);
@JSProperty
HTMLElement getPointerLockElement();
public abstract HTMLElement getPointerLockElement();
void exitPointerLock();
public abstract void exitPointerLock();
}

View File

@ -29,158 +29,158 @@ import org.teavm.jso.dom.xml.Element;
import org.teavm.jso.dom.xml.Node;
import org.teavm.jso.dom.xml.NodeList;
public interface HTMLElement extends Element, ElementCSSInlineStyle, EventTarget, FocusEventTarget, MouseEventTarget,
WheelEventTarget, KeyboardEventTarget, LoadEventTarget {
public abstract class HTMLElement implements Element, ElementCSSInlineStyle, EventTarget, FocusEventTarget,
MouseEventTarget, WheelEventTarget, KeyboardEventTarget, LoadEventTarget {
@Override
NodeList<? extends HTMLElement> getElementsByTagName(String name);
public abstract NodeList<? extends HTMLElement> getElementsByTagName(String name);
@JSProperty
String getTitle();
public abstract String getTitle();
@JSProperty
void setTitle(String title);
public abstract void setTitle(String title);
@JSProperty
String getLang();
public abstract String getLang();
@JSProperty
void setLang(String lang);
public abstract void setLang(String lang);
@JSProperty
boolean isTranslate();
public abstract boolean isTranslate();
@JSProperty
void setTranslate(boolean translate);
public abstract void setTranslate(boolean translate);
@JSProperty
String getDir();
public abstract String getDir();
@JSProperty
void setDir(String dir);
public abstract void setDir(String dir);
@JSProperty
boolean isHidden();
public abstract boolean isHidden();
@JSProperty
void setHidden(boolean hidden);
public abstract void setHidden(boolean hidden);
void click();
public abstract void click();
@JSProperty
int getTabIndex();
public abstract int getTabIndex();
@JSProperty
void setTabIndex(int tabIndex);
public abstract void setTabIndex(int tabIndex);
void focus();
public abstract void focus();
void blur();
public abstract void blur();
@JSProperty
String getAccessKey();
public abstract String getAccessKey();
@JSProperty
void setAccessKey(String accessKey);
public abstract void setAccessKey(String accessKey);
@JSProperty
String getAccessKeyLabel();
public abstract String getAccessKeyLabel();
@JSProperty
int getClientWidth();
public abstract int getClientWidth();
@JSProperty
int getClientHeight();
public abstract int getClientHeight();
@JSProperty
int getAbsoluteLeft();
public abstract int getAbsoluteLeft();
@JSProperty
int getAbsoluteTop();
public abstract int getAbsoluteTop();
@JSProperty
int getScrollLeft();
public abstract int getScrollLeft();
@JSProperty
void setScrollLeft(int scrollLeft);
public abstract void setScrollLeft(int scrollLeft);
@JSProperty
int getScrollTop();
public abstract int getScrollTop();
@JSProperty
void setScrollTop(int scrollTop);
public abstract void setScrollTop(int scrollTop);
@JSProperty
int getScrollWidth();
public abstract int getScrollWidth();
@JSProperty
int getScrollHeight();
public abstract int getScrollHeight();
@JSProperty
int getOffsetWidth();
public abstract int getOffsetWidth();
@JSProperty
int getOffsetHeight();
public abstract int getOffsetHeight();
@JSProperty
int getOffsetTop();
public abstract int getOffsetTop();
@JSProperty
int getOffsetLeft();
public abstract int getOffsetLeft();
@JSProperty
@Override
HTMLDocument getOwnerDocument();
public abstract HTMLDocument getOwnerDocument();
@JSProperty
HTMLCollection getChildren();
public abstract HTMLCollection getChildren();
@JSProperty
String getInnerHTML();
public abstract String getInnerHTML();
@JSProperty
void setInnerHTML(String content);
public abstract void setInnerHTML(String content);
@JSProperty
String getInnerText();
public abstract String getInnerText();
@JSProperty
void setInnerText(String content);
public abstract void setInnerText(String content);
TextRectangle getBoundingClientRect();
public abstract TextRectangle getBoundingClientRect();
@JSProperty
String getClassName();
public abstract String getClassName();
@JSProperty
void setClassName(String className);
public abstract void setClassName(String className);
@JSProperty
DOMTokenList getClassList();
public abstract DOMTokenList getClassList();
default HTMLElement withAttr(String name, String value) {
public final HTMLElement withAttr(String name, String value) {
setAttribute(name, value);
return this;
}
default HTMLElement withChild(String tagName) {
public final HTMLElement withChild(String tagName) {
HTMLElement result = getOwnerDocument().createElement(tagName);
appendChild(result);
return this;
}
default HTMLElement withChild(Node node) {
public final HTMLElement withChild(Node node) {
appendChild(node);
return this;
}
default HTMLElement withChild(String tagName, Consumer<HTMLElement> consumer) {
public final HTMLElement withChild(String tagName, Consumer<HTMLElement> consumer) {
HTMLElement result = getOwnerDocument().createElement(tagName);
appendChild(result);
consumer.accept(result);
return this;
}
default HTMLElement clear() {
public final HTMLElement clear() {
Node node = getLastChild();
while (node != null) {
Node prev = node.getPreviousSibling();
@ -192,16 +192,16 @@ public interface HTMLElement extends Element, ElementCSSInlineStyle, EventTarget
return this;
}
default HTMLElement withText(String content) {
public final HTMLElement withText(String content) {
clear().appendChild(getOwnerDocument().createTextNode(content));
return this;
}
@Override
HTMLElement querySelector(String selectors);
public abstract HTMLElement querySelector(String selectors);
@Override
NodeList<? extends HTMLElement> querySelectorAll(String selectors);
public abstract NodeList<? extends HTMLElement> querySelectorAll(String selectors);
void requestPointerLock();
public abstract void requestPointerLock();
}

View File

@ -18,73 +18,73 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSIndexer;
import org.teavm.jso.JSProperty;
public interface HTMLFormElement extends HTMLElement {
public abstract class HTMLFormElement extends HTMLElement {
@JSProperty
String getAcceptCharset();
public abstract String getAcceptCharset();
@JSProperty
void setAcceptCharset(String value);
public abstract void setAcceptCharset(String value);
@JSProperty
String getAction();
public abstract String getAction();
@JSProperty
void setAction(String value);
public abstract void setAction(String value);
@JSProperty
String getAutocomplete();
public abstract String getAutocomplete();
@JSProperty
void setAutocomplete(String value);
public abstract void setAutocomplete(String value);
@JSProperty
String getEnctype();
public abstract String getEnctype();
@JSProperty
void setEnctype(String enctype);
public abstract void setEnctype(String enctype);
@JSProperty
String getEncoding();
public abstract String getEncoding();
@JSProperty
void setEncoding(String value);
public abstract void setEncoding(String value);
@JSProperty
String getMethod();
public abstract String getMethod();
@JSProperty
void setMethod(String value);
public abstract void setMethod(String value);
@JSProperty
String getName();
public abstract String getName();
@JSProperty
void setName(String name);
public abstract void setName(String name);
@JSProperty
boolean isNoValidate();
public abstract boolean isNoValidate();
@JSProperty
void setNoValidate(boolean value);
public abstract void setNoValidate(boolean value);
@JSProperty
String getTarget();
public abstract String getTarget();
@JSProperty
void setTarget(String value);
public abstract void setTarget(String value);
@JSIndexer
HTMLElement get(String name);
public abstract HTMLElement get(String name);
@JSIndexer
HTMLElement get(int index);
public abstract HTMLElement get(int index);
@JSProperty
int getLength();
public abstract int getLength();
void submit();
public abstract void submit();
void reset();
public abstract void reset();
boolean checkValidity();
public abstract boolean checkValidity();
}

View File

@ -15,5 +15,5 @@
*/
package org.teavm.jso.dom.html;
public interface HTMLHeadElement extends HTMLElement {
public abstract class HTMLHeadElement extends HTMLElement {
}

View File

@ -15,5 +15,5 @@
*/
package org.teavm.jso.dom.html;
public interface HTMLHtmlElement extends HTMLElement {
public abstract class HTMLHtmlElement extends HTMLElement {
}

View File

@ -18,40 +18,40 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
import org.teavm.jso.browser.Window;
public interface HTMLIFrameElement extends HTMLElement {
public abstract class HTMLIFrameElement extends HTMLElement {
@JSProperty
HTMLDocument getContentDocument();
public abstract HTMLDocument getContentDocument();
@JSProperty
Window getContentWindow();
public abstract Window getContentWindow();
@JSProperty
String getWidth();
public abstract String getWidth();
@JSProperty
void setWidth(String width);
public abstract void setWidth(String width);
@JSProperty
String getHeight();
public abstract String getHeight();
@JSProperty
void setHeight(String height);
public abstract void setHeight(String height);
@JSProperty
String getName();
public abstract String getName();
@JSProperty
void setName(String name);
public abstract void setName(String name);
@JSProperty("src")
String getSourceAddress();
public abstract String getSourceAddress();
@JSProperty("src")
void setSourceAddress(String src);
public abstract void setSourceAddress(String src);
@JSProperty("srcdoc")
String getSourceDocument();
public abstract String getSourceDocument();
@JSProperty("srcdoc")
void setSourceDocument(String srcdoc);
public abstract void setSourceDocument(String srcdoc);
}

View File

@ -18,40 +18,40 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
import org.teavm.jso.canvas.CanvasImageSource;
public interface HTMLImageElement extends HTMLElement, CanvasImageSource {
public abstract class HTMLImageElement extends HTMLElement implements CanvasImageSource {
@JSProperty
String getAlt();
public abstract String getAlt();
@JSProperty
void setAlt(String alt);
public abstract void setAlt(String alt);
@JSProperty
int getWidth();
public abstract int getWidth();
@JSProperty
void setWidth(int width);
public abstract void setWidth(int width);
@JSProperty
int getHeight();
public abstract int getHeight();
@JSProperty
void setHeight(int height);
public abstract void setHeight(int height);
@JSProperty
int getNaturalWidth();
public abstract int getNaturalWidth();
@JSProperty
int getNaturalHeight();
public abstract int getNaturalHeight();
@JSProperty
String getSrc();
public abstract String getSrc();
@JSProperty
void setSrc(String src);
public abstract void setSrc(String src);
@JSProperty
String getCrossOrigin();
public abstract String getCrossOrigin();
@JSProperty
void setCrossOrigin(String crossOrigin);
public abstract void setCrossOrigin(String crossOrigin);
}

View File

@ -17,66 +17,66 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
public interface HTMLInputElement extends HTMLElement {
public abstract class HTMLInputElement extends HTMLElement {
@JSProperty
boolean isChecked();
public abstract boolean isChecked();
@JSProperty
void setChecked(boolean checked);
public abstract void setChecked(boolean checked);
@JSProperty
boolean isDisabled();
public abstract boolean isDisabled();
@JSProperty
void setDisabled(boolean disabled);
public abstract void setDisabled(boolean disabled);
@JSProperty
int getMaxLength();
public abstract int getMaxLength();
@JSProperty
void setMaxLength(int maxLength);
public abstract void setMaxLength(int maxLength);
@JSProperty
String getName();
public abstract String getName();
@JSProperty
void setName(String name);
public abstract void setName(String name);
@JSProperty
boolean isReadOnly();
public abstract boolean isReadOnly();
@JSProperty
void setReadOnly(boolean readOnly);
public abstract void setReadOnly(boolean readOnly);
@JSProperty
int getSize();
public abstract int getSize();
@JSProperty
void setSize(int size);
public abstract void setSize(int size);
@JSProperty
String getType();
public abstract String getType();
@JSProperty
void setType(String type);
public abstract void setType(String type);
@JSProperty
String getValue();
public abstract String getValue();
@JSProperty
void setValue(String value);
public abstract void setValue(String value);
void setCustomValidity(String validationFailure);
public abstract void setCustomValidity(String validationFailure);
boolean checkValidity();
public abstract boolean checkValidity();
boolean reportValidity();
public abstract boolean reportValidity();
void select();
public abstract void select();
@JSProperty
String getPlaceholder();
public abstract String getPlaceholder();
@JSProperty
void setPlaceholder(String value);
public abstract void setPlaceholder(String value);
}

View File

@ -17,40 +17,40 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
public interface HTMLLinkElement extends HTMLElement {
public abstract class HTMLLinkElement extends HTMLElement {
@JSProperty
String getHref();
public abstract String getHref();
@JSProperty
void setHref(String href);
public abstract void setHref(String href);
@JSProperty
String getCrossOrigin();
public abstract String getCrossOrigin();
@JSProperty
void setCrossOrigin(String crossOrigin);
public abstract void setCrossOrigin(String crossOrigin);
@JSProperty
String getRel();
public abstract String getRel();
@JSProperty
void setRel(String rel);
public abstract void setRel(String rel);
@JSProperty
String getMedia();
public abstract String getMedia();
@JSProperty
void setMedia(String media);
public abstract void setMedia(String media);
@JSProperty
String getHreflang();
public abstract String getHreflang();
@JSProperty
void setHreflang(String hreflang);
public abstract void setHreflang(String hreflang);
@JSProperty
String getType();
public abstract String getType();
@JSProperty
void setType(String property);
public abstract void setType(String property);
}

View File

@ -16,6 +16,7 @@
package org.teavm.jso.dom.html;
import java.util.Date;
import org.teavm.jso.JSClass;
import org.teavm.jso.JSProperty;
import org.teavm.jso.media.AudioTrackList;
import org.teavm.jso.media.MediaController;
@ -25,171 +26,168 @@ import org.teavm.jso.media.TextTrackList;
import org.teavm.jso.media.TimeRanges;
import org.teavm.jso.media.VideoTrackList;
/**
*
* @author Junji Takakura
*/
public interface HTMLMediaElement extends HTMLElement {
int HAVE_NOTHING = 0;
int HAVE_METADATA = 1;
int HAVE_CURRENT_DATA = 2;
int HAVE_FUTURE_DATA = 3;
int HAVE_ENOUGH_DATA = 4;
@JSClass
public abstract class HTMLMediaElement extends HTMLElement {
public static final int HAVE_NOTHING = 0;
public static final int HAVE_METADATA = 1;
public static final int HAVE_CURRENT_DATA = 2;
public static final int HAVE_FUTURE_DATA = 3;
public static final int HAVE_ENOUGH_DATA = 4;
int NETWORK_EMPTY = 0;
int NETWORK_IDLE = 1;
int NETWORK_LOADING = 2;
int NETWORK_NO_SOURCE = 3;
public static final int NETWORK_EMPTY = 0;
public static final int NETWORK_IDLE = 1;
public static final int NETWORK_LOADING = 2;
public static final int NETWORK_NO_SOURCE = 3;
@JSProperty
MediaError getError();
public abstract MediaError getError();
@JSProperty
String getSrc();
public abstract String getSrc();
@JSProperty
void setSrc(String src);
public abstract void setSrc(String src);
@JSProperty
String getCurrentSrc();
public abstract String getCurrentSrc();
@JSProperty
String getCrossOrigin();
public abstract String getCrossOrigin();
@JSProperty
void setCrossOrigin(String crossOrigin);
public abstract void setCrossOrigin(String crossOrigin);
@JSProperty
int getNetworkState();
public abstract int getNetworkState();
@JSProperty
String getPreload();
public abstract String getPreload();
@JSProperty
void setPreload(String preload);
public abstract void setPreload(String preload);
@JSProperty
TimeRanges getBuffered();
public abstract TimeRanges getBuffered();
@JSProperty
int getReadyState();
public abstract int getReadyState();
@JSProperty
boolean isSeeking();
public abstract boolean isSeeking();
@JSProperty
double getCurrentTime();
public abstract double getCurrentTime();
@JSProperty
void setCurrentTime(double currentTime);
public abstract void setCurrentTime(double currentTime);
default void addCurrentTime(double delta) {
public final void addCurrentTime(double delta) {
setCurrentTime(getCurrentTime() + delta);
}
@JSProperty
double getDuration();
public abstract double getDuration();
@JSProperty
Date getStartDate();
public abstract Date getStartDate();
@JSProperty
boolean isPaused();
public abstract boolean isPaused();
@JSProperty
double getDefaultPlaybackRate();
public abstract double getDefaultPlaybackRate();
@JSProperty
void setDefaultPlaybackRate(double defaultPlaybackRate);
public abstract void setDefaultPlaybackRate(double defaultPlaybackRate);
@JSProperty
double getPlaybackRate();
public abstract double getPlaybackRate();
@JSProperty
void setPlaybackRate(double playbackRate);
public abstract void setPlaybackRate(double playbackRate);
default void addPlaybackRate(double delta) {
public final void addPlaybackRate(double delta) {
setPlaybackRate(getPlaybackRate() + delta);
}
@JSProperty
TimeRanges getPlayed();
public abstract TimeRanges getPlayed();
@JSProperty
TimeRanges getSeekable();
public abstract TimeRanges getSeekable();
@JSProperty
boolean isEnded();
public abstract boolean isEnded();
@JSProperty
boolean isAutoplay();
public abstract boolean isAutoplay();
@JSProperty
void setAutoplay(boolean autoplay);
public abstract void setAutoplay(boolean autoplay);
@JSProperty
boolean isLoop();
public abstract boolean isLoop();
@JSProperty
void setLoop(boolean loop);
public abstract void setLoop(boolean loop);
@JSProperty
String getMediaGroup();
public abstract String getMediaGroup();
@JSProperty
void setMediaGroup(String mediaGroup);
public abstract void setMediaGroup(String mediaGroup);
@JSProperty
MediaController getController();
public abstract MediaController getController();
@JSProperty
void setController(MediaController controller);
public abstract void setController(MediaController controller);
@JSProperty
boolean isControls();
public abstract boolean isControls();
@JSProperty
void setControls(boolean controls);
public abstract void setControls(boolean controls);
@JSProperty
float getVolume();
public abstract float getVolume();
@JSProperty
void setVolume(float volume);
public abstract void setVolume(float volume);
default void addVolume(float delta) {
public final void addVolume(float delta) {
setVolume(getVolume() + delta);
}
@JSProperty
boolean isMuted();
public abstract boolean isMuted();
@JSProperty
void setMuted(boolean muted);
public abstract void setMuted(boolean muted);
@JSProperty
boolean isDefaultMuted();
public abstract boolean isDefaultMuted();
@JSProperty
void setDefaultMuted(boolean defaultMuted);
public abstract void setDefaultMuted(boolean defaultMuted);
AudioTrackList getAudioTracks();
public abstract AudioTrackList getAudioTracks();
VideoTrackList getVideoTracks();
public abstract VideoTrackList getVideoTracks();
TextTrackList getTextTracks();
public abstract TextTrackList getTextTracks();
TextTrack addTextTrack(String kind);
public abstract TextTrack addTextTrack(String kind);
TextTrack addTextTrack(String kind, String label);
public abstract TextTrack addTextTrack(String kind, String label);
TextTrack addTextTrack(String kind, String label, String language);
public abstract TextTrack addTextTrack(String kind, String label, String language);
void play();
public abstract void play();
void pause();
public abstract void pause();
void load();
public abstract void load();
String canPlayType(String type);
public abstract String canPlayType(String type);
}

View File

@ -17,22 +17,22 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
public interface HTMLMetaElement extends HTMLElement {
public abstract class HTMLMetaElement extends HTMLElement {
@JSProperty
String getName();
public abstract String getName();
@JSProperty
void setName(String name);
public abstract void setName(String name);
@JSProperty
String getHttpEquiv();
public abstract String getHttpEquiv();
@JSProperty
void setHttpEquiv(String httpEquiv);
public abstract void setHttpEquiv(String httpEquiv);
@JSProperty
String getContent();
public abstract String getContent();
@JSProperty
void setContent(String content);
public abstract void setContent(String content);
}

View File

@ -17,43 +17,43 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
public interface HTMLOptionElement extends HTMLElement {
public abstract class HTMLOptionElement extends HTMLElement {
@JSProperty
boolean isDisabled();
public abstract boolean isDisabled();
@JSProperty
void setDisabled(boolean disabled);
public abstract void setDisabled(boolean disabled);
@JSProperty
String getLabel();
public abstract String getLabel();
@JSProperty
void setLabel(String label);
public abstract void setLabel(String label);
@JSProperty
boolean isDefaultSelected();
public abstract boolean isDefaultSelected();
@JSProperty
void setDefaultSelected(boolean defaultSelected);
public abstract void setDefaultSelected(boolean defaultSelected);
@JSProperty
boolean isSelected();
public abstract boolean isSelected();
@JSProperty
void setSelected(boolean selected);
public abstract void setSelected(boolean selected);
@JSProperty
String getValue();
public abstract String getValue();
@JSProperty
void setValue(String value);
public abstract void setValue(String value);
@JSProperty
String getText();
public abstract String getText();
@JSProperty
void setText(String text);
public abstract void setText(String text);
@JSProperty
int getIndex();
public abstract int getIndex();
}

View File

@ -17,40 +17,40 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
public interface HTMLScriptElement extends HTMLElement {
public abstract class HTMLScriptElement extends HTMLElement {
@JSProperty
String getSrc();
public abstract String getSrc();
@JSProperty
void setSrc(String value);
public abstract void setSrc(String value);
@JSProperty
boolean isAsync();
public abstract boolean isAsync();
@JSProperty
void setAsync(boolean value);
public abstract void setAsync(boolean value);
@JSProperty
boolean isDefer();
public abstract boolean isDefer();
@JSProperty
void setDefer(boolean value);
public abstract void setDefer(boolean value);
@JSProperty
String getType();
public abstract String getType();
@JSProperty
void setType(String value);
public abstract void setType(String value);
@JSProperty
String getCharset();
public abstract String getCharset();
@JSProperty
void setCharset(String value);
public abstract void setCharset(String value);
@JSProperty
String getText();
public abstract String getText();
@JSProperty
void setText(String value);
public abstract void setText(String value);
}

View File

@ -17,47 +17,47 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
public interface HTMLSelectElement extends HTMLElement {
public abstract class HTMLSelectElement extends HTMLElement {
@JSProperty
boolean isDisabled();
public abstract boolean isDisabled();
@JSProperty
void setDisabled(boolean disabled);
public abstract void setDisabled(boolean disabled);
@JSProperty
boolean isMultiple();
public abstract boolean isMultiple();
@JSProperty
void setMultiple(boolean multiple);
public abstract void setMultiple(boolean multiple);
@JSProperty
HTMLOptionsCollection getOptions();
public abstract HTMLOptionsCollection getOptions();
@JSProperty
String getName();
public abstract String getName();
@JSProperty
void setName(String name);
public abstract void setName(String name);
@JSProperty
int getSize();
public abstract int getSize();
@JSProperty
void setSize(int size);
public abstract void setSize(int size);
@JSProperty
int getSelectedIndex();
public abstract int getSelectedIndex();
@JSProperty
void setSelectedIndex(int selectedIndex);
public abstract void setSelectedIndex(int selectedIndex);
@JSProperty
String getValue();
public abstract String getValue();
@JSProperty
void setValue(String value);
public abstract void setValue(String value);
void setCustomValidity(String validationFailure);
public abstract void setCustomValidity(String validationFailure);
boolean reportValidity();
public abstract boolean reportValidity();
}

View File

@ -17,28 +17,24 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
/**
*
* @author Junji Takakura
*/
public interface HTMLSourceElement extends HTMLElement {
public abstract class HTMLSourceElement extends HTMLElement {
@JSProperty
String getType();
public abstract String getType();
@JSProperty
void setType(String type);
public abstract void setType(String type);
@JSProperty
String getSrc();
public abstract String getSrc();
@JSProperty
void setSrc(String src);
public abstract void setSrc(String src);
@JSProperty
String getMedia();
public abstract String getMedia();
@JSProperty
void setMedia(String media);
public abstract void setMedia(String media);
}

View File

@ -17,133 +17,133 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
public interface HTMLTextAreaElement extends HTMLElement {
public abstract class HTMLTextAreaElement extends HTMLElement {
@JSProperty
String getAutocomplete();
public abstract String getAutocomplete();
@JSProperty
void setAutocomplete(String value);
public abstract void setAutocomplete(String value);
@JSProperty
boolean isAutofocus();
public abstract boolean isAutofocus();
@JSProperty
void setAutofocus(boolean value);
public abstract void setAutofocus(boolean value);
@JSProperty
int getCols();
public abstract int getCols();
@JSProperty
void setCols(int cols);
public abstract void setCols(int cols);
@JSProperty
String getDirName();
public abstract String getDirName();
@JSProperty
void setDirName(String value);
public abstract void setDirName(String value);
@JSProperty
boolean isDisabled();
public abstract boolean isDisabled();
@JSProperty
void setDisabled(boolean value);
public abstract void setDisabled(boolean value);
@JSProperty
HTMLFormElement getForm();
public abstract HTMLFormElement getForm();
@JSProperty
int getMaxLength();
public abstract int getMaxLength();
@JSProperty
void setMaxLength(int value);
public abstract void setMaxLength(int value);
@JSProperty
int getMinLength();
public abstract int getMinLength();
@JSProperty
void setMinLength(int value);
public abstract void setMinLength(int value);
@JSProperty
String getName();
public abstract String getName();
@JSProperty
void setName(String value);
public abstract void setName(String value);
@JSProperty
String getPlaceholder();
public abstract String getPlaceholder();
@JSProperty
void setPlaceholder(String value);
public abstract void setPlaceholder(String value);
@JSProperty
boolean isReadOnly();
public abstract boolean isReadOnly();
@JSProperty
void setReadOnly(boolean value);
public abstract void setReadOnly(boolean value);
@JSProperty
int getRows();
public abstract int getRows();
@JSProperty
void setRows(int rows);
public abstract void setRows(int rows);
@JSProperty
String getWrap();
public abstract String getWrap();
@JSProperty
void setWrap(String value);
public abstract void setWrap(String value);
@JSProperty
String getType();
public abstract String getType();
@JSProperty
String getDefaultValue();
public abstract String getDefaultValue();
@JSProperty
void setDefaultValue(String value);
public abstract void setDefaultValue(String value);
@JSProperty
String getValue();
public abstract String getValue();
@JSProperty
void setValue(String value);
public abstract void setValue(String value);
@JSProperty
int getTextLength();
public abstract int getTextLength();
void setCustomValidity(String validationFailure);
public abstract void setCustomValidity(String validationFailure);
boolean checkValidity();
public abstract boolean checkValidity();
boolean reportValidity();
public abstract boolean reportValidity();
void select();
public abstract void select();
@JSProperty
int getSelectionStart();
public abstract int getSelectionStart();
@JSProperty
void setSelectionStart(int value);
public abstract void setSelectionStart(int value);
@JSProperty
int getSelectionEnd();
public abstract int getSelectionEnd();
@JSProperty
void setSelectionEnd(int value);
public abstract void setSelectionEnd(int value);
@JSProperty
String getSelectionDirection();
public abstract String getSelectionDirection();
@JSProperty
void setSelectionDirection(String value);
public abstract void setSelectionDirection(String value);
void setRangeText(String replacement);
public abstract void setRangeText(String replacement);
void setRangeText(String replacement, int start, int end, String selectionMode);
public abstract void setRangeText(String replacement, int start, int end, String selectionMode);
void setRangeText(String replacement, int start, int end);
public abstract void setRangeText(String replacement, int start, int end);
void setSelectionRange(int start, int end, String direction);
public abstract void setSelectionRange(int start, int end, String direction);
void setSelectionRange(int start, int end);
public abstract void setSelectionRange(int start, int end);
}

View File

@ -17,10 +17,10 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
public interface HTMLTitleElement extends HTMLElement {
public abstract class HTMLTitleElement extends HTMLElement {
@JSProperty
String getText();
public abstract String getText();
@JSProperty
void setText(String text);
public abstract void setText(String text);
}

View File

@ -17,33 +17,29 @@ package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
/**
*
* @author Junji Takakura
*/
public interface HTMLVideoElement extends HTMLMediaElement {
public abstract class HTMLVideoElement extends HTMLMediaElement {
@JSProperty
int getWidth();
public abstract int getWidth();
@JSProperty
int getHeight();
public abstract int getHeight();
@JSProperty
void setWidth(int width);
public abstract void setWidth(int width);
@JSProperty
void setHeight(int height);
public abstract void setHeight(int height);
@JSProperty
int getVideoWidth();
public abstract int getVideoWidth();
@JSProperty
int getVideoHeight();
public abstract int getVideoHeight();
@JSProperty
String getPoster();
public abstract String getPoster();
@JSProperty
void setPoster(String poster);
public abstract void setPoster(String poster);
}

View File

@ -16,6 +16,7 @@
package org.teavm.jso.dom.xml;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSClass;
import org.teavm.jso.JSObject;
import org.teavm.jso.dom.html.HTMLDocument;
@ -23,9 +24,13 @@ import org.teavm.jso.dom.html.HTMLDocument;
* The DOMParser interface provides the ability to parse XML or HTML source code from
* a string into a DOM {@link Document}.
*/
public abstract class DOMParser implements JSObject {
@JSClass
public class DOMParser implements JSObject {
public DOMParser() {
}
@JSBody(script = "return new DOMParser();")
@Deprecated
public static native DOMParser create();
/**
@ -51,6 +56,6 @@ public abstract class DOMParser implements JSObject {
* application/xml, application/xhtml+xml, image/svg+xml
* @return Newly created {@link Document} or {@link HTMLDocument}
*/
public abstract Document parseFromString(String s, String mimeType);
public native Document parseFromString(String s, String mimeType);
}

View File

@ -16,32 +16,21 @@
package org.teavm.jso.dom.xml;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSClass;
import org.teavm.jso.JSObject;
/**
* The XMLSerializer interface provides the ability to construct an XML string
* representing a DOM tree.
*/
public abstract class XMLSerializer implements JSObject {
@JSClass
public class XMLSerializer implements JSObject {
public XMLSerializer() {
}
@JSBody(script = "return new XMLSerializer();")
@Deprecated
public static native XMLSerializer create();
/**
* Constructs a string representing the specified DOM tree in XML form.
*
* @param rootNode The Node to use as the root of the DOM tree or subtree for
* which to construct an XML representation. The root node itself must be
* either a {@link Node} or {@link Attr} object.
* @return A DOMString containing the XML representation of the specified DOM
* tree.
* @throws TypeError The specified rootNode is not a compatible node type. The
* root node must be either Node or Attr.
* @throws InvalidStateError The tree could not be successfully serialized,
* probably due to issues with the content's compatibility with XML
* serialization.
* @throws SyntaxError A serialization of HTML was requested but could not
* succeed due to the content not being well-formed.
*/
public abstract String serializeToString(Node rootNode);
public native String serializeToString(Node rootNode);
}