From 8a039a1d87d3e8d8465fa2e9a25e0a8425023fb5 Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Sat, 4 Nov 2017 15:24:18 -0500 Subject: [PATCH 1/4] Add missing Element.querySelector/All methods --- jso/apis/src/main/java/org/teavm/jso/dom/xml/Element.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jso/apis/src/main/java/org/teavm/jso/dom/xml/Element.java b/jso/apis/src/main/java/org/teavm/jso/dom/xml/Element.java index f74ac0bef8..9c892c18c1 100644 --- a/jso/apis/src/main/java/org/teavm/jso/dom/xml/Element.java +++ b/jso/apis/src/main/java/org/teavm/jso/dom/xml/Element.java @@ -47,4 +47,8 @@ public interface Element extends Node { boolean hasAttribute(String name); boolean hasAttributeNS(String namespaceURI, String localName); + + Element querySelector(String selectors); + + NodeList querySelectorAll(String selectors); } From c366ee2f339ba049435d30c0a18b27d70dfd28de Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Sat, 4 Nov 2017 15:45:43 -0500 Subject: [PATCH 2/4] Add support for Element.classList --- .../org/teavm/jso/dom/xml/DOMTokenList.java | 31 +++++++++++++++++++ .../java/org/teavm/jso/dom/xml/Element.java | 5 +++ 2 files changed, 36 insertions(+) create mode 100644 jso/apis/src/main/java/org/teavm/jso/dom/xml/DOMTokenList.java diff --git a/jso/apis/src/main/java/org/teavm/jso/dom/xml/DOMTokenList.java b/jso/apis/src/main/java/org/teavm/jso/dom/xml/DOMTokenList.java new file mode 100644 index 0000000000..4f6ffb6244 --- /dev/null +++ b/jso/apis/src/main/java/org/teavm/jso/dom/xml/DOMTokenList.java @@ -0,0 +1,31 @@ +/* + * Copyright 2017 Colin Alworth. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.jso.dom.xml; + +import org.teavm.jso.core.JSArrayReader; +import org.teavm.jso.core.JSString; + +public interface DOMTokenList extends JSArrayReader { + boolean contains(String token); + + void add(String... tokens); + + void remove(String... tokens); + + boolean toggle(String token); + + boolean toggle(String token, boolean force); +} diff --git a/jso/apis/src/main/java/org/teavm/jso/dom/xml/Element.java b/jso/apis/src/main/java/org/teavm/jso/dom/xml/Element.java index 9c892c18c1..3540f717e2 100644 --- a/jso/apis/src/main/java/org/teavm/jso/dom/xml/Element.java +++ b/jso/apis/src/main/java/org/teavm/jso/dom/xml/Element.java @@ -15,6 +15,8 @@ */ package org.teavm.jso.dom.xml; +import org.teavm.jso.JSProperty; + public interface Element extends Node { String getTagName(); @@ -51,4 +53,7 @@ public interface Element extends Node { Element querySelector(String selectors); NodeList querySelectorAll(String selectors); + + @JSProperty + DOMTokenList getClassList(); } From adacf23d4cb9e858798ea439dfff27f61556ef5a Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Sat, 4 Nov 2017 15:45:53 -0500 Subject: [PATCH 3/4] Add missing MouseEvent getters --- .../org/teavm/jso/dom/events/MouseEvent.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/jso/apis/src/main/java/org/teavm/jso/dom/events/MouseEvent.java b/jso/apis/src/main/java/org/teavm/jso/dom/events/MouseEvent.java index 3ee30f4059..2404bd643c 100644 --- a/jso/apis/src/main/java/org/teavm/jso/dom/events/MouseEvent.java +++ b/jso/apis/src/main/java/org/teavm/jso/dom/events/MouseEvent.java @@ -41,6 +41,24 @@ public interface MouseEvent extends Event { @JSProperty int getClientY(); + @JSProperty + int getPageX(); + + @JSProperty + int getPageY(); + + @JSProperty + int getOffsetX(); + + @JSProperty + int getOffsetY(); + + @JSProperty + int getX(); + + @JSProperty + int getY(); + @JSProperty boolean getCtrlKey(); From 75a4e162675a7db1080c73eafd74b74dba6c415d Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Sat, 4 Nov 2017 15:51:57 -0500 Subject: [PATCH 4/4] Add missing "offset" properties on HTMLElement --- .../java/org/teavm/jso/dom/html/HTMLElement.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLElement.java b/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLElement.java index 25055f0ee2..e9031c5d67 100644 --- a/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLElement.java +++ b/jso/apis/src/main/java/org/teavm/jso/dom/html/HTMLElement.java @@ -120,6 +120,21 @@ public interface HTMLElement extends Element, ElementCSSInlineStyle, EventTarget @JSProperty void setClassName(String className); + @JSProperty + HTMLElement getOffsetParent(); + + @JSProperty + int getOffsetTop(); + + @JSProperty + int getOffsetLeft(); + + @JSProperty + int getOffsetWidth(); + + @JSProperty + int getOffsetHeight(); + default HTMLElement withAttr(String name, String value) { setAttribute(name, value); return this;