Skip to content

Commit b44dd85

Browse files
committed
time to remove IE (issue #735)
1 parent 4a68f5b commit b44dd85

7 files changed

Lines changed: 14 additions & 131 deletions

File tree

src/main/java/org/htmlunit/BrowserVersionFeatures.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import static org.htmlunit.javascript.configuration.SupportedBrowser.EDGE;
1919
import static org.htmlunit.javascript.configuration.SupportedBrowser.FF;
2020
import static org.htmlunit.javascript.configuration.SupportedBrowser.FF_ESR;
21-
import static org.htmlunit.javascript.configuration.SupportedBrowser.IE;
2221

2322
import org.htmlunit.javascript.configuration.BrowserFeature;
2423

@@ -201,14 +200,6 @@ public enum BrowserVersionFeatures {
201200
@BrowserFeature({CHROME, EDGE})
202201
HTML_COMMAND_TAG,
203202

204-
/** HTML parser supports the 'isindex' tag. */
205-
@BrowserFeature(IE)
206-
HTML_ISINDEX_TAG,
207-
208-
/** HTML parser supports the 'main' tag. */
209-
@BrowserFeature(IE)
210-
HTML_MAIN_TAG,
211-
212203
/** Additionally support dates in format "d/M/yyyy". */
213204
@BrowserFeature({FF, FF_ESR})
214205
HTTP_COOKIE_EXTENDED_DATE_PATTERNS_1,
@@ -319,10 +310,6 @@ public enum BrowserVersionFeatures {
319310
@BrowserFeature({FF, FF_ESR})
320311
JS_FORM_DISPATCHEVENT_SUBMITS,
321312

322-
/** Support for document.formName('inputName'). */
323-
@BrowserFeature(IE)
324-
JS_FORM_USABLE_AS_FUNCTION,
325-
326313
/** HTMLObject Validity isValid ignores custom error property. */
327314
@BrowserFeature({CHROME, EDGE})
328315
JS_HTML_OBJECT_VALIDITYSTATE_ISVALID_IGNORES_CUSTOM_ERROR,

src/main/java/org/htmlunit/html/parser/neko/HtmlUnitNekoDOMBuilder.java

Lines changed: 8 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
package org.htmlunit.html.parser.neko;
1616

1717
import static org.htmlunit.BrowserVersionFeatures.HTML_COMMAND_TAG;
18-
import static org.htmlunit.BrowserVersionFeatures.HTML_ISINDEX_TAG;
19-
import static org.htmlunit.BrowserVersionFeatures.HTML_MAIN_TAG;
2018

2119
import java.io.IOException;
2220
import java.io.StringReader;
@@ -27,7 +25,6 @@
2725
import java.util.Locale;
2826

2927
import org.apache.commons.lang3.ArrayUtils;
30-
import org.apache.commons.lang3.tuple.Triple;
3128
import org.htmlunit.BrowserVersion;
3229
import org.htmlunit.ObjectInstantiationException;
3330
import org.htmlunit.WebClient;
@@ -37,7 +34,6 @@
3734
import org.htmlunit.cyberneko.HTMLEventInfo;
3835
import org.htmlunit.cyberneko.HTMLScanner;
3936
import org.htmlunit.cyberneko.HTMLTagBalancingListener;
40-
import org.htmlunit.cyberneko.util.FastHashMap;
4137
import org.htmlunit.cyberneko.xerces.parsers.AbstractSAXParser;
4238
import org.htmlunit.cyberneko.xerces.xni.Augmentations;
4339
import org.htmlunit.cyberneko.xerces.xni.QName;
@@ -102,86 +98,32 @@ final class HtmlUnitNekoDOMBuilder extends AbstractSAXParser
10298
implements ContentHandler, LexicalHandler, HTMLTagBalancingListener, HTMLParserDOMBuilder {
10399

104100
// cache Neko Elements for performance and memory efficiency
105-
private static final FastHashMap<Triple<Boolean, Boolean, Boolean>, HTMLElements>
106-
HTMLELEMENTS_CACHE = new FastHashMap<>();
101+
private static final HTMLElements HTMLELEMENTS;
102+
private static final HTMLElements HTMLELEMENTS_WITH_CMD;
107103

108104
static {
109105
// continue short code enumeration
110106
final short isIndexShortCode = HTMLElements.UNKNOWN + 1;
111-
112107
final short commandShortCode = isIndexShortCode + 1;
113-
final short mainShortCode = commandShortCode + 1;
114108

115109
// isIndex is special - we have to add it here because all browsers moving this to
116110
// the body (even if it is not supported)
117111
final HTMLElements.Element isIndex = new HTMLElements.Element(isIndexShortCode, "ISINDEX",
118112
HTMLElements.Element.CONTAINER, HTMLElements.BODY, null);
119-
final HTMLElements.Element isIndexSupported = new HTMLElements.Element(isIndexShortCode, "ISINDEX",
120-
HTMLElements.Element.BLOCK, HTMLElements.BODY, new short[] {isIndexShortCode});
121113

122114
final HTMLElements.Element command = new HTMLElements.Element(commandShortCode, "COMMAND",
123115
HTMLElements.Element.EMPTY, new short[] {HTMLElements.BODY, HTMLElements.HEAD}, null);
124-
final HTMLElements.Element main = new HTMLElements.Element(mainShortCode, "MAIN",
125-
HTMLElements.Element.INLINE, HTMLElements.BODY, null);
126116

127-
Triple<Boolean, Boolean, Boolean> key;
128117
HTMLElements value;
129118

130-
// !COMMAND_TAG !ISINDEX_TAG !MAIN_TAG
131-
key = Triple.of(Boolean.FALSE, Boolean.FALSE, Boolean.FALSE);
132119
value = new HTMLElements();
133120
value.setElement(isIndex);
134-
HTMLELEMENTS_CACHE.put(key, value);
135-
136-
// !COMMAND_TAG !ISINDEX_TAG MAIN_TAG
137-
key = Triple.of(Boolean.FALSE, Boolean.FALSE, Boolean.TRUE);
138-
value = new HTMLElements();
139-
value.setElement(main);
140-
value.setElement(isIndex);
141-
HTMLELEMENTS_CACHE.put(key, value);
142-
143-
// !COMMAND_TAG ISINDEX_TAG !MAIN_TAG
144-
key = Triple.of(Boolean.FALSE, Boolean.TRUE, Boolean.FALSE);
145-
value = new HTMLElements();
146-
value.setElement(isIndexSupported);
147-
HTMLELEMENTS_CACHE.put(key, value);
148-
149-
// !COMMAND_TAG ISINDEX_TAG MAIN_TAG
150-
key = Triple.of(Boolean.FALSE, Boolean.TRUE, Boolean.TRUE);
151-
value = new HTMLElements();
152-
value.setElement(isIndexSupported);
153-
value.setElement(main);
154-
HTMLELEMENTS_CACHE.put(key, value);
121+
HTMLELEMENTS = value;
155122

156-
// COMMAND_TAG !ISINDEX_TAG !MAIN_TAG
157-
key = Triple.of(Boolean.TRUE, Boolean.FALSE, Boolean.FALSE);
158123
value = new HTMLElements();
159124
value.setElement(command);
160125
value.setElement(isIndex);
161-
HTMLELEMENTS_CACHE.put(key, value);
162-
163-
// COMMAND_TAG !ISINDEX_TAG MAIN_TAG
164-
key = Triple.of(Boolean.TRUE, Boolean.FALSE, Boolean.TRUE);
165-
value = new HTMLElements();
166-
value.setElement(command);
167-
value.setElement(isIndex);
168-
value.setElement(main);
169-
HTMLELEMENTS_CACHE.put(key, value);
170-
171-
// COMMAND_TAG ISINDEX_TAG !MAIN_TAG
172-
key = Triple.of(Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);
173-
value = new HTMLElements();
174-
value.setElement(command);
175-
value.setElement(isIndexSupported);
176-
HTMLELEMENTS_CACHE.put(key, value);
177-
178-
// COMMAND_TAG ISINDEX_TAG MAIN_TAG
179-
key = Triple.of(Boolean.TRUE, Boolean.TRUE, Boolean.TRUE);
180-
value = new HTMLElements();
181-
value.setElement(command);
182-
value.setElement(isIndexSupported);
183-
value.setElement(main);
184-
HTMLELEMENTS_CACHE.put(key, value);
126+
HTMLELEMENTS_WITH_CMD = value;
185127
}
186128

187129
private enum HeadParsed { YES, SYNTHESIZED, NO }
@@ -276,11 +218,10 @@ public void pushInputString(final String html) {
276218
* @return the configuration
277219
*/
278220
private static XMLParserConfiguration createConfiguration(final BrowserVersion browserVersion) {
279-
final HTMLElements elements = HTMLELEMENTS_CACHE.get(
280-
Triple.of(browserVersion.hasFeature(HTML_COMMAND_TAG),
281-
browserVersion.hasFeature(HTML_ISINDEX_TAG),
282-
browserVersion.hasFeature(HTML_MAIN_TAG)));
283-
return new HTMLConfiguration(elements);
221+
if (browserVersion.hasFeature(HTML_COMMAND_TAG)) {
222+
return new HTMLConfiguration(HTMLELEMENTS_WITH_CMD);
223+
}
224+
return new HTMLConfiguration(HTMLELEMENTS);
284225
}
285226

286227
/**

src/main/java/org/htmlunit/javascript/host/Location.java

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

1717
import static org.htmlunit.BrowserVersionFeatures.JS_LOCATION_RELOAD_REFERRER;
18-
import static org.htmlunit.javascript.configuration.SupportedBrowser.IE;
1918

2019
import java.io.IOException;
2120
import java.lang.reflect.Method;
@@ -35,9 +34,6 @@
3534
import org.htmlunit.javascript.HtmlUnitScriptable;
3635
import org.htmlunit.javascript.configuration.JsxClass;
3736
import org.htmlunit.javascript.configuration.JsxConstructor;
38-
import org.htmlunit.javascript.configuration.JsxFunction;
39-
import org.htmlunit.javascript.configuration.JsxGetter;
40-
import org.htmlunit.javascript.configuration.JsxSetter;
4137
import org.htmlunit.javascript.host.event.Event;
4238
import org.htmlunit.javascript.host.event.HashChangeEvent;
4339
import org.htmlunit.protocol.javascript.JavaScriptURLConnection;
@@ -214,7 +210,6 @@ public Object getDefaultValue(final Class<?> hint) {
214210
* @throws IOException if loading the specified location fails
215211
* @see <a href="http://msdn.microsoft.com/en-us/library/ms536342.aspx">MSDN Documentation</a>
216212
*/
217-
@JsxFunction(IE)
218213
public void assign(final String url) throws IOException {
219214
setHref(url);
220215
}
@@ -226,7 +221,6 @@ public void assign(final String url) throws IOException {
226221
* @throws IOException if there is a problem reloading the page
227222
* @see <a href="http://msdn.microsoft.com/en-us/library/ms536342.aspx">MSDN Documentation</a>
228223
*/
229-
@JsxFunction(IE)
230224
public void reload(final boolean force) throws IOException {
231225
final WebWindow webWindow = window_.getWebWindow();
232226
final HtmlPage htmlPage = (HtmlPage) webWindow.getEnclosedPage();
@@ -245,7 +239,6 @@ public void reload(final boolean force) throws IOException {
245239
* @throws IOException if loading the specified location fails
246240
* @see <a href="http://msdn.microsoft.com/en-us/library/ms536712.aspx">MSDN Documentation</a>
247241
*/
248-
@JsxFunction(IE)
249242
public void replace(final String url) throws IOException {
250243
window_.getWebWindow().getHistory().removeCurrent();
251244
setHref(url);
@@ -255,7 +248,6 @@ public void replace(final String url) throws IOException {
255248
* Returns the location URL.
256249
* @return the location URL
257250
*/
258-
@JsxFunction(functionName = "toString", value = IE)
259251
public String jsToString() {
260252
if (window_ != null) {
261253
return getHref();
@@ -268,7 +260,6 @@ public String jsToString() {
268260
* @return the location URL
269261
* @see <a href="http://msdn.microsoft.com/en-us/library/ms533867.aspx">MSDN Documentation</a>
270262
*/
271-
@JsxGetter(IE)
272263
public String getHref() {
273264
final WebWindow webWindow = window_.getWebWindow();
274265
final Page page = webWindow.getEnclosedPage();
@@ -303,7 +294,6 @@ public String getHref() {
303294
* @throws IOException if loading the specified location fails
304295
* @see <a href="http://msdn.microsoft.com/en-us/library/ms533867.aspx">MSDN Documentation</a>
305296
*/
306-
@JsxSetter(IE)
307297
public void setHref(final String newLocation) throws IOException {
308298
WebWindow webWindow = getWindow(getStartingScope()).getWebWindow();
309299
final HtmlPage page = (HtmlPage) webWindow.getEnclosedPage();
@@ -341,7 +331,6 @@ public void setHref(final String newLocation) throws IOException {
341331
* @return the search portion of the location URL
342332
* @see <a href="http://msdn.microsoft.com/en-us/library/ms534620.aspx">MSDN Documentation</a>
343333
*/
344-
@JsxGetter(IE)
345334
public String getSearch() {
346335
final String search = getUrl().getQuery();
347336
if (search == null) {
@@ -356,7 +345,6 @@ public String getSearch() {
356345
* @throws Exception if an error occurs
357346
* @see <a href="http://msdn.microsoft.com/en-us/library/ms534620.aspx">MSDN Documentation</a>
358347
*/
359-
@JsxSetter(IE)
360348
public void setSearch(final String search) throws Exception {
361349
setUrl(UrlUtils.getUrlWithNewQuery(getUrl(), search));
362350
}
@@ -366,7 +354,6 @@ public void setSearch(final String search) throws Exception {
366354
* @return the hash portion of the location URL
367355
* @see <a href="http://msdn.microsoft.com/en-us/library/ms533775.aspx">MSDN Documentation</a>
368356
*/
369-
@JsxGetter(IE)
370357
public String getHash() {
371358
String hash = hash_;
372359

@@ -400,7 +387,6 @@ private String getHash(final boolean encoded) {
400387
* @param hash the new hash portion of the location URL
401388
* @see <a href="http://msdn.microsoft.com/en-us/library/ms533775.aspx">MSDN Documentation</a>
402389
*/
403-
@JsxSetter(IE)
404390
public void setHash(final String hash) {
405391
// IMPORTANT: This method must not call setUrl(), because
406392
// we must not hit the server just to change the hash!
@@ -454,7 +440,6 @@ private static String decodeHash(final String hash) {
454440
* @return the hostname portion of the location URL
455441
* @see <a href="http://msdn.microsoft.com/en-us/library/ms533785.aspx">MSDN Documentation</a>
456442
*/
457-
@JsxGetter(IE)
458443
public String getHostname() {
459444
return getUrl().getHost();
460445
}
@@ -465,7 +450,6 @@ public String getHostname() {
465450
* @throws Exception if an error occurs
466451
* @see <a href="http://msdn.microsoft.com/en-us/library/ms533785.aspx">MSDN Documentation</a>
467452
*/
468-
@JsxSetter(IE)
469453
public void setHostname(final String hostname) throws Exception {
470454
setUrl(UrlUtils.getUrlWithNewHost(getUrl(), hostname));
471455
}
@@ -475,7 +459,6 @@ public void setHostname(final String hostname) throws Exception {
475459
* @return the host portion of the location URL
476460
* @see <a href="http://msdn.microsoft.com/en-us/library/ms533784.aspx">MSDN Documentation</a>
477461
*/
478-
@JsxGetter(IE)
479462
public String getHost() {
480463
final URL url = getUrl();
481464
final int port = url.getPort();
@@ -493,7 +476,6 @@ public String getHost() {
493476
* @throws Exception if an error occurs
494477
* @see <a href="http://msdn.microsoft.com/en-us/library/ms533784.aspx">MSDN Documentation</a>
495478
*/
496-
@JsxSetter(IE)
497479
public void setHost(final String host) throws Exception {
498480
final String hostname;
499481
final int port;
@@ -515,7 +497,6 @@ public void setHost(final String host) throws Exception {
515497
* @return the pathname portion of the location URL
516498
* @see <a href="http://msdn.microsoft.com/en-us/library/ms534332.aspx">MSDN Documentation</a>
517499
*/
518-
@JsxGetter(IE)
519500
public String getPathname() {
520501
if (UrlUtils.URL_ABOUT_BLANK == getUrl()) {
521502
return "blank";
@@ -529,7 +510,6 @@ public String getPathname() {
529510
* @throws Exception if an error occurs
530511
* @see <a href="http://msdn.microsoft.com/en-us/library/ms534332.aspx">MSDN Documentation</a>
531512
*/
532-
@JsxSetter(IE)
533513
public void setPathname(final String pathname) throws Exception {
534514
setUrl(UrlUtils.getUrlWithNewPath(getUrl(), pathname));
535515
}
@@ -539,7 +519,6 @@ public void setPathname(final String pathname) throws Exception {
539519
* @return the port portion of the location URL
540520
* @see <a href="http://msdn.microsoft.com/en-us/library/ms534342.aspx">MSDN Documentation</a>
541521
*/
542-
@JsxGetter(IE)
543522
public String getPort() {
544523
final int port = getUrl().getPort();
545524
if (port == -1) {
@@ -554,7 +533,6 @@ public String getPort() {
554533
* @throws Exception if an error occurs
555534
* @see <a href="http://msdn.microsoft.com/en-us/library/ms534342.aspx">MSDN Documentation</a>
556535
*/
557-
@JsxSetter(IE)
558536
public void setPort(final String port) throws Exception {
559537
setUrl(UrlUtils.getUrlWithNewPort(getUrl(), Integer.parseInt(port)));
560538
}
@@ -564,7 +542,6 @@ public void setPort(final String port) throws Exception {
564542
* @return the protocol portion of the location URL, including the trailing ':'
565543
* @see <a href="http://msdn.microsoft.com/en-us/library/ms534353.aspx">MSDN Documentation</a>
566544
*/
567-
@JsxGetter(IE)
568545
public String getProtocol() {
569546
return getUrl().getProtocol() + ":";
570547
}
@@ -575,7 +552,6 @@ public String getProtocol() {
575552
* @throws Exception if an error occurs
576553
* @see <a href="http://msdn.microsoft.com/en-us/library/ms534353.aspx">MSDN Documentation</a>
577554
*/
578-
@JsxSetter(IE)
579555
public void setProtocol(final String protocol) throws Exception {
580556
setUrl(UrlUtils.getUrlWithNewProtocol(getUrl(), protocol));
581557
}
@@ -609,7 +585,6 @@ private void setUrl(final URL url) throws IOException {
609585
* Returns the {@code origin} property.
610586
* @return the {@code origin} property
611587
*/
612-
@JsxGetter(IE)
613588
public String getOrigin() {
614589
return getUrl().getProtocol() + "://" + getHost();
615590
}

src/main/java/org/htmlunit/javascript/host/css/CSSStyleDeclaration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,7 @@ public void setRight(final Object right) {
17491749
* Gets the {@code rubyAlign} style attribute.
17501750
* @return the style attribute
17511751
*/
1752-
@JsxGetter({IE, FF, FF_ESR})
1752+
@JsxGetter({FF, FF_ESR})
17531753
public String getRubyAlign() {
17541754
if (styleDeclaration_ == null) {
17551755
return null; // prototype
@@ -1761,7 +1761,7 @@ public String getRubyAlign() {
17611761
* Sets the {@code rubyAlign} style attribute.
17621762
* @param rubyAlign the new attribute
17631763
*/
1764-
@JsxSetter({IE, FF, FF_ESR})
1764+
@JsxSetter({FF, FF_ESR})
17651765
public void setRubyAlign(final String rubyAlign) {
17661766
setStyleAttribute(Definition.RUBY_ALIGN.getAttributeName(), rubyAlign);
17671767
}

src/main/java/org/htmlunit/javascript/host/dom/Document.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1951,7 +1951,7 @@ private static Date parseDateOrNow(final String stringDate) {
19511951
/**
19521952
* Mock for the moment.
19531953
*/
1954-
@JsxFunction({FF, FF_ESR, IE})
1954+
@JsxFunction({FF, FF_ESR})
19551955
public void releaseCapture() {
19561956
}
19571957

0 commit comments

Comments
 (0)