com.google.code.gson
gson
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TObject.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TObject.java
index 55cb5bd76..bb4380354 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TObject.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TObject.java
@@ -15,11 +15,11 @@
*/
package org.teavm.classlib.java.lang;
-import org.teavm.dom.browser.TimerHandler;
import org.teavm.javascript.spi.Async;
import org.teavm.javascript.spi.Rename;
import org.teavm.javascript.spi.Superclass;
import org.teavm.javascript.spi.Sync;
+import org.teavm.jso.browser.TimerHandler;
import org.teavm.platform.Platform;
import org.teavm.platform.PlatformQueue;
import org.teavm.platform.PlatformRunnable;
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java
index 7d3c5c31d..9904e0304 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java
@@ -15,9 +15,7 @@
*/
package org.teavm.classlib.java.lang;
-import org.teavm.dom.browser.Window;
import org.teavm.javascript.spi.Async;
-import org.teavm.jso.JS;
import org.teavm.platform.Platform;
import org.teavm.platform.PlatformRunnable;
import org.teavm.platform.async.AsyncCallback;
@@ -27,7 +25,6 @@ import org.teavm.platform.async.AsyncCallback;
* @author Alexey Andreev
*/
public class TThread extends TObject implements TRunnable {
- private static Window window = (Window) JS.getGlobal();
private static TThread mainThread = new TThread(TString.wrap("main"));
private static TThread currentThread = mainThread;
private static long nextId = 1;
diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TTimer.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TTimer.java
index 06da728ae..aeb24a736 100644
--- a/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TTimer.java
+++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/util/TTimer.java
@@ -18,9 +18,8 @@ package org.teavm.classlib.java.util;
import org.teavm.classlib.java.lang.TIllegalStateException;
import org.teavm.classlib.java.lang.TObject;
import org.teavm.classlib.java.lang.TString;
-import org.teavm.dom.browser.TimerHandler;
-import org.teavm.dom.browser.Window;
-import org.teavm.jso.JS;
+import org.teavm.jso.browser.TimerHandler;
+import org.teavm.jso.browser.Window;
/**
*
@@ -51,19 +50,13 @@ public class TTimer extends TObject {
throw new TIllegalStateException();
}
task.timer = this;
- task.nativeTimerId = ((Window) JS.getGlobal()).setTimeout(new TimerHandler() {
- @Override
- public void onTimer() {
- new Thread() {
- @Override
- public void run() {
- if (cancelled || task.timer == null) {
- return;
- }
- TTimerTask.performOnce(task);
- }
- }.start();
- }
+ task.nativeTimerId = Window.setTimeout(() -> {
+ new Thread(() -> {
+ if (cancelled || task.timer == null) {
+ return;
+ }
+ TTimerTask.performOnce(task);
+ }).start();
}, (int) delay);
}
@@ -72,24 +65,20 @@ public class TTimer extends TObject {
throw new TIllegalStateException();
}
task.timer = this;
- task.nativeTimerId = ((Window) JS.getGlobal()).setTimeout(new TimerHandler() {
- @Override
- public void onTimer() {
- final TimerHandler self = this;
- new Thread() {
- @Override
- public void run() {
- if (cancelled || task.timer == null) {
- return;
- }
- task.nativeTimerId = ((Window) JS.getGlobal()).setTimeout(self, (int) period);
- TTimerTask.performOnce(task);
- if (!cancelled) {
- task.timer = TTimer.this;
- }
+ TimerHandler handler = new TimerHandler() {
+ @Override public void onTimer() {
+ new Thread(() -> {
+ if (cancelled || task.timer == null) {
+ return;
}
- }.start();
+ task.nativeTimerId = Window.setTimeout(this, (int) period);
+ TTimerTask.performOnce(task);
+ if (!cancelled) {
+ task.timer = TTimer.this;
+ }
+ }).start();
}
- }, (int) delay);
+ };
+ task.nativeTimerId = Window.setTimeout(handler, (int) delay);
}
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/ajax/XMLHttpRequest.java b/teavm-dom/src/main/java/org/teavm/dom/ajax/XMLHttpRequest.java
deleted file mode 100644
index 03d18674f..000000000
--- a/teavm-dom/src/main/java/org/teavm/dom/ajax/XMLHttpRequest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2014 Alexey Andreev.
- *
- * 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.dom.ajax;
-
-import org.teavm.dom.core.Document;
-import org.teavm.jso.JSObject;
-import org.teavm.jso.JSProperty;
-
-/**
- *
- * @author Alexey Andreev
- */
-public interface XMLHttpRequest extends JSObject {
- int UNSET = 0;
-
- int OPENED = 1;
-
- int HEADERS_RECEIVED = 2;
-
- int LOADING = 3;
-
- int DONE = 4;
-
- void open(String method, String url);
-
- void open(String method, String url, boolean async);
-
- void open(String method, String url, boolean async, String user);
-
- void open(String method, String url, boolean async, String user, String password);
-
- void send();
-
- void send(String data);
-
- void setRequestHeader(String name, String value);
-
- String getAllResponseHeaders();
-
- String getResponseHeader(String name);
-
- @JSProperty("onreadystatechange")
- void setOnReadyStateChange(ReadyStateChangeHandler handler);
-
- void overrideMimeType(String mimeType);
-
- @JSProperty
- int getReadyState();
-
- @JSProperty
- String getResponseText();
-
- @JSProperty
- Document getResponseXML();
-
- @JSProperty
- JSObject getResponse();
-
- @JSProperty
- int getStatus();
-
- @JSProperty
- String getStatusText();
-
- @JSProperty
- void setResponseType(String type);
-
- @JSProperty
- String getResponseType();
-}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/browser/Window.java b/teavm-dom/src/main/java/org/teavm/dom/browser/Window.java
deleted file mode 100644
index 8cdd5b4f2..000000000
--- a/teavm-dom/src/main/java/org/teavm/dom/browser/Window.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2014 Alexey Andreev.
- *
- * 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.dom.browser;
-
-import org.teavm.dom.ajax.XMLHttpRequest;
-import org.teavm.dom.events.EventTarget;
-import org.teavm.dom.html.HTMLDocument;
-import org.teavm.dom.json.JSON;
-import org.teavm.dom.typedarrays.TypedArrayFactory;
-import org.teavm.jso.JSConstructor;
-import org.teavm.jso.JSObject;
-import org.teavm.jso.JSProperty;
-
-/**
- *
- * @author Alexey Andreev
- */
-public interface Window extends JSObject, EventTarget, StorageProvider, TypedArrayFactory {
- @JSProperty
- HTMLDocument getDocument();
-
- @JSProperty
- Screen getScreen();
-
- void alert(JSObject message);
-
- void alert(String message);
-
- int setTimeout(TimerHandler handler, int delay);
-
- int setTimeout(TimerHandler handler, double delay);
-
- void clearTimeout(int timeoutId);
-
- int setInterval(TimerHandler handler, int delay);
-
- int setInterval(TimerHandler handler, double delay);
-
- void clearInterval(int timeoutId);
-
- @JSProperty("JSON")
- JSON getJSON();
-
- @JSConstructor("XMLHttpRequest")
- XMLHttpRequest createXMLHttpRequest();
-}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/TypedArrayFactory.java b/teavm-dom/src/main/java/org/teavm/dom/typedarrays/TypedArrayFactory.java
deleted file mode 100644
index 8f69c868c..000000000
--- a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/TypedArrayFactory.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2015 Alexey Andreev.
- *
- * 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.dom.typedarrays;
-
-import org.teavm.jso.JSConstructor;
-import org.teavm.jso.JSObject;
-
-/**
- *
- * @author Alexey Andreev
- */
-public interface TypedArrayFactory extends JSObject {
- @JSConstructor("ArrayBuffer")
- ArrayBuffer createArrayBuffer(int length);
-
- @JSConstructor("Int8Array")
- Int8Array createInt8Array(int length);
-
- @JSConstructor("Int8Array")
- Int8Array createInt8Array(ArrayBuffer buffer);
-
- @JSConstructor("Int8Array")
- Int8Array createInt8Array(ArrayBuffer buffer, int offset, int length);
-
- @JSConstructor("Uint8Array")
- Uint8Array createUint8Array(int length);
-
- @JSConstructor("Uint8Array")
- Uint8Array createUint8Array(ArrayBuffer buffer);
-
- @JSConstructor("Uint8Array")
- Uint8Array createUint8Array(ArrayBuffer buffer, int offset, int length);
-
- @JSConstructor("Uint8ClampedArray")
- Uint8ClampedArray createUint8ClampedArray(int length);
-
- @JSConstructor("Uint8ClampedArray")
- Uint8ClampedArray createUint8ClampedArray(ArrayBuffer buffer);
-
- @JSConstructor("Uint8ClampedArray")
- Uint8ClampedArray createUintClamped8Array(ArrayBuffer buffer, int offset, int length);
-
- @JSConstructor("Int16Array")
- Int16Array createInt16Array(int length);
-
- @JSConstructor("Int16Array")
- Int16Array createInt16Array(ArrayBuffer buffer);
-
- @JSConstructor("Int16Array")
- Int16Array createInt16Array(ArrayBuffer buffer, int offset, int length);
-
- @JSConstructor("Uint16Array")
- Uint16Array createUint16Array(int length);
-
- @JSConstructor("Uint16Array")
- Uint16Array createUint16Array(ArrayBuffer buffer);
-
- @JSConstructor("Uint16Array")
- Uint16Array createUint16Array(ArrayBuffer buffer, int offset, int length);
-
- @JSConstructor("Int32Array")
- Int32Array createInt32Array(int length);
-
- @JSConstructor("Int32Array")
- Int32Array createInt32Array(ArrayBuffer buffer);
-
- @JSConstructor("Int32Array")
- Int32Array createInt32Array(ArrayBuffer buffer, int offset, int length);
-
- @JSConstructor("Float32Array")
- Float32Array createFloat32Array(int length);
-
- @JSConstructor("Float32Array")
- Float32Array createFloat32Array(ArrayBuffer buffer);
-
- @JSConstructor("Float32Array")
- Float32Array createFloat32Array(ArrayBuffer buffer, int offset, int length);
-
- @JSConstructor("Float64Array")
- Float64Array createFloat64Array(int length);
-
- @JSConstructor("Float64Array")
- Float64Array createFloat64Array(ArrayBuffer buffer);
-
- @JSConstructor("Float64Array")
- Float64Array createFloat64Array(ArrayBuffer buffer, int offset, int length);
-}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Uint8ClampedArray.java b/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Uint8ClampedArray.java
deleted file mode 100644
index 60dc2a426..000000000
--- a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Uint8ClampedArray.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2014 Alexey Andreev.
- *
- * 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.dom.typedarrays;
-
-import org.teavm.jso.JSIndexer;
-
-/**
- *
- * @author Alexey Andreev
- */
-public interface Uint8ClampedArray extends ArrayBufferView {
- @JSIndexer
- short get(int index);
-
- @JSIndexer
- void set(int index, int value);
-}
diff --git a/teavm-jso-impl/.gitignore b/teavm-jso-impl/.gitignore
new file mode 100644
index 000000000..8bd3a0588
--- /dev/null
+++ b/teavm-jso-impl/.gitignore
@@ -0,0 +1,4 @@
+/target/
+/.settings/
+/.classpath
+/.project
diff --git a/teavm-jso-impl/pom.xml b/teavm-jso-impl/pom.xml
new file mode 100644
index 000000000..cfc991f5f
--- /dev/null
+++ b/teavm-jso-impl/pom.xml
@@ -0,0 +1,67 @@
+
+
+ 4.0.0
+
+
+ org.teavm
+ teavm
+ 0.4.0-SNAPSHOT
+
+ teavm-jso-impl
+
+ TeaVM JavaScript objects - implementation
+ An implementation of JSO
+
+
+
+ org.teavm
+ teavm-core
+ ${project.version}
+
+
+ org.teavm
+ teavm-jso
+ ${project.version}
+
+
+ junit
+ junit
+ test
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
+ ../checkstyle.xml
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+
+
\ No newline at end of file
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/FunctorImpl.java b/teavm-jso-impl/src/main/java/org/teavm/jso/plugin/FunctorImpl.java
similarity index 100%
rename from teavm-jso/src/main/java/org/teavm/jso/plugin/FunctorImpl.java
rename to teavm-jso-impl/src/main/java/org/teavm/jso/plugin/FunctorImpl.java
diff --git a/teavm-jso/src/main/java/org/teavm/jso/JS.java b/teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JS.java
similarity index 98%
rename from teavm-jso/src/main/java/org/teavm/jso/JS.java
rename to teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JS.java
index 83eeb19f4..9d1c2026b 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/JS.java
+++ b/teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JS.java
@@ -13,21 +13,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.jso;
+package org.teavm.jso.plugin;
import java.lang.reflect.Array;
import java.util.Iterator;
import org.teavm.dependency.PluggableDependency;
import org.teavm.javascript.spi.GeneratedBy;
import org.teavm.javascript.spi.InjectedBy;
-import org.teavm.jso.plugin.JSNativeGenerator;
+import org.teavm.jso.JSBody;
+import org.teavm.jso.JSObject;
+import org.teavm.jso.JSType;
+import org.teavm.jso.core.JSArray;
+import org.teavm.jso.core.JSArrayReader;
+import org.teavm.jso.core.JSBoolean;
+import org.teavm.jso.core.JSNumber;
+import org.teavm.jso.core.JSString;
/**
* Container of static methods to manipulate over {@link JSObject}s.
*
* @author Alexey Andreev
*/
-public final class JS {
+final class JS {
private JS() {
}
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSBodyGenerator.java b/teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JSBodyGenerator.java
similarity index 100%
rename from teavm-jso/src/main/java/org/teavm/jso/plugin/JSBodyGenerator.java
rename to teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JSBodyGenerator.java
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSBodyImpl.java b/teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JSBodyImpl.java
similarity index 100%
rename from teavm-jso/src/main/java/org/teavm/jso/plugin/JSBodyImpl.java
rename to teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JSBodyImpl.java
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSNativeGenerator.java b/teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JSNativeGenerator.java
similarity index 99%
rename from teavm-jso/src/main/java/org/teavm/jso/plugin/JSNativeGenerator.java
rename to teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JSNativeGenerator.java
index f9ba0dcc5..85c4b123f 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSNativeGenerator.java
+++ b/teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JSNativeGenerator.java
@@ -26,7 +26,6 @@ import org.teavm.javascript.spi.Generator;
import org.teavm.javascript.spi.GeneratorContext;
import org.teavm.javascript.spi.Injector;
import org.teavm.javascript.spi.InjectorContext;
-import org.teavm.jso.JS;
import org.teavm.model.CallLocation;
import org.teavm.model.ClassReader;
import org.teavm.model.MethodReader;
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSOAliasRenderer.java b/teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JSOAliasRenderer.java
similarity index 100%
rename from teavm-jso/src/main/java/org/teavm/jso/plugin/JSOAliasRenderer.java
rename to teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JSOAliasRenderer.java
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSODependencyListener.java b/teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JSODependencyListener.java
similarity index 100%
rename from teavm-jso/src/main/java/org/teavm/jso/plugin/JSODependencyListener.java
rename to teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JSODependencyListener.java
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSOPlugin.java b/teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JSOPlugin.java
similarity index 100%
rename from teavm-jso/src/main/java/org/teavm/jso/plugin/JSOPlugin.java
rename to teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JSOPlugin.java
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JSObjectClassTransformer.java b/teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JSObjectClassTransformer.java
similarity index 100%
rename from teavm-jso/src/main/java/org/teavm/jso/plugin/JSObjectClassTransformer.java
rename to teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JSObjectClassTransformer.java
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java b/teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java
similarity index 99%
rename from teavm-jso/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java
rename to teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java
index 85d3a3302..7505162f8 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java
+++ b/teavm-jso-impl/src/main/java/org/teavm/jso/plugin/JavascriptNativeProcessor.java
@@ -25,19 +25,14 @@ import java.util.Set;
import org.teavm.diagnostics.Diagnostics;
import org.teavm.javascript.spi.GeneratedBy;
import org.teavm.javascript.spi.Sync;
-import org.teavm.jso.JS;
-import org.teavm.jso.JSArray;
import org.teavm.jso.JSBody;
-import org.teavm.jso.JSBooleanArray;
import org.teavm.jso.JSConstructor;
-import org.teavm.jso.JSDoubleArray;
import org.teavm.jso.JSFunctor;
import org.teavm.jso.JSIndexer;
-import org.teavm.jso.JSIntArray;
import org.teavm.jso.JSMethod;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
-import org.teavm.jso.JSStringArray;
+import org.teavm.jso.core.JSArray;
import org.teavm.model.AccessLevel;
import org.teavm.model.AnnotationHolder;
import org.teavm.model.AnnotationReader;
diff --git a/teavm-jso/src/main/java/org/teavm/jso/plugin/NativeJavascriptClassRepository.java b/teavm-jso-impl/src/main/java/org/teavm/jso/plugin/NativeJavascriptClassRepository.java
similarity index 100%
rename from teavm-jso/src/main/java/org/teavm/jso/plugin/NativeJavascriptClassRepository.java
rename to teavm-jso-impl/src/main/java/org/teavm/jso/plugin/NativeJavascriptClassRepository.java
diff --git a/teavm-jso/pom.xml b/teavm-jso/pom.xml
index aaffeb282..c3dcfce2b 100644
--- a/teavm-jso/pom.xml
+++ b/teavm-jso/pom.xml
@@ -28,12 +28,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
A library that adds convenient interface for interaction between TeaVM and JavaScript code
-
- org.teavm
- teavm-core
- ${project.version}
- true
-
junit
junit
diff --git a/teavm-jso/src/main/java/org/teavm/jso/JSObject.java b/teavm-jso/src/main/java/org/teavm/jso/JSObject.java
index 906de29c6..66d0841f4 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/JSObject.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/JSObject.java
@@ -20,4 +20,8 @@ package org.teavm.jso;
* @author Alexey Andreev
*/
public interface JSObject {
+ @SuppressWarnings("unchecked")
+ default T cast() {
+ return (T) this;
+ }
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/ajax/ReadyStateChangeHandler.java b/teavm-jso/src/main/java/org/teavm/jso/ajax/ReadyStateChangeHandler.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/ajax/ReadyStateChangeHandler.java
rename to teavm-jso/src/main/java/org/teavm/jso/ajax/ReadyStateChangeHandler.java
index 6ad6e3074..ec362e8cf 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/ajax/ReadyStateChangeHandler.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/ajax/ReadyStateChangeHandler.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.ajax;
+package org.teavm.jso.ajax;
import org.teavm.jso.JSFunctor;
diff --git a/teavm-jso/src/main/java/org/teavm/jso/ajax/XMLHttpRequest.java b/teavm-jso/src/main/java/org/teavm/jso/ajax/XMLHttpRequest.java
new file mode 100644
index 000000000..5ed781fc6
--- /dev/null
+++ b/teavm-jso/src/main/java/org/teavm/jso/ajax/XMLHttpRequest.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2014 Alexey Andreev.
+ *
+ * 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.ajax;
+
+import org.teavm.jso.JSBody;
+import org.teavm.jso.JSObject;
+import org.teavm.jso.JSProperty;
+import org.teavm.jso.dom.xml.Document;
+
+/**
+ *
+ * @author Alexey Andreev
+ */
+public abstract class XMLHttpRequest implements JSObject {
+ public static final int UNSET = 0;
+
+ public static final int OPENED = 1;
+
+ public static final int HEADERS_RECEIVED = 2;
+
+ public static final int LOADING = 3;
+
+ public static final int DONE = 4;
+
+ public abstract void open(String method, String url);
+
+ public abstract void open(String method, String url, boolean async);
+
+ public abstract void open(String method, String url, boolean async, String user);
+
+ public abstract void open(String method, String url, boolean async, String user, String password);
+
+ public abstract void send();
+
+ public abstract void send(String data);
+
+ public abstract void setRequestHeader(String name, String value);
+
+ public abstract String getAllResponseHeaders();
+
+ public abstract String getResponseHeader(String name);
+
+ @JSProperty("onreadystatechange")
+ public abstract void setOnReadyStateChange(ReadyStateChangeHandler handler);
+
+ public abstract void overrideMimeType(String mimeType);
+
+ @JSProperty
+ public abstract int getReadyState();
+
+ @JSProperty
+ public abstract String getResponseText();
+
+ @JSProperty
+ public abstract Document getResponseXML();
+
+ @JSProperty
+ public abstract JSObject getResponse();
+
+ @JSProperty
+ public abstract int getStatus();
+
+ @JSProperty
+ public abstract String getStatusText();
+
+ @JSProperty
+ public abstract void setResponseType(String type);
+
+ @JSProperty
+ public abstract String getResponseType();
+
+ @JSBody(params = {}, script = "return new XMLHttpRequest();")
+ public static native XMLHttpRequest create();
+}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/browser/Screen.java b/teavm-jso/src/main/java/org/teavm/jso/browser/Screen.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/browser/Screen.java
rename to teavm-jso/src/main/java/org/teavm/jso/browser/Screen.java
index 85fa32a94..904fe80b1 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/browser/Screen.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/browser/Screen.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.browser;
+package org.teavm.jso.browser;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/browser/Storage.java b/teavm-jso/src/main/java/org/teavm/jso/browser/Storage.java
similarity index 67%
rename from teavm-dom/src/main/java/org/teavm/dom/browser/Storage.java
rename to teavm-jso/src/main/java/org/teavm/jso/browser/Storage.java
index 375129116..2c66f1abe 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/browser/Storage.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/browser/Storage.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.browser;
+package org.teavm.jso.browser;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
@@ -22,18 +22,17 @@ import org.teavm.jso.JSProperty;
*
* @author Junji Takakura
*/
-public interface Storage extends JSObject {
-
+public abstract class Storage implements JSObject {
@JSProperty
- int getLength();
+ public abstract int getLength();
- String key(int index);
+ public abstract String key(int index);
- String getItem(String key);
+ public abstract String getItem(String key);
- void setItem(String key, String value);
+ public abstract void setItem(String key, String value);
- void removeItem(String key);
+ public abstract void removeItem(String key);
- void clear();
+ public abstract void clear();
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/browser/StorageProvider.java b/teavm-jso/src/main/java/org/teavm/jso/browser/StorageProvider.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/browser/StorageProvider.java
rename to teavm-jso/src/main/java/org/teavm/jso/browser/StorageProvider.java
index cedc9c3a6..abc0e1a7b 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/browser/StorageProvider.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/browser/StorageProvider.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.browser;
+package org.teavm.jso.browser;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/browser/TimerHandler.java b/teavm-jso/src/main/java/org/teavm/jso/browser/TimerHandler.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/browser/TimerHandler.java
rename to teavm-jso/src/main/java/org/teavm/jso/browser/TimerHandler.java
index a381b12ed..f7bd5f70d 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/browser/TimerHandler.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/browser/TimerHandler.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.browser;
+package org.teavm.jso.browser;
import org.teavm.jso.JSFunctor;
import org.teavm.jso.JSObject;
diff --git a/teavm-jso/src/main/java/org/teavm/jso/browser/Window.java b/teavm-jso/src/main/java/org/teavm/jso/browser/Window.java
new file mode 100644
index 000000000..a111a998f
--- /dev/null
+++ b/teavm-jso/src/main/java/org/teavm/jso/browser/Window.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2014 Alexey Andreev.
+ *
+ * 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.browser;
+
+import org.teavm.jso.JSBody;
+import org.teavm.jso.JSObject;
+import org.teavm.jso.JSProperty;
+import org.teavm.jso.dom.events.EventTarget;
+import org.teavm.jso.dom.html.HTMLDocument;
+
+/**
+ *
+ * @author Alexey Andreev
+ */
+public abstract class Window implements JSObject, EventTarget, StorageProvider {
+ private Window() {
+ }
+
+ @JSProperty
+ public abstract HTMLDocument getDocument();
+
+ @JSProperty
+ public abstract Screen getScreen();
+
+ @JSBody(params = "message", script = "alert(message);")
+ public static native void alert(JSObject message);
+
+ @JSBody(params = "message", script = "alert(message);")
+ public static native void alert(String message);
+
+ @JSBody(params = { "handler", "delay" }, script = "return setTimeout(handler, delay);")
+ public static native int setTimeout(TimerHandler handler, int delay);
+
+ @JSBody(params = { "handler", "delay" }, script = "return setTimeout(handler, delay);")
+ public static native int setTimeout(TimerHandler handler, double delay);
+
+ @JSBody(params = { "timeoutId" }, script = "clearTimeout(timeoutId);")
+ public abstract void clearTimeout(int timeoutId);
+
+ @JSBody(params = { "handler", "delay" }, script = "return setInverval(handler, delay);")
+ public abstract int setInterval(TimerHandler handler, int delay);
+
+ @JSBody(params = { "handler", "delay" }, script = "return setInverval(handler, delay);")
+ public abstract int setInterval(TimerHandler handler, double delay);
+
+ @JSBody(params = { "timeoutId" }, script = "clearInverval(timeoutId);")
+ public abstract void clearInterval(int timeoutId);
+
+ @JSBody(params = {}, script = "return window;")
+ public static native Window current();
+}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasGradient.java b/teavm-jso/src/main/java/org/teavm/jso/canvas/CanvasGradient.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasGradient.java
rename to teavm-jso/src/main/java/org/teavm/jso/canvas/CanvasGradient.java
index 94d98933a..8e6bb8d18 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasGradient.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/canvas/CanvasGradient.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.canvas;
+package org.teavm.jso.canvas;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasImageSource.java b/teavm-jso/src/main/java/org/teavm/jso/canvas/CanvasImageSource.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasImageSource.java
rename to teavm-jso/src/main/java/org/teavm/jso/canvas/CanvasImageSource.java
index 8d0722827..abaf47073 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasImageSource.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/canvas/CanvasImageSource.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.canvas;
+package org.teavm.jso.canvas;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasPattern.java b/teavm-jso/src/main/java/org/teavm/jso/canvas/CanvasPattern.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasPattern.java
rename to teavm-jso/src/main/java/org/teavm/jso/canvas/CanvasPattern.java
index 0e0a3aebe..af6e7651d 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasPattern.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/canvas/CanvasPattern.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.canvas;
+package org.teavm.jso.canvas;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasRenderingContext2D.java b/teavm-jso/src/main/java/org/teavm/jso/canvas/CanvasRenderingContext2D.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasRenderingContext2D.java
rename to teavm-jso/src/main/java/org/teavm/jso/canvas/CanvasRenderingContext2D.java
index 8b07bfa81..dbbc5212c 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/canvas/CanvasRenderingContext2D.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/canvas/CanvasRenderingContext2D.java
@@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.canvas;
+package org.teavm.jso.canvas;
-import org.teavm.dom.core.Element;
-import org.teavm.dom.html.HTMLCanvasElement;
-import org.teavm.jso.JSArray;
-import org.teavm.jso.JSArrayReader;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.core.JSArray;
+import org.teavm.jso.core.JSArrayReader;
+import org.teavm.jso.dom.html.HTMLCanvasElement;
+import org.teavm.jso.dom.xml.Element;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/canvas/ImageData.java b/teavm-jso/src/main/java/org/teavm/jso/canvas/ImageData.java
similarity index 92%
rename from teavm-dom/src/main/java/org/teavm/dom/canvas/ImageData.java
rename to teavm-jso/src/main/java/org/teavm/jso/canvas/ImageData.java
index d9ba34dd5..0bc9901c4 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/canvas/ImageData.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/canvas/ImageData.java
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.canvas;
+package org.teavm.jso.canvas;
-import org.teavm.dom.typedarrays.Uint8ClampedArray;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.typedarrays.Uint8ClampedArray;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/canvas/TextMetrics.java b/teavm-jso/src/main/java/org/teavm/jso/canvas/TextMetrics.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/canvas/TextMetrics.java
rename to teavm-jso/src/main/java/org/teavm/jso/canvas/TextMetrics.java
index 33932259f..712332283 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/canvas/TextMetrics.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/canvas/TextMetrics.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.canvas;
+package org.teavm.jso.canvas;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-jso/src/main/java/org/teavm/jso/JSArray.java b/teavm-jso/src/main/java/org/teavm/jso/core/JSArray.java
similarity index 95%
rename from teavm-jso/src/main/java/org/teavm/jso/JSArray.java
rename to teavm-jso/src/main/java/org/teavm/jso/core/JSArray.java
index e577fe920..b711d4815 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/JSArray.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/core/JSArray.java
@@ -13,7 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.jso;
+package org.teavm.jso.core;
+
+import org.teavm.jso.JSBody;
+import org.teavm.jso.JSIndexer;
+import org.teavm.jso.JSObject;
/**
*
diff --git a/teavm-jso/src/main/java/org/teavm/jso/JSArrayReader.java b/teavm-jso/src/main/java/org/teavm/jso/core/JSArrayReader.java
similarity index 86%
rename from teavm-jso/src/main/java/org/teavm/jso/JSArrayReader.java
rename to teavm-jso/src/main/java/org/teavm/jso/core/JSArrayReader.java
index 536d40452..15652d55d 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/JSArrayReader.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/core/JSArrayReader.java
@@ -13,7 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.jso;
+package org.teavm.jso.core;
+
+import org.teavm.jso.JSIndexer;
+import org.teavm.jso.JSObject;
+import org.teavm.jso.JSProperty;
/**
*
diff --git a/teavm-jso/src/main/java/org/teavm/jso/JSBoolean.java b/teavm-jso/src/main/java/org/teavm/jso/core/JSBoolean.java
similarity index 92%
rename from teavm-jso/src/main/java/org/teavm/jso/JSBoolean.java
rename to teavm-jso/src/main/java/org/teavm/jso/core/JSBoolean.java
index f4af15067..6cd633512 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/JSBoolean.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/core/JSBoolean.java
@@ -13,7 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.jso;
+package org.teavm.jso.core;
+
+import org.teavm.jso.JSBody;
+import org.teavm.jso.JSObject;
/**
*
diff --git a/teavm-jso/src/main/java/org/teavm/jso/JSFunction.java b/teavm-jso/src/main/java/org/teavm/jso/core/JSFunction.java
similarity index 94%
rename from teavm-jso/src/main/java/org/teavm/jso/JSFunction.java
rename to teavm-jso/src/main/java/org/teavm/jso/core/JSFunction.java
index 5374025a1..00b7f1cda 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/JSFunction.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/core/JSFunction.java
@@ -13,7 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.jso;
+package org.teavm.jso.core;
+
+import org.teavm.jso.JSObject;
+import org.teavm.jso.JSProperty;
/**
*
diff --git a/teavm-jso/src/main/java/org/teavm/jso/JSNumber.java b/teavm-jso/src/main/java/org/teavm/jso/core/JSNumber.java
similarity index 96%
rename from teavm-jso/src/main/java/org/teavm/jso/JSNumber.java
rename to teavm-jso/src/main/java/org/teavm/jso/core/JSNumber.java
index 8638d876e..faeee26d6 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/JSNumber.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/core/JSNumber.java
@@ -13,7 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.jso;
+package org.teavm.jso.core;
+
+import org.teavm.jso.JSBody;
+import org.teavm.jso.JSObject;
/**
*
diff --git a/teavm-jso/src/main/java/org/teavm/jso/JSSortFunction.java b/teavm-jso/src/main/java/org/teavm/jso/core/JSSortFunction.java
similarity index 89%
rename from teavm-jso/src/main/java/org/teavm/jso/JSSortFunction.java
rename to teavm-jso/src/main/java/org/teavm/jso/core/JSSortFunction.java
index 69bcec557..816d3fd55 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/JSSortFunction.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/core/JSSortFunction.java
@@ -13,7 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.jso;
+package org.teavm.jso.core;
+
+import org.teavm.jso.JSFunctor;
+import org.teavm.jso.JSObject;
/**
*
diff --git a/teavm-jso/src/main/java/org/teavm/jso/JSString.java b/teavm-jso/src/main/java/org/teavm/jso/core/JSString.java
similarity index 89%
rename from teavm-jso/src/main/java/org/teavm/jso/JSString.java
rename to teavm-jso/src/main/java/org/teavm/jso/core/JSString.java
index 195a9d617..1e240be24 100644
--- a/teavm-jso/src/main/java/org/teavm/jso/JSString.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/core/JSString.java
@@ -13,7 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.jso;
+package org.teavm.jso.core;
+
+import org.teavm.jso.JSBody;
+import org.teavm.jso.JSObject;
+import org.teavm.jso.JSProperty;
/**
*
@@ -68,4 +72,7 @@ public abstract class JSString implements JSObject {
public abstract JSString substring(int start);
public abstract JSString substring(int start, int end);
+
+ @JSBody(params = "obj", script = "return typeof this === 'string';")
+ public static native boolean isInstance(JSObject obj);
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/css/CSSStyleDeclaration.java b/teavm-jso/src/main/java/org/teavm/jso/dom/css/CSSStyleDeclaration.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/css/CSSStyleDeclaration.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/css/CSSStyleDeclaration.java
index 147f70ba6..fce0945d4 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/css/CSSStyleDeclaration.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/css/CSSStyleDeclaration.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.css;
+package org.teavm.jso.dom.css;
import org.teavm.jso.JSIndexer;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/css/ElementCSSInlineStyle.java b/teavm-jso/src/main/java/org/teavm/jso/dom/css/ElementCSSInlineStyle.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/css/ElementCSSInlineStyle.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/css/ElementCSSInlineStyle.java
index d38b9e1cd..3421cb226 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/css/ElementCSSInlineStyle.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/css/ElementCSSInlineStyle.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.css;
+package org.teavm.jso.dom.css;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/events/DocumentEvent.java b/teavm-jso/src/main/java/org/teavm/jso/dom/events/DocumentEvent.java
similarity index 85%
rename from teavm-dom/src/main/java/org/teavm/dom/events/DocumentEvent.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/events/DocumentEvent.java
index f9a6a7887..13ce2a771 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/events/DocumentEvent.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/events/DocumentEvent.java
@@ -13,12 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.events;
+package org.teavm.jso.dom.events;
+
+import org.teavm.jso.JSObject;
/**
*
* @author Alexey Andreev
*/
-public interface DocumentEvent {
+public interface DocumentEvent extends JSObject {
Event createEvent(String eventType);
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/events/Event.java b/teavm-jso/src/main/java/org/teavm/jso/dom/events/Event.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/events/Event.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/events/Event.java
index 6bb5935f8..b8a211acc 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/events/Event.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/events/Event.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.events;
+package org.teavm.jso.dom.events;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/events/EventListener.java b/teavm-jso/src/main/java/org/teavm/jso/dom/events/EventListener.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/events/EventListener.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/events/EventListener.java
index 6dc21b923..3777a9f47 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/events/EventListener.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/events/EventListener.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.events;
+package org.teavm.jso.dom.events;
import org.teavm.jso.JSFunctor;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/events/EventTarget.java b/teavm-jso/src/main/java/org/teavm/jso/dom/events/EventTarget.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/events/EventTarget.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/events/EventTarget.java
index e30a7cdad..70727da45 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/events/EventTarget.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/events/EventTarget.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.events;
+package org.teavm.jso.dom.events;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/events/KeyboardEvent.java b/teavm-jso/src/main/java/org/teavm/jso/dom/events/KeyboardEvent.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/events/KeyboardEvent.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/events/KeyboardEvent.java
index eb8a65624..98cb70a8e 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/events/KeyboardEvent.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/events/KeyboardEvent.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.events;
+package org.teavm.jso.dom.events;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/events/MouseEvent.java b/teavm-jso/src/main/java/org/teavm/jso/dom/events/MouseEvent.java
similarity index 98%
rename from teavm-dom/src/main/java/org/teavm/dom/events/MouseEvent.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/events/MouseEvent.java
index 50f51dd44..fcc6999b9 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/events/MouseEvent.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/events/MouseEvent.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.events;
+package org.teavm.jso.dom.events;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/events/StorageEvent.java b/teavm-jso/src/main/java/org/teavm/jso/dom/events/StorageEvent.java
similarity index 92%
rename from teavm-dom/src/main/java/org/teavm/dom/events/StorageEvent.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/events/StorageEvent.java
index 707761864..1967ff688 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/events/StorageEvent.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/events/StorageEvent.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.events;
+package org.teavm.jso.dom.events;
-import org.teavm.dom.browser.Storage;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.browser.Storage;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLAudioElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLAudioElement.java
similarity index 95%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLAudioElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLAudioElement.java
index e6007bef9..0d6ebd15e 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLAudioElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLAudioElement.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLBaseElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLBaseElement.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLBaseElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLBaseElement.java
index 3a0dd11c1..a0612c137 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLBaseElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLBaseElement.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLBodyElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLBodyElement.java
similarity index 91%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLBodyElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLBodyElement.java
index 2bc0a4b45..b12b1732d 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLBodyElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLBodyElement.java
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
-import org.teavm.dom.events.Event;
-import org.teavm.dom.events.EventListener;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.dom.events.Event;
+import org.teavm.jso.dom.events.EventListener;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLButtonElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLButtonElement.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLButtonElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLButtonElement.java
index 495ad674b..b4b2c52bf 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLButtonElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLButtonElement.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
import org.w3c.dom.html.HTMLFormElement;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLCanvasElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLCanvasElement.java
similarity index 93%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLCanvasElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLCanvasElement.java
index 237874049..afb94da23 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLCanvasElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLCanvasElement.java
@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
-import org.teavm.dom.canvas.CanvasImageSource;
import org.teavm.jso.JSMethod;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.canvas.CanvasImageSource;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLCollection.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLCollection.java
similarity index 87%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLCollection.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLCollection.java
index 0f21268ce..4b7db6940 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLCollection.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLCollection.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
-import org.teavm.dom.core.Element;
-import org.teavm.jso.JSArrayReader;
+import org.teavm.jso.core.JSArrayReader;
+import org.teavm.jso.dom.xml.Element;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLDocument.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLDocument.java
similarity index 90%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLDocument.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLDocument.java
index 08aeeb038..24b6e0e12 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLDocument.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLDocument.java
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
-import org.teavm.dom.core.Document;
-import org.teavm.dom.events.EventTarget;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.dom.events.EventTarget;
+import org.teavm.jso.dom.xml.Document;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLElement.java
similarity index 91%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLElement.java
index 50d3f1717..8bdac4d85 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLElement.java
@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
-import org.teavm.dom.core.Element;
-import org.teavm.dom.core.NodeList;
-import org.teavm.dom.css.ElementCSSInlineStyle;
-import org.teavm.dom.events.EventTarget;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.dom.css.ElementCSSInlineStyle;
+import org.teavm.jso.dom.events.EventTarget;
+import org.teavm.jso.dom.xml.Element;
+import org.teavm.jso.dom.xml.NodeList;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLHeadElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLHeadElement.java
similarity index 95%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLHeadElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLHeadElement.java
index e43b0db45..89429e3c4 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLHeadElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLHeadElement.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLHtmlElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLHtmlElement.java
similarity index 95%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLHtmlElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLHtmlElement.java
index 6ac010863..c463e3c75 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLHtmlElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLHtmlElement.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLImageElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLImageElement.java
similarity index 93%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLImageElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLImageElement.java
index cf2967719..f36a84dbd 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLImageElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLImageElement.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
-import org.teavm.dom.canvas.CanvasImageSource;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.canvas.CanvasImageSource;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLInputElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLInputElement.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLInputElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLInputElement.java
index 51555ccf3..73776b202 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLInputElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLInputElement.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLLinkElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLLinkElement.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLLinkElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLLinkElement.java
index 549b94d13..152326c38 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLLinkElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLLinkElement.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLMediaElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLMediaElement.java
similarity index 91%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLMediaElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLMediaElement.java
index f7825ad8d..a1ba21be1 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLMediaElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLMediaElement.java
@@ -13,24 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
import java.util.Date;
-import org.teavm.dom.media.AudioTrackList;
-import org.teavm.dom.media.MediaController;
-import org.teavm.dom.media.MediaError;
-import org.teavm.dom.media.TextTrack;
-import org.teavm.dom.media.TextTrackList;
-import org.teavm.dom.media.TimeRanges;
-import org.teavm.dom.media.VideoTrackList;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.media.AudioTrackList;
+import org.teavm.jso.media.MediaController;
+import org.teavm.jso.media.MediaError;
+import org.teavm.jso.media.TextTrack;
+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;
@@ -181,5 +180,4 @@ public interface HTMLMediaElement extends HTMLElement {
void load();
String canPlayType(String type);
-
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLMetaElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLMetaElement.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLMetaElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLMetaElement.java
index c17cae094..2326d0a49 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLMetaElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLMetaElement.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLOptionElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLOptionElement.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLOptionElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLOptionElement.java
index 00de6e971..d3e8c51c2 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLOptionElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLOptionElement.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLOptionsCollection.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLOptionsCollection.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLOptionsCollection.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLOptionsCollection.java
index e4ee1cc3c..e369ac72a 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLOptionsCollection.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLOptionsCollection.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
import org.teavm.jso.JSIndexer;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLSelectElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLSelectElement.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLSelectElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLSelectElement.java
index a359d8071..1a98ea8ea 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLSelectElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLSelectElement.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLSourceElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLSourceElement.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLSourceElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLSourceElement.java
index bb2124b36..0dd74d990 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLSourceElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLSourceElement.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLTitleElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLTitleElement.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLTitleElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLTitleElement.java
index cb6256be1..96c73bf46 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLTitleElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLTitleElement.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLVideoElement.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLVideoElement.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/html/HTMLVideoElement.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLVideoElement.java
index 53dbf1d94..b361ff8f1 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/HTMLVideoElement.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/HTMLVideoElement.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/html/TextRectangle.java b/teavm-jso/src/main/java/org/teavm/jso/dom/html/TextRectangle.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/html/TextRectangle.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/html/TextRectangle.java
index bec073257..5ee99422f 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/html/TextRectangle.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/html/TextRectangle.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.html;
+package org.teavm.jso.dom.html;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/Attr.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Attr.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/core/Attr.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/Attr.java
index f22f3ba5d..f40458cdd 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/Attr.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Attr.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/CDATASection.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/CDATASection.java
similarity index 95%
rename from teavm-dom/src/main/java/org/teavm/dom/core/CDATASection.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/CDATASection.java
index be999f2f3..17857bc7b 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/CDATASection.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/CDATASection.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/CharacterData.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/CharacterData.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/core/CharacterData.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/CharacterData.java
index ec86d201c..e494e3f9e 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/CharacterData.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/CharacterData.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/Comment.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Comment.java
similarity index 95%
rename from teavm-dom/src/main/java/org/teavm/dom/core/Comment.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/Comment.java
index 1750f7d77..6d4f3eb77 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/Comment.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Comment.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/DOMImplementation.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/DOMImplementation.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/core/DOMImplementation.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/DOMImplementation.java
index 0ecd0aa73..f36095d40 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/DOMImplementation.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/DOMImplementation.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/Document.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Document.java
similarity index 98%
rename from teavm-dom/src/main/java/org/teavm/dom/core/Document.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/Document.java
index 3b17ed08f..5408322f5 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/Document.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Document.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/DocumentFragment.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/DocumentFragment.java
similarity index 95%
rename from teavm-dom/src/main/java/org/teavm/dom/core/DocumentFragment.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/DocumentFragment.java
index 79841e067..1b6d598cc 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/DocumentFragment.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/DocumentFragment.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/DocumentType.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/DocumentType.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/core/DocumentType.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/DocumentType.java
index 792554a45..cd32e9eda 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/DocumentType.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/DocumentType.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/Element.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Element.java
similarity index 98%
rename from teavm-dom/src/main/java/org/teavm/dom/core/Element.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/Element.java
index d21f91f38..6fc224af6 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/Element.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Element.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/Entity.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Entity.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/core/Entity.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/Entity.java
index 8ff2bac3f..6ceea25fb 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/Entity.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Entity.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/EntityReference.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/EntityReference.java
similarity index 95%
rename from teavm-dom/src/main/java/org/teavm/dom/core/EntityReference.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/EntityReference.java
index c98cf518d..dfd57ad0d 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/EntityReference.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/EntityReference.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/NamedNodeMap.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/NamedNodeMap.java
similarity index 94%
rename from teavm-dom/src/main/java/org/teavm/dom/core/NamedNodeMap.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/NamedNodeMap.java
index 56318ec32..74a9c3385 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/NamedNodeMap.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/NamedNodeMap.java
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
-import org.teavm.jso.JSArrayReader;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.core.JSArrayReader;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/Node.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Node.java
similarity index 98%
rename from teavm-dom/src/main/java/org/teavm/dom/core/Node.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/Node.java
index 799765e6c..e872bef00 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/Node.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Node.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/NodeList.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/NodeList.java
similarity index 92%
rename from teavm-dom/src/main/java/org/teavm/dom/core/NodeList.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/NodeList.java
index 0b5f9cb51..7fa77f62c 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/NodeList.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/NodeList.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
-import org.teavm.jso.JSArrayReader;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.core.JSArrayReader;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/Notation.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Notation.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/core/Notation.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/Notation.java
index ef9a9c1da..cd03b4ebf 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/Notation.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Notation.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/ProcessingInstruction.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/ProcessingInstruction.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/core/ProcessingInstruction.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/ProcessingInstruction.java
index 6c9153872..3f800b1ef 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/ProcessingInstruction.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/ProcessingInstruction.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/core/Text.java b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Text.java
similarity index 95%
rename from teavm-dom/src/main/java/org/teavm/dom/core/Text.java
rename to teavm-jso/src/main/java/org/teavm/jso/dom/xml/Text.java
index 266e230e5..6bdaa4ad8 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/core/Text.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/dom/xml/Text.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.core;
+package org.teavm.jso.dom.xml;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/EventHandler.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/EventHandler.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/EventHandler.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/EventHandler.java
index 19500ce4f..5c0fabf57 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/EventHandler.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/EventHandler.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
import org.teavm.jso.JSFunctor;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBCountRequest.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBCountRequest.java
similarity index 95%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBCountRequest.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBCountRequest.java
index c11a24bdb..99bd954ec 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBCountRequest.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBCountRequest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBCursor.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBCursor.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBCursor.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBCursor.java
index 572613ad3..87b343d5b 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBCursor.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBCursor.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
import org.teavm.jso.JSMethod;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBCursorRequest.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBCursorRequest.java
similarity index 95%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBCursorRequest.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBCursorRequest.java
index 4066b60e5..8f18a7544 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBCursorRequest.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBCursorRequest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBCursorSource.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBCursorSource.java
similarity index 95%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBCursorSource.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBCursorSource.java
index 343d4b979..18a3ea949 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBCursorSource.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBCursorSource.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBDatabase.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBDatabase.java
similarity index 95%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBDatabase.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBDatabase.java
index c9fbda5d7..efc15f2bd 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBDatabase.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBDatabase.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
-import org.teavm.dom.events.EventTarget;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.dom.events.EventTarget;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBError.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBError.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBError.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBError.java
index 16fd19f2f..fd78a3543 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBError.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBError.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBFactory.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBFactory.java
similarity index 85%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBFactory.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBFactory.java
index 359522035..5bf01b9f3 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBFactory.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBFactory.java
@@ -13,9 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
-import org.teavm.jso.JS;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
@@ -25,12 +24,15 @@ import org.teavm.jso.JSObject;
*/
public abstract class IDBFactory implements JSObject {
public static boolean isSupported() {
- return !JS.isUndefined(getInstanceImpl());
+ return !getInstanceImpl().isUndefined();
}
+ @JSBody(params = {}, script = "return typeof this === 'undefined';")
+ private native boolean isUndefined();
+
public static IDBFactory getInstance() {
IDBFactory factory = getInstanceImpl();
- if (JS.isUndefined(factory)) {
+ if (!factory.isUndefined()) {
throw new IllegalStateException("IndexedDB is not supported in this browser");
}
return factory;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBGetRequest.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBGetRequest.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBGetRequest.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBGetRequest.java
index 60ef72e62..118517759 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBGetRequest.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBGetRequest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBIndex.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBIndex.java
similarity index 89%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBIndex.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBIndex.java
index 82f184b02..d777abd39 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBIndex.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBIndex.java
@@ -13,13 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
-import org.teavm.jso.JS;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
-import org.teavm.jso.JSType;
+import org.teavm.jso.core.JSString;
/**
*
@@ -34,8 +33,8 @@ public abstract class IDBIndex implements JSObject, IDBCursorSource {
public final String[] getKeyPath() {
JSObject result = getKeyPathImpl();
- if (JS.getType(result) == JSType.STRING) {
- return new String[] { JS.unwrapString(result) };
+ if (JSString.isInstance(result)) {
+ return new String[] { result.cast().stringValue() };
} else {
return unwrapStringArray(result);
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBKeyRange.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBKeyRange.java
similarity index 98%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBKeyRange.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBKeyRange.java
index 8ebbd4f69..9c94bc043 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBKeyRange.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBKeyRange.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBObjectStore.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBObjectStore.java
similarity index 88%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBObjectStore.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBObjectStore.java
index 4ece47aa9..982df66cc 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBObjectStore.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBObjectStore.java
@@ -13,9 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
-import org.teavm.jso.*;
+import org.teavm.jso.JSBody;
+import org.teavm.jso.JSObject;
+import org.teavm.jso.JSProperty;
+import org.teavm.jso.core.JSString;
/**
*
@@ -30,8 +33,8 @@ public abstract class IDBObjectStore implements JSObject, IDBCursorSource {
public final String[] getKeyPath() {
JSObject result = getKeyPathImpl();
- if (JS.getType(result) == JSType.STRING) {
- return new String[] { JS.unwrapString(result) };
+ if (JSString.isInstance(result)) {
+ return new String[] { result.cast().stringValue() };
} else {
return unwrapStringArray(result);
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBObjectStoreParameters.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBObjectStoreParameters.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBObjectStoreParameters.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBObjectStoreParameters.java
index 0761b559d..fe6fc42eb 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBObjectStoreParameters.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBObjectStoreParameters.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBOpenDBRequest.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBOpenDBRequest.java
similarity index 92%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBOpenDBRequest.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBOpenDBRequest.java
index 6f0f4ad10..679cf193e 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBOpenDBRequest.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBOpenDBRequest.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
-import org.teavm.dom.events.EventListener;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.dom.events.EventListener;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBRequest.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBRequest.java
similarity index 93%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBRequest.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBRequest.java
index af3cd608f..88ab8dcad 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBRequest.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBRequest.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
-import org.teavm.dom.events.EventTarget;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.dom.events.EventTarget;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBRequestSource.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBRequestSource.java
similarity index 95%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBRequestSource.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBRequestSource.java
index 47d9d13ba..813e20c0e 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBRequestSource.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBRequestSource.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBTransaction.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBTransaction.java
similarity index 93%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBTransaction.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBTransaction.java
index af8192adb..ee18ce2a9 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBTransaction.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBTransaction.java
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
-import org.teavm.dom.events.EventTarget;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.dom.events.EventTarget;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBVersionChangeEvent.java b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBVersionChangeEvent.java
similarity index 91%
rename from teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBVersionChangeEvent.java
rename to teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBVersionChangeEvent.java
index 7ebfe048e..b4302b6fd 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/indexeddb/IDBVersionChangeEvent.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/indexeddb/IDBVersionChangeEvent.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.indexeddb;
+package org.teavm.jso.indexeddb;
-import org.teavm.dom.events.Event;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.dom.events.Event;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/json/JSON.java b/teavm-jso/src/main/java/org/teavm/jso/json/JSON.java
similarity index 64%
rename from teavm-dom/src/main/java/org/teavm/dom/json/JSON.java
rename to teavm-jso/src/main/java/org/teavm/jso/json/JSON.java
index bbb87c50d..74e6a4c04 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/json/JSON.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/json/JSON.java
@@ -13,16 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.json;
+package org.teavm.jso.json;
+import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
/**
*
* @author Alexey Andreev
*/
-public interface JSON extends JSObject {
- String stringify(JSObject object);
+public final class JSON {
+ private JSON() {
+ }
- JSObject parse(String string);
+ @JSBody(params = { "object" }, script = "return JSON.stringify(object);")
+ public static native String stringify(JSObject object);
+
+ @JSBody(params = { "string" }, script = "return JSON.parse(string);")
+ public static native JSObject parse(String string);
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/media/AudioTrack.java b/teavm-jso/src/main/java/org/teavm/jso/media/AudioTrack.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/media/AudioTrack.java
rename to teavm-jso/src/main/java/org/teavm/jso/media/AudioTrack.java
index 7d9b28a1c..340e39245 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/media/AudioTrack.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/media/AudioTrack.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.media;
+package org.teavm.jso.media;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/media/AudioTrackList.java b/teavm-jso/src/main/java/org/teavm/jso/media/AudioTrackList.java
similarity index 87%
rename from teavm-dom/src/main/java/org/teavm/dom/media/AudioTrackList.java
rename to teavm-jso/src/main/java/org/teavm/jso/media/AudioTrackList.java
index 183da8c40..d40a04b3a 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/media/AudioTrackList.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/media/AudioTrackList.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.media;
+package org.teavm.jso.media;
-import org.teavm.dom.events.EventTarget;
-import org.teavm.jso.JSArrayReader;
+import org.teavm.jso.core.JSArrayReader;
+import org.teavm.jso.dom.events.EventTarget;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/media/MediaController.java b/teavm-jso/src/main/java/org/teavm/jso/media/MediaController.java
similarity index 98%
rename from teavm-dom/src/main/java/org/teavm/dom/media/MediaController.java
rename to teavm-jso/src/main/java/org/teavm/jso/media/MediaController.java
index 6b4da6394..b656e2308 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/media/MediaController.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/media/MediaController.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.media;
+package org.teavm.jso.media;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/media/MediaError.java b/teavm-jso/src/main/java/org/teavm/jso/media/MediaError.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/media/MediaError.java
rename to teavm-jso/src/main/java/org/teavm/jso/media/MediaError.java
index a7d22b1a7..c4e6f6098 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/media/MediaError.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/media/MediaError.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.media;
+package org.teavm.jso.media;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/media/MediaSource.java b/teavm-jso/src/main/java/org/teavm/jso/media/MediaSource.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/media/MediaSource.java
rename to teavm-jso/src/main/java/org/teavm/jso/media/MediaSource.java
index 1e5f66e7d..15ec86418 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/media/MediaSource.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/media/MediaSource.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.teavm.dom.media;
+package org.teavm.jso.media;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/media/SourceBuffer.java b/teavm-jso/src/main/java/org/teavm/jso/media/SourceBuffer.java
similarity index 91%
rename from teavm-dom/src/main/java/org/teavm/dom/media/SourceBuffer.java
rename to teavm-jso/src/main/java/org/teavm/jso/media/SourceBuffer.java
index 35a3a42de..14a8c3b84 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/media/SourceBuffer.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/media/SourceBuffer.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package org.teavm.dom.media;
+package org.teavm.jso.media;
-import org.teavm.dom.typedarrays.Uint8Array;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.typedarrays.Uint8Array;
public interface SourceBuffer extends JSObject {
void appendBuffer(Uint8Array array);
diff --git a/teavm-dom/src/main/java/org/teavm/dom/media/TextTrack.java b/teavm-jso/src/main/java/org/teavm/jso/media/TextTrack.java
similarity index 94%
rename from teavm-dom/src/main/java/org/teavm/dom/media/TextTrack.java
rename to teavm-jso/src/main/java/org/teavm/jso/media/TextTrack.java
index f34fedd30..460e45f8b 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/media/TextTrack.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/media/TextTrack.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.media;
+package org.teavm.jso.media;
-import org.teavm.dom.events.EventTarget;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.dom.events.EventTarget;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/media/TextTrackCue.java b/teavm-jso/src/main/java/org/teavm/jso/media/TextTrackCue.java
similarity index 93%
rename from teavm-dom/src/main/java/org/teavm/dom/media/TextTrackCue.java
rename to teavm-jso/src/main/java/org/teavm/jso/media/TextTrackCue.java
index 959b92ebf..1812f3749 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/media/TextTrackCue.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/media/TextTrackCue.java
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.media;
+package org.teavm.jso.media;
-import org.teavm.dom.core.DocumentFragment;
-import org.teavm.dom.events.EventTarget;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.dom.events.EventTarget;
+import org.teavm.jso.dom.xml.DocumentFragment;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/media/TextTrackCueList.java b/teavm-jso/src/main/java/org/teavm/jso/media/TextTrackCueList.java
similarity index 92%
rename from teavm-dom/src/main/java/org/teavm/dom/media/TextTrackCueList.java
rename to teavm-jso/src/main/java/org/teavm/jso/media/TextTrackCueList.java
index f3becb0be..260aed824 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/media/TextTrackCueList.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/media/TextTrackCueList.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.media;
+package org.teavm.jso.media;
-import org.teavm.jso.JSArrayReader;
import org.teavm.jso.JSObject;
+import org.teavm.jso.core.JSArrayReader;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/media/TextTrackList.java b/teavm-jso/src/main/java/org/teavm/jso/media/TextTrackList.java
similarity index 87%
rename from teavm-dom/src/main/java/org/teavm/dom/media/TextTrackList.java
rename to teavm-jso/src/main/java/org/teavm/jso/media/TextTrackList.java
index 08ae391df..1adc431b3 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/media/TextTrackList.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/media/TextTrackList.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.media;
+package org.teavm.jso.media;
-import org.teavm.dom.events.EventTarget;
-import org.teavm.jso.JSArrayReader;
+import org.teavm.jso.core.JSArrayReader;
+import org.teavm.jso.dom.events.EventTarget;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/media/TimeRanges.java b/teavm-jso/src/main/java/org/teavm/jso/media/TimeRanges.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/media/TimeRanges.java
rename to teavm-jso/src/main/java/org/teavm/jso/media/TimeRanges.java
index 4b032f235..decef627b 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/media/TimeRanges.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/media/TimeRanges.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.media;
+package org.teavm.jso.media;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/media/VideoTrack.java b/teavm-jso/src/main/java/org/teavm/jso/media/VideoTrack.java
similarity index 97%
rename from teavm-dom/src/main/java/org/teavm/dom/media/VideoTrack.java
rename to teavm-jso/src/main/java/org/teavm/jso/media/VideoTrack.java
index 4eb574bee..fd9b57ea7 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/media/VideoTrack.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/media/VideoTrack.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.media;
+package org.teavm.jso.media;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/media/VideoTrackList.java b/teavm-jso/src/main/java/org/teavm/jso/media/VideoTrackList.java
similarity index 88%
rename from teavm-dom/src/main/java/org/teavm/dom/media/VideoTrackList.java
rename to teavm-jso/src/main/java/org/teavm/jso/media/VideoTrackList.java
index fa3ead641..84c356d63 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/media/VideoTrackList.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/media/VideoTrackList.java
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.media;
+package org.teavm.jso.media;
-import org.teavm.dom.events.EventTarget;
-import org.teavm.jso.JSArrayReader;
import org.teavm.jso.JSProperty;
+import org.teavm.jso.core.JSArrayReader;
+import org.teavm.jso.dom.events.EventTarget;
/**
*
diff --git a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/ArrayBuffer.java b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/ArrayBuffer.java
similarity index 67%
rename from teavm-dom/src/main/java/org/teavm/dom/typedarrays/ArrayBuffer.java
rename to teavm-jso/src/main/java/org/teavm/jso/typedarrays/ArrayBuffer.java
index 2f0e361bc..e603e12c1 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/ArrayBuffer.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/ArrayBuffer.java
@@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.typedarrays;
+package org.teavm.jso.typedarrays;
+import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
@@ -22,9 +23,12 @@ import org.teavm.jso.JSProperty;
*
* @author Alexey Andreev
*/
-public interface ArrayBuffer extends JSObject {
+public abstract class ArrayBuffer implements JSObject {
@JSProperty
- int getByteLength();
+ public abstract int getByteLength();
- ArrayBuffer slice(int begin, int end);
+ public abstract ArrayBuffer slice(int begin, int end);
+
+ @JSBody(params = "length", script = "return new ArrayBuffer(length);")
+ public static native ArrayBuffer create(int length);
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/ArrayBufferView.java b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/ArrayBufferView.java
similarity index 77%
rename from teavm-dom/src/main/java/org/teavm/dom/typedarrays/ArrayBufferView.java
rename to teavm-jso/src/main/java/org/teavm/jso/typedarrays/ArrayBufferView.java
index 8377e2b19..8a1c0e517 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/ArrayBufferView.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/ArrayBufferView.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.typedarrays;
+package org.teavm.jso.typedarrays;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
@@ -22,13 +22,13 @@ import org.teavm.jso.JSProperty;
*
* @author Alexey Andreev
*/
-public interface ArrayBufferView extends JSObject {
+public abstract class ArrayBufferView implements JSObject {
@JSProperty
- int getLength();
+ public abstract int getLength();
@JSProperty
- int getByteLength();
+ public abstract int getByteLength();
@JSProperty
- ArrayBuffer getBuffer();
+ public abstract ArrayBuffer getBuffer();
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Float32Array.java b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Float32Array.java
similarity index 50%
rename from teavm-dom/src/main/java/org/teavm/dom/typedarrays/Float32Array.java
rename to teavm-jso/src/main/java/org/teavm/jso/typedarrays/Float32Array.java
index cc93efbb1..73d2c6013 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Float32Array.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Float32Array.java
@@ -13,18 +13,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.typedarrays;
+package org.teavm.jso.typedarrays;
+import org.teavm.jso.JSBody;
import org.teavm.jso.JSIndexer;
/**
*
* @author Alexey Andreev
*/
-public interface Float32Array extends ArrayBufferView {
+public abstract class Float32Array extends ArrayBufferView {
@JSIndexer
- float get(int index);
+ public abstract float get(int index);
@JSIndexer
- void set(int index, float value);
+ public abstract void set(int index, float value);
+
+ @JSBody(params = "length", script = "return new Float32Array(length);")
+ public static native ArrayBuffer create(int length);
+
+ @JSBody(params = "buffer", script = "return new Float32Array(buffer);")
+ public static native ArrayBuffer create(ArrayBuffer buffer);
+
+ @JSBody(params = { "buffer", "offset", "length" }, script = "return new Float32Array(buffer, offset, length);")
+ public static native ArrayBuffer create(ArrayBuffer buffer, int offset, int length);
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Float64Array.java b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Float64Array.java
similarity index 50%
rename from teavm-dom/src/main/java/org/teavm/dom/typedarrays/Float64Array.java
rename to teavm-jso/src/main/java/org/teavm/jso/typedarrays/Float64Array.java
index 74d165ab8..ce2d5eeee 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Float64Array.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Float64Array.java
@@ -13,18 +13,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.typedarrays;
+package org.teavm.jso.typedarrays;
+import org.teavm.jso.JSBody;
import org.teavm.jso.JSIndexer;
/**
*
* @author Alexey Andreev
*/
-public interface Float64Array extends ArrayBufferView {
+public abstract class Float64Array extends ArrayBufferView {
@JSIndexer
- double get(int index);
+ public abstract double get(int index);
@JSIndexer
- void set(int index, double value);
+ public abstract void set(int index, double value);
+
+ @JSBody(params = "length", script = "return new Float64Array(length);")
+ public static native ArrayBuffer create(int length);
+
+ @JSBody(params = "buffer", script = "return new Float64Array(buffer);")
+ public static native ArrayBuffer create(ArrayBuffer buffer);
+
+ @JSBody(params = { "buffer", "offset", "length" }, script = "return new Float64Array(buffer, offset, length);")
+ public static native ArrayBuffer create(ArrayBuffer buffer, int offset, int length);
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Int16Array.java b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Int16Array.java
similarity index 50%
rename from teavm-dom/src/main/java/org/teavm/dom/typedarrays/Int16Array.java
rename to teavm-jso/src/main/java/org/teavm/jso/typedarrays/Int16Array.java
index 07eac2f3d..33a969bfb 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Int16Array.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Int16Array.java
@@ -13,18 +13,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.typedarrays;
+package org.teavm.jso.typedarrays;
+import org.teavm.jso.JSBody;
import org.teavm.jso.JSIndexer;
/**
*
* @author Alexey Andreev
*/
-public interface Int16Array extends ArrayBufferView {
+public abstract class Int16Array extends ArrayBufferView {
@JSIndexer
- short get(int index);
+ public abstract short get(int index);
@JSIndexer
- void set(int index, short value);
+ public abstract void set(int index, short value);
+
+ @JSBody(params = "length", script = "return new Int16Array(length);")
+ public static native ArrayBuffer create(int length);
+
+ @JSBody(params = "buffer", script = "return new Int16Array(buffer);")
+ public static native ArrayBuffer create(ArrayBuffer buffer);
+
+ @JSBody(params = { "buffer", "offset", "length" }, script = "return new Int16Array(buffer, offset, length);")
+ public static native ArrayBuffer create(ArrayBuffer buffer, int offset, int length);
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Int32Array.java b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Int32Array.java
similarity index 50%
rename from teavm-dom/src/main/java/org/teavm/dom/typedarrays/Int32Array.java
rename to teavm-jso/src/main/java/org/teavm/jso/typedarrays/Int32Array.java
index 1929a18b6..5cf8ad59a 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Int32Array.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Int32Array.java
@@ -13,18 +13,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.typedarrays;
+package org.teavm.jso.typedarrays;
+import org.teavm.jso.JSBody;
import org.teavm.jso.JSIndexer;
/**
*
* @author Alexey Andreev
*/
-public interface Int32Array extends ArrayBufferView {
+public abstract class Int32Array extends ArrayBufferView {
@JSIndexer
- int get(int index);
+ public abstract int get(int index);
@JSIndexer
- void set(int index, int value);
+ public abstract void set(int index, int value);
+
+ @JSBody(params = "length", script = "return new Int32Array(length);")
+ public static native ArrayBuffer create(int length);
+
+ @JSBody(params = "buffer", script = "return new Int32Array(buffer);")
+ public static native ArrayBuffer create(ArrayBuffer buffer);
+
+ @JSBody(params = { "buffer", "offset", "length" }, script = "return new Int32Array(buffer, offset, length);")
+ public static native ArrayBuffer create(ArrayBuffer buffer, int offset, int length);
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Int8Array.java b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Int8Array.java
similarity index 50%
rename from teavm-dom/src/main/java/org/teavm/dom/typedarrays/Int8Array.java
rename to teavm-jso/src/main/java/org/teavm/jso/typedarrays/Int8Array.java
index 934d896fb..38874fa7b 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Int8Array.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Int8Array.java
@@ -13,18 +13,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.typedarrays;
+package org.teavm.jso.typedarrays;
+import org.teavm.jso.JSBody;
import org.teavm.jso.JSIndexer;
/**
*
* @author Alexey Andreev
*/
-public interface Int8Array extends ArrayBufferView {
+public abstract class Int8Array extends ArrayBufferView {
@JSIndexer
- byte get(int index);
+ public abstract byte get(int index);
@JSIndexer
- void set(int index, byte value);
+ public abstract void set(int index, byte value);
+
+ @JSBody(params = "length", script = "return new Int8Array(length);")
+ public static native ArrayBuffer create(int length);
+
+ @JSBody(params = "buffer", script = "return new Int8Array(buffer);")
+ public static native ArrayBuffer create(ArrayBuffer buffer);
+
+ @JSBody(params = { "buffer", "offset", "length" }, script = "return new Int8Array(buffer, offset, length);")
+ public static native ArrayBuffer create(ArrayBuffer buffer, int offset, int length);
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Uint16Array.java b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Uint16Array.java
similarity index 50%
rename from teavm-dom/src/main/java/org/teavm/dom/typedarrays/Uint16Array.java
rename to teavm-jso/src/main/java/org/teavm/jso/typedarrays/Uint16Array.java
index 30d727f91..c631b818e 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Uint16Array.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Uint16Array.java
@@ -13,18 +13,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.typedarrays;
+package org.teavm.jso.typedarrays;
+import org.teavm.jso.JSBody;
import org.teavm.jso.JSIndexer;
/**
*
* @author Alexey Andreev
*/
-public interface Uint16Array extends ArrayBufferView {
+public abstract class Uint16Array extends ArrayBufferView {
@JSIndexer
- int get(int index);
+ public abstract int get(int index);
@JSIndexer
- void set(int index, int value);
+ public abstract void set(int index, int value);
+
+ @JSBody(params = "length", script = "return new Uint8Array(length);")
+ public static native ArrayBuffer create(int length);
+
+ @JSBody(params = "buffer", script = "return new Uint8Array(buffer);")
+ public static native ArrayBuffer create(ArrayBuffer buffer);
+
+ @JSBody(params = { "buffer", "offset", "length" }, script = "return new Uint8Array(buffer, offset, length);")
+ public static native ArrayBuffer create(ArrayBuffer buffer, int offset, int length);
}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Uint8Array.java b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Uint8Array.java
similarity index 50%
rename from teavm-dom/src/main/java/org/teavm/dom/typedarrays/Uint8Array.java
rename to teavm-jso/src/main/java/org/teavm/jso/typedarrays/Uint8Array.java
index 6983e7d7a..d393f02af 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/typedarrays/Uint8Array.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Uint8Array.java
@@ -13,18 +13,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.typedarrays;
+package org.teavm.jso.typedarrays;
+import org.teavm.jso.JSBody;
import org.teavm.jso.JSIndexer;
/**
*
* @author Alexey Andreev
*/
-public interface Uint8Array extends ArrayBufferView {
+public abstract class Uint8Array extends ArrayBufferView {
@JSIndexer
- short get(int index);
+ public abstract short get(int index);
@JSIndexer
- void set(int index, short value);
+ public abstract void set(int index, short value);
+
+ @JSBody(params = "length", script = "return new Uint8Array(length);")
+ public static native ArrayBuffer create(int length);
+
+ @JSBody(params = "buffer", script = "return new Uint8Array(buffer);")
+ public static native ArrayBuffer create(ArrayBuffer buffer);
+
+ @JSBody(params = { "buffer", "offset", "length" }, script = "return new Uint8Array(buffer, offset, length);")
+ public static native ArrayBuffer create(ArrayBuffer buffer, int offset, int length);
}
diff --git a/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Uint8ClampedArray.java b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Uint8ClampedArray.java
new file mode 100644
index 000000000..b373cc1c2
--- /dev/null
+++ b/teavm-jso/src/main/java/org/teavm/jso/typedarrays/Uint8ClampedArray.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2014 Alexey Andreev.
+ *
+ * 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.typedarrays;
+
+import org.teavm.jso.JSBody;
+import org.teavm.jso.JSIndexer;
+
+/**
+ *
+ * @author Alexey Andreev
+ */
+public abstract class Uint8ClampedArray extends ArrayBufferView {
+ @JSIndexer
+ public abstract short get(int index);
+
+ @JSIndexer
+ public abstract void set(int index, int value);
+
+ @JSBody(params = "length", script = "return new Uint8ClampedArray(length);")
+ public static native ArrayBuffer create(int length);
+
+ @JSBody(params = "buffer", script = "return new Uint8ClampedArray(buffer);")
+ public static native ArrayBuffer create(ArrayBuffer buffer);
+
+ @JSBody(params = { "buffer", "offset", "length" }, script = "return new "
+ + "Uint8ClampedArray(buffer, offset, length);")
+ public static native ArrayBuffer create(ArrayBuffer buffer, int offset, int length);
+}
diff --git a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLActiveInfo.java b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLActiveInfo.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLActiveInfo.java
rename to teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLActiveInfo.java
index 70a93610b..8d127dee9 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLActiveInfo.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLActiveInfo.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.webgl;
+package org.teavm.jso.webgl;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLBuffer.java b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLBuffer.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLBuffer.java
rename to teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLBuffer.java
index 410a10ad6..c10f4375b 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLBuffer.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLBuffer.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.webgl;
+package org.teavm.jso.webgl;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLContextAttributes.java b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLContextAttributes.java
similarity index 98%
rename from teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLContextAttributes.java
rename to teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLContextAttributes.java
index 508384c94..8ed6cac0f 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLContextAttributes.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLContextAttributes.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.webgl;
+package org.teavm.jso.webgl;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLContextAttributesFactory.java b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLContextAttributesFactory.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLContextAttributesFactory.java
rename to teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLContextAttributesFactory.java
index 53d9b0da9..6ab7ba60c 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLContextAttributesFactory.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLContextAttributesFactory.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.webgl;
+package org.teavm.jso.webgl;
import org.teavm.jso.JSConstructor;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLFramebuffer.java b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLFramebuffer.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLFramebuffer.java
rename to teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLFramebuffer.java
index d7cb62c9e..ea7df7d31 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLFramebuffer.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLFramebuffer.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.webgl;
+package org.teavm.jso.webgl;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLProgram.java b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLProgram.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLProgram.java
rename to teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLProgram.java
index dbb955438..99a1746b0 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLProgram.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLProgram.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.webgl;
+package org.teavm.jso.webgl;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLRenderbuffer.java b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLRenderbuffer.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLRenderbuffer.java
rename to teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLRenderbuffer.java
index 0758453e0..cf20c2d78 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLRenderbuffer.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLRenderbuffer.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.webgl;
+package org.teavm.jso.webgl;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLRenderingContext.java b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLRenderingContext.java
similarity index 94%
rename from teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLRenderingContext.java
rename to teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLRenderingContext.java
index 23c0b25da..345aabbea 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLRenderingContext.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLRenderingContext.java
@@ -13,16 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.webgl;
+package org.teavm.jso.webgl;
-import org.teavm.dom.canvas.ImageData;
-import org.teavm.dom.html.HTMLCanvasElement;
-import org.teavm.dom.html.HTMLImageElement;
-import org.teavm.dom.typedarrays.ArrayBuffer;
-import org.teavm.dom.typedarrays.ArrayBufferView;
-import org.teavm.dom.typedarrays.Float32Array;
-import org.teavm.dom.typedarrays.Int32Array;
-import org.teavm.jso.*;
+import org.teavm.jso.JSMethod;
+import org.teavm.jso.JSObject;
+import org.teavm.jso.JSProperty;
+import org.teavm.jso.canvas.ImageData;
+import org.teavm.jso.core.JSArrayReader;
+import org.teavm.jso.core.JSNumber;
+import org.teavm.jso.core.JSString;
+import org.teavm.jso.dom.html.HTMLCanvasElement;
+import org.teavm.jso.dom.html.HTMLImageElement;
+import org.teavm.jso.typedarrays.ArrayBuffer;
+import org.teavm.jso.typedarrays.ArrayBufferView;
+import org.teavm.jso.typedarrays.Float32Array;
+import org.teavm.jso.typedarrays.Int32Array;
/**
*
@@ -387,7 +392,7 @@ public interface WebGLRenderingContext extends JSObject {
boolean isContextLost();
- JSStringArrayReader getSupportedExtensions();
+ JSArrayReader getSupportedExtensions();
@JSMethod("getSupportedExtensions")
String[] getSupportedExtensionArray();
@@ -652,7 +657,7 @@ public interface WebGLRenderingContext extends JSObject {
void uniform1fv(WebGLUniformLocation location, Float32Array v);
- void uniform1fv(WebGLUniformLocation location, JSDoubleArrayReader v);
+ void uniform1fv(WebGLUniformLocation location, JSArrayReader v);
void uniform1fv(WebGLUniformLocation location, float[] v);
@@ -660,7 +665,7 @@ public interface WebGLRenderingContext extends JSObject {
void uniform1iv(WebGLUniformLocation location, Int32Array v);
- void uniform1iv(WebGLUniformLocation location, JSIntArrayReader v);
+ void uniform1iv(WebGLUniformLocation location, JSArrayReader v);
void uniform1iv(WebGLUniformLocation location, int[] v);
@@ -668,7 +673,7 @@ public interface WebGLRenderingContext extends JSObject {
void uniform2fv(WebGLUniformLocation location, Float32Array v);
- void uniform2fv(WebGLUniformLocation location, JSDoubleArrayReader v);
+ void uniform2fv(WebGLUniformLocation location, JSArrayReader v);
void uniform2fv(WebGLUniformLocation location, float[] v);
@@ -676,7 +681,7 @@ public interface WebGLRenderingContext extends JSObject {
void uniform2iv(WebGLUniformLocation location, Int32Array v);
- void uniform2iv(WebGLUniformLocation location, JSIntArrayReader v);
+ void uniform2iv(WebGLUniformLocation location, JSArrayReader v);
void uniform2iv(WebGLUniformLocation location, int[] v);
@@ -684,7 +689,7 @@ public interface WebGLRenderingContext extends JSObject {
void uniform3fv(WebGLUniformLocation location, Float32Array v);
- void uniform3fv(WebGLUniformLocation location, JSDoubleArrayReader v);
+ void uniform3fv(WebGLUniformLocation location, JSArrayReader v);
void uniform3fv(WebGLUniformLocation location, float[] v);
@@ -692,7 +697,7 @@ public interface WebGLRenderingContext extends JSObject {
void uniform3iv(WebGLUniformLocation location, Int32Array v);
- void uniform3iv(WebGLUniformLocation location, JSIntArrayReader v);
+ void uniform3iv(WebGLUniformLocation location, JSArrayReader v);
void uniform3iv(WebGLUniformLocation location, int[] v);
@@ -700,7 +705,7 @@ public interface WebGLRenderingContext extends JSObject {
void uniform4fv(WebGLUniformLocation location, Float32Array v);
- void uniform4fv(WebGLUniformLocation location, JSDoubleArrayReader v);
+ void uniform4fv(WebGLUniformLocation location, JSArrayReader v);
void uniform4fv(WebGLUniformLocation location, float[] v);
@@ -708,25 +713,25 @@ public interface WebGLRenderingContext extends JSObject {
void uniform4iv(WebGLUniformLocation location, Int32Array v);
- void uniform4iv(WebGLUniformLocation location, JSIntArrayReader v);
+ void uniform4iv(WebGLUniformLocation location, JSArrayReader v);
void uniform4iv(WebGLUniformLocation location, int[] v);
void uniformMatrix2fv(WebGLUniformLocation location, boolean transpose, Float32Array value);
- void uniformMatrix2fv(WebGLUniformLocation location, boolean transpose, JSDoubleArrayReader value);
+ void uniformMatrix2fv(WebGLUniformLocation location, boolean transpose, JSArrayReader value);
void uniformMatrix2fv(WebGLUniformLocation location, boolean transpose, float[] value);
void uniformMatrix3fv(WebGLUniformLocation location, boolean transpose, Float32Array value);
- void uniformMatrix3fv(WebGLUniformLocation location, boolean transpose, JSDoubleArrayReader value);
+ void uniformMatrix3fv(WebGLUniformLocation location, boolean transpose, JSArrayReader value);
void uniformMatrix3fv(WebGLUniformLocation location, boolean transpose, float[] value);
void uniformMatrix4fv(WebGLUniformLocation location, boolean transpose, Float32Array value);
- void uniformMatrix4fv(WebGLUniformLocation location, boolean transpose, JSDoubleArrayReader value);
+ void uniformMatrix4fv(WebGLUniformLocation location, boolean transpose, JSArrayReader value);
void uniformMatrix4fv(WebGLUniformLocation location, boolean transpose, float[] value);
@@ -738,7 +743,7 @@ public interface WebGLRenderingContext extends JSObject {
void vertexAttrib1fv(int indx, Float32Array values);
- void vertexAttrib1fv(int indx, JSDoubleArrayReader values);
+ void vertexAttrib1fv(int indx, JSArrayReader values);
void vertexAttrib1fv(int indx, float[] values);
@@ -746,7 +751,7 @@ public interface WebGLRenderingContext extends JSObject {
void vertexAttrib2fv(int indx, Float32Array values);
- void vertexAttrib2fv(int indx, JSDoubleArrayReader values);
+ void vertexAttrib2fv(int indx, JSArrayReader values);
void vertexAttrib2fv(int indx, float[] values);
@@ -754,7 +759,7 @@ public interface WebGLRenderingContext extends JSObject {
void vertexAttrib3fv(int indx, Float32Array values);
- void vertexAttrib3fv(int indx, JSDoubleArrayReader values);
+ void vertexAttrib3fv(int indx, JSArrayReader values);
void vertexAttrib3fv(int indx, float[] values);
@@ -762,7 +767,7 @@ public interface WebGLRenderingContext extends JSObject {
void vertexAttrib4fv(int indx, Float32Array values);
- void vertexAttrib4fv(int indx, JSDoubleArrayReader values);
+ void vertexAttrib4fv(int indx, JSArrayReader values);
void vertexAttrib4fv(int indx, float[] values);
diff --git a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLShader.java b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLShader.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLShader.java
rename to teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLShader.java
index 6155c09e0..a1daabb17 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLShader.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLShader.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.webgl;
+package org.teavm.jso.webgl;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLShaderPrecisionFormat.java b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLShaderPrecisionFormat.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLShaderPrecisionFormat.java
rename to teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLShaderPrecisionFormat.java
index a6a1d8391..5e0ceeaa9 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLShaderPrecisionFormat.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLShaderPrecisionFormat.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.webgl;
+package org.teavm.jso.webgl;
import org.teavm.jso.JSObject;
import org.teavm.jso.JSProperty;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLTexture.java b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLTexture.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLTexture.java
rename to teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLTexture.java
index f4bf7d5fd..c9b09545e 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLTexture.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLTexture.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.webgl;
+package org.teavm.jso.webgl;
import org.teavm.jso.JSObject;
diff --git a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLUniformLocation.java b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLUniformLocation.java
similarity index 96%
rename from teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLUniformLocation.java
rename to teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLUniformLocation.java
index a070f18ee..d1b0daab9 100644
--- a/teavm-dom/src/main/java/org/teavm/dom/webgl/WebGLUniformLocation.java
+++ b/teavm-jso/src/main/java/org/teavm/jso/webgl/WebGLUniformLocation.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.teavm.dom.webgl;
+package org.teavm.jso.webgl;
import org.teavm.jso.JSObject;
diff --git a/teavm-platform/src/main/java/org/teavm/platform/Platform.java b/teavm-platform/src/main/java/org/teavm/platform/Platform.java
index b7c051be6..02bd61ef8 100644
--- a/teavm-platform/src/main/java/org/teavm/platform/Platform.java
+++ b/teavm-platform/src/main/java/org/teavm/platform/Platform.java
@@ -19,7 +19,7 @@ import java.lang.annotation.Annotation;
import org.teavm.dependency.PluggableDependency;
import org.teavm.javascript.spi.GeneratedBy;
import org.teavm.javascript.spi.InjectedBy;
-import org.teavm.jso.JS;
+import org.teavm.jso.plugin.JS;
import org.teavm.platform.metadata.ClassResource;
import org.teavm.platform.metadata.StaticFieldResource;
import org.teavm.platform.plugin.PlatformGenerator;
diff --git a/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/teavm/BenchmarkStarter.java b/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/teavm/BenchmarkStarter.java
index d98815b97..67d74a43f 100644
--- a/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/teavm/BenchmarkStarter.java
+++ b/teavm-samples/teavm-samples-benchmark/src/main/java/org/teavm/samples/benchmark/teavm/BenchmarkStarter.java
@@ -22,13 +22,13 @@ import org.jbox2d.collision.shapes.ShapeType;
import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.Body;
import org.jbox2d.dynamics.Fixture;
-import org.teavm.dom.browser.TimerHandler;
-import org.teavm.dom.browser.Window;
-import org.teavm.dom.canvas.CanvasRenderingContext2D;
-import org.teavm.dom.html.HTMLCanvasElement;
-import org.teavm.dom.html.HTMLDocument;
-import org.teavm.dom.html.HTMLElement;
-import org.teavm.jso.JS;
+import org.teavm.jso.browser.TimerHandler;
+import org.teavm.jso.browser.Window;
+import org.teavm.jso.canvas.CanvasRenderingContext2D;
+import org.teavm.jso.dom.html.HTMLCanvasElement;
+import org.teavm.jso.dom.html.HTMLDocument;
+import org.teavm.jso.dom.html.HTMLElement;
+import org.teavm.jso.plugin.JS;
import org.teavm.samples.benchmark.Scene;
/**
diff --git a/teavm-samples/teavm-samples-hello/src/main/java/org/teavm/samples/hello/Client.java b/teavm-samples/teavm-samples-hello/src/main/java/org/teavm/samples/hello/Client.java
index e4c85b7b6..7d9695f33 100644
--- a/teavm-samples/teavm-samples-hello/src/main/java/org/teavm/samples/hello/Client.java
+++ b/teavm-samples/teavm-samples-hello/src/main/java/org/teavm/samples/hello/Client.java
@@ -15,12 +15,12 @@
*/
package org.teavm.samples.hello;
-import org.teavm.dom.ajax.XMLHttpRequest;
-import org.teavm.dom.browser.Window;
-import org.teavm.dom.html.HTMLButtonElement;
-import org.teavm.dom.html.HTMLDocument;
-import org.teavm.dom.html.HTMLElement;
-import org.teavm.jso.JS;
+import org.teavm.jso.ajax.XMLHttpRequest;
+import org.teavm.jso.browser.Window;
+import org.teavm.jso.dom.html.HTMLButtonElement;
+import org.teavm.jso.dom.html.HTMLDocument;
+import org.teavm.jso.dom.html.HTMLElement;
+import org.teavm.jso.plugin.JS;
public final class Client {
private static Window window = (Window) JS.getGlobal();
diff --git a/teavm-samples/teavm-samples-storage/src/main/java/org/teavm/samples/storage/Application.java b/teavm-samples/teavm-samples-storage/src/main/java/org/teavm/samples/storage/Application.java
index e523bbedc..3bb8a8861 100644
--- a/teavm-samples/teavm-samples-storage/src/main/java/org/teavm/samples/storage/Application.java
+++ b/teavm-samples/teavm-samples-storage/src/main/java/org/teavm/samples/storage/Application.java
@@ -15,13 +15,13 @@
*/
package org.teavm.samples.storage;
-import org.teavm.dom.browser.Storage;
-import org.teavm.dom.browser.Window;
-import org.teavm.dom.html.HTMLButtonElement;
-import org.teavm.dom.html.HTMLDocument;
-import org.teavm.dom.html.HTMLElement;
-import org.teavm.dom.html.HTMLInputElement;
-import org.teavm.jso.JS;
+import org.teavm.jso.browser.Storage;
+import org.teavm.jso.browser.Window;
+import org.teavm.jso.dom.html.HTMLButtonElement;
+import org.teavm.jso.dom.html.HTMLDocument;
+import org.teavm.jso.dom.html.HTMLElement;
+import org.teavm.jso.dom.html.HTMLInputElement;
+import org.teavm.jso.plugin.JS;
/**
*
diff --git a/teavm-samples/teavm-samples-video/src/main/java/org/teavm/samples/video/Player.java b/teavm-samples/teavm-samples-video/src/main/java/org/teavm/samples/video/Player.java
index 5c2de45bf..6770d343d 100644
--- a/teavm-samples/teavm-samples-video/src/main/java/org/teavm/samples/video/Player.java
+++ b/teavm-samples/teavm-samples-video/src/main/java/org/teavm/samples/video/Player.java
@@ -15,14 +15,14 @@
*/
package org.teavm.samples.video;
-import org.teavm.dom.browser.Window;
-import org.teavm.dom.html.HTMLBodyElement;
-import org.teavm.dom.html.HTMLButtonElement;
-import org.teavm.dom.html.HTMLDocument;
-import org.teavm.dom.html.HTMLElement;
-import org.teavm.dom.html.HTMLSourceElement;
-import org.teavm.dom.html.HTMLVideoElement;
-import org.teavm.jso.JS;
+import org.teavm.jso.browser.Window;
+import org.teavm.jso.dom.html.HTMLBodyElement;
+import org.teavm.jso.dom.html.HTMLButtonElement;
+import org.teavm.jso.dom.html.HTMLDocument;
+import org.teavm.jso.dom.html.HTMLElement;
+import org.teavm.jso.dom.html.HTMLSourceElement;
+import org.teavm.jso.dom.html.HTMLVideoElement;
+import org.teavm.jso.plugin.JS;
public final class Player {
diff --git a/teavm-tests/src/test/java/org/teavm/jso/test/JSOTest.java b/teavm-tests/src/test/java/org/teavm/jso/test/JSOTest.java
index adc59de90..7d3a78ab8 100644
--- a/teavm-tests/src/test/java/org/teavm/jso/test/JSOTest.java
+++ b/teavm-tests/src/test/java/org/teavm/jso/test/JSOTest.java
@@ -17,9 +17,9 @@ package org.teavm.jso.test;
import static org.junit.Assert.*;
import org.junit.Test;
-import org.teavm.jso.JS;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
+import org.teavm.jso.plugin.JS;
/**
*