Skip to content

Commit 58747fe

Browse files
committed
remove HTMLListElement and fix class tree
1 parent 8de082b commit 58747fe

File tree

10 files changed

+178
-127
lines changed

10 files changed

+178
-127
lines changed

src/main/java/org/htmlunit/javascript/configuration/JavaScriptConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@
279279
import org.htmlunit.javascript.host.html.HTMLLabelElement;
280280
import org.htmlunit.javascript.host.html.HTMLLegendElement;
281281
import org.htmlunit.javascript.host.html.HTMLLinkElement;
282-
import org.htmlunit.javascript.host.html.HTMLListElement;
283282
import org.htmlunit.javascript.host.html.HTMLMapElement;
284283
import org.htmlunit.javascript.host.html.HTMLMarqueeElement;
285284
import org.htmlunit.javascript.host.html.HTMLMediaElement;
@@ -648,7 +647,7 @@ public final class JavaScriptConfiguration extends AbstractJavaScriptConfigurati
648647
HTMLFormElement.class, HTMLFrameElement.class, HTMLFrameSetElement.class, HTMLHRElement.class,
649648
HTMLHeadElement.class, HTMLHeadingElement.class, HTMLHtmlElement.class, HTMLIFrameElement.class,
650649
HTMLImageElement.class, HTMLInputElement.class, HTMLLIElement.class, HTMLLabelElement.class,
651-
HTMLLegendElement.class, HTMLLinkElement.class, HTMLListElement.class, HTMLMapElement.class,
650+
HTMLLegendElement.class, HTMLLinkElement.class, HTMLMapElement.class,
652651
HTMLMarqueeElement.class, HTMLMediaElement.class, HTMLMetaElement.class, HTMLMeterElement.class,
653652
HTMLModElement.class, HTMLObjectElement.class, HTMLOptGroupElement.class, HTMLOptionElement.class,
654653
HTMLOutputElement.class, HTMLParagraphElement.class, HTMLParamElement.class, HTMLPictureElement.class,

src/main/java/org/htmlunit/javascript/host/html/HTMLDListElement.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
package org.htmlunit.javascript.host.html;
1616

1717
import org.htmlunit.html.HtmlDefinitionList;
18+
import org.htmlunit.javascript.JavaScriptEngine;
1819
import org.htmlunit.javascript.configuration.JsxClass;
1920
import org.htmlunit.javascript.configuration.JsxConstructor;
21+
import org.htmlunit.javascript.configuration.JsxGetter;
22+
import org.htmlunit.javascript.configuration.JsxSetter;
2023

2124
/**
2225
* The JavaScript object {@code HTMLDListElement}.
@@ -25,7 +28,7 @@
2528
* @author Ronald Brill
2629
*/
2730
@JsxClass(domClass = HtmlDefinitionList.class)
28-
public class HTMLDListElement extends HTMLListElement {
31+
public class HTMLDListElement extends HTMLElement {
2932

3033
/**
3134
* JavaScript constructor.
@@ -35,4 +38,27 @@ public class HTMLDListElement extends HTMLListElement {
3538
public void jsConstructor() {
3639
super.jsConstructor();
3740
}
41+
42+
/**
43+
* Returns the value of the {@code compact} attribute.
44+
* @return the value of the {@code compact} attribute
45+
*/
46+
@JsxGetter
47+
public boolean isCompact() {
48+
return getDomNodeOrDie().hasAttribute("compact");
49+
}
50+
51+
/**
52+
* Sets the value of the {@code compact} attribute.
53+
* @param compact the value of the {@code compact} attribute
54+
*/
55+
@JsxSetter
56+
public void setCompact(final Object compact) {
57+
if (JavaScriptEngine.toBoolean(compact)) {
58+
getDomNodeOrDie().setAttribute("compact", "");
59+
}
60+
else {
61+
getDomNodeOrDie().removeAttribute("compact");
62+
}
63+
}
3864
}

src/main/java/org/htmlunit/javascript/host/html/HTMLDirectoryElement.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
package org.htmlunit.javascript.host.html;
1616

1717
import org.htmlunit.html.HtmlDirectory;
18+
import org.htmlunit.javascript.JavaScriptEngine;
1819
import org.htmlunit.javascript.configuration.JsxClass;
1920
import org.htmlunit.javascript.configuration.JsxConstructor;
21+
import org.htmlunit.javascript.configuration.JsxGetter;
22+
import org.htmlunit.javascript.configuration.JsxSetter;
2023

2124
/**
2225
* The JavaScript object {@code HTMLDirectoryElement}.
@@ -26,7 +29,7 @@
2629
* @author Frank Danek
2730
*/
2831
@JsxClass(domClass = HtmlDirectory.class)
29-
public class HTMLDirectoryElement extends HTMLListElement {
32+
public class HTMLDirectoryElement extends HTMLElement {
3033

3134
/**
3235
* JavaScript constructor.
@@ -36,4 +39,27 @@ public class HTMLDirectoryElement extends HTMLListElement {
3639
public void jsConstructor() {
3740
super.jsConstructor();
3841
}
42+
43+
/**
44+
* Returns the value of the {@code compact} attribute.
45+
* @return the value of the {@code compact} attribute
46+
*/
47+
@JsxGetter
48+
public boolean isCompact() {
49+
return getDomNodeOrDie().hasAttribute("compact");
50+
}
51+
52+
/**
53+
* Sets the value of the {@code compact} attribute.
54+
* @param compact the value of the {@code compact} attribute
55+
*/
56+
@JsxSetter
57+
public void setCompact(final Object compact) {
58+
if (JavaScriptEngine.toBoolean(compact)) {
59+
getDomNodeOrDie().setAttribute("compact", "");
60+
}
61+
else {
62+
getDomNodeOrDie().removeAttribute("compact");
63+
}
64+
}
3965
}

src/main/java/org/htmlunit/javascript/host/html/HTMLLIElement.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import org.htmlunit.html.HtmlListItem;
1818
import org.htmlunit.javascript.configuration.JsxClass;
1919
import org.htmlunit.javascript.configuration.JsxConstructor;
20+
import org.htmlunit.javascript.configuration.JsxGetter;
21+
import org.htmlunit.javascript.configuration.JsxSetter;
2022

2123
/**
2224
* The JavaScript object {@code HTMLLIElement}.
@@ -35,4 +37,22 @@ public class HTMLLIElement extends HTMLElement {
3537
public void jsConstructor() {
3638
super.jsConstructor();
3739
}
40+
41+
/**
42+
* Returns the value of the {@code type} property.
43+
* @return the value of the {@code type} property
44+
*/
45+
@JsxGetter
46+
public String getType() {
47+
return getDomNodeOrDie().getAttributeDirect("type");
48+
}
49+
50+
/**
51+
* Sets the value of the {@code type} property.
52+
* @param type the value of the {@code type} property
53+
*/
54+
@JsxSetter
55+
public void setType(final String type) {
56+
getDomNodeOrDie().setAttribute("type", type);
57+
}
3858
}

src/main/java/org/htmlunit/javascript/host/html/HTMLListElement.java

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

src/main/java/org/htmlunit/javascript/host/html/HTMLMenuElement.java

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@
1818

1919
import org.htmlunit.html.DomElement;
2020
import org.htmlunit.html.HtmlMenu;
21+
import org.htmlunit.javascript.JavaScriptEngine;
2122
import org.htmlunit.javascript.configuration.JsxClass;
2223
import org.htmlunit.javascript.configuration.JsxConstructor;
24+
import org.htmlunit.javascript.configuration.JsxGetter;
25+
import org.htmlunit.javascript.configuration.JsxSetter;
2326

2427
/**
2528
* The JavaScript object {@code HTMLMenuElement}.
@@ -29,7 +32,7 @@
2932
* @author Ronald Brill
3033
*/
3134
@JsxClass(domClass = HtmlMenu.class)
32-
public class HTMLMenuElement extends HTMLListElement {
35+
public class HTMLMenuElement extends HTMLElement {
3336

3437
/**
3538
* JavaScript constructor.
@@ -44,8 +47,7 @@ public void jsConstructor() {
4447
* Returns the value of the {@code type} property.
4548
* @return the value of the {@code type} property
4649
*/
47-
@Override
48-
public String getType() {
50+
protected String getType() {
4951
final String type = getDomNodeOrDie().getAttributeDirect("type");
5052
if (getBrowserVersion().hasFeature(JS_MENU_TYPE_PASS)) {
5153
return type;
@@ -65,8 +67,7 @@ public String getType() {
6567
* Sets the value of the {@code type} property.
6668
* @param type the value of the {@code type} property
6769
*/
68-
@Override
69-
public void setType(final String type) {
70+
protected void setType(final String type) {
7071
if (getBrowserVersion().hasFeature(JS_MENU_TYPE_PASS)) {
7172
getDomNodeOrDie().setAttribute(DomElement.TYPE_ATTRIBUTE, type);
7273
return;
@@ -83,4 +84,27 @@ public void setType(final String type) {
8384

8485
getDomNodeOrDie().setAttribute(DomElement.TYPE_ATTRIBUTE, "list");
8586
}
87+
88+
/**
89+
* Returns the value of the {@code compact} attribute.
90+
* @return the value of the {@code compact} attribute
91+
*/
92+
@JsxGetter
93+
public boolean isCompact() {
94+
return getDomNodeOrDie().hasAttribute("compact");
95+
}
96+
97+
/**
98+
* Sets the value of the {@code compact} attribute.
99+
* @param compact the value of the {@code compact} attribute
100+
*/
101+
@JsxSetter
102+
public void setCompact(final Object compact) {
103+
if (JavaScriptEngine.toBoolean(compact)) {
104+
getDomNodeOrDie().setAttribute("compact", "");
105+
}
106+
else {
107+
getDomNodeOrDie().removeAttribute("compact");
108+
}
109+
}
86110
}

src/main/java/org/htmlunit/javascript/host/html/HTMLOListElement.java

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package org.htmlunit.javascript.host.html;
1616

1717
import org.htmlunit.html.HtmlOrderedList;
18+
import org.htmlunit.javascript.JavaScriptEngine;
1819
import org.htmlunit.javascript.configuration.JsxClass;
1920
import org.htmlunit.javascript.configuration.JsxConstructor;
2021
import org.htmlunit.javascript.configuration.JsxGetter;
@@ -27,7 +28,7 @@
2728
* @author Ronald Brill
2829
*/
2930
@JsxClass(domClass = HtmlOrderedList.class)
30-
public class HTMLOListElement extends HTMLListElement {
31+
public class HTMLOListElement extends HTMLElement {
3132

3233
/**
3334
* JavaScript constructor.
@@ -39,24 +40,43 @@ public void jsConstructor() {
3940
}
4041

4142
/**
42-
* Returns the value of the {@code type} attribute.
43-
*
44-
* @return the value of the {@code type} attribute
43+
* Returns the value of the {@code type} property.
44+
* @return the value of the {@code type} property
4545
*/
46-
@Override
4746
@JsxGetter
4847
public String getType() {
49-
return super.getType();
48+
return getDomNodeOrDie().getAttributeDirect("type");
5049
}
5150

5251
/**
53-
* Sets the value of the {@code type} attribute.
54-
*
55-
* @param type the value of the {@code type} attribute
52+
* Sets the value of the {@code type} property.
53+
* @param type the value of the {@code type} property
5654
*/
57-
@Override
5855
@JsxSetter
5956
public void setType(final String type) {
60-
super.setType(type);
57+
getDomNodeOrDie().setAttribute("type", type);
58+
}
59+
60+
/**
61+
* Returns the value of the {@code compact} attribute.
62+
* @return the value of the {@code compact} attribute
63+
*/
64+
@JsxGetter
65+
public boolean isCompact() {
66+
return getDomNodeOrDie().hasAttribute("compact");
67+
}
68+
69+
/**
70+
* Sets the value of the {@code compact} attribute.
71+
* @param compact the value of the {@code compact} attribute
72+
*/
73+
@JsxSetter
74+
public void setCompact(final Object compact) {
75+
if (JavaScriptEngine.toBoolean(compact)) {
76+
getDomNodeOrDie().setAttribute("compact", "");
77+
}
78+
else {
79+
getDomNodeOrDie().removeAttribute("compact");
80+
}
6181
}
6282
}

0 commit comments

Comments
 (0)