From: <rb...@us...> - 2013-11-13 21:48:55
|
Revision: 8779 http://sourceforge.net/p/htmlunit/code/8779 Author: rbri Date: 2013-11-13 21:48:50 +0000 (Wed, 13 Nov 2013) Log Message: ----------- remove all BrowserFeatures no longer in use Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebWindowImpl.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOption.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Document.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DocumentType.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/HashChangeEvent.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Storage.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLButtonElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSelectElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTextAreaElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLSerializer.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionFeaturesTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -42,9 +42,6 @@ @BrowserFeature(@WebBrowser(IE)) ANCHOR_EMPTY_HREF_NO_FILENAME, - /** Indicates that a blur event should be triggered before an onchange event. */ - BLUR_BEFORE_ONCHANGE, - /** If the "type" attribute of HtmlButton should be evaluated to 'button' if not specified. */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) BUTTON_EMPTY_TYPE_BUTTON, @@ -115,13 +112,6 @@ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 10) }) CSS_TEXT_SHADOW_DEFAULT_NONE, - /** Default is 'normal'. */ - CSS_WORD_SPACING_DEFAULT_NORMAL, - - /** Values for the zIndex are rounded to integer. */ - @BrowserFeature(@WebBrowser(value = IE, maxVersion = 7)) - CSS_ZINDEX_ROUNDED, - /** IE uses the type Number for the zIndex Values (instead of String). */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) CSS_ZINDEX_TYPE_NUMBER, @@ -142,10 +132,6 @@ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) DISPLAYED_COLLAPSE, - /** FF 3.6 has a much lager menu bar. */ - @BrowserFeature({ @WebBrowser(value = FF, minVersion = 3.6f, maxVersion = 3.6f) }) - DISPLAY_LARGE_MENU_BAR, - /** */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) DOCTYPE_4_0_TRANSITIONAL_STANDARDS, @@ -223,10 +209,6 @@ EVENT_ONMOUSEDOWN_FOR_SELECT_OPTION_TRIGGERS_ADDITIONAL_DOWN_FOR_SELECT, /** Does not trigger "onmousedown" event handler for the select options. */ - @BrowserFeature({ }) - EVENT_ONMOUSEDOWN_FOR_SELECT_OPTION_TRIGGERS_ADDITIONAL_UP_FOR_SELECT, - - /** Does not trigger "onmousedown" event handler for the select options. */ @BrowserFeature({ @WebBrowser(IE), @WebBrowser(CHROME), @WebBrowser(value = FF, maxVersion = 3.6f) }) EVENT_ONMOUSEDOWN_NOT_FOR_SELECT_OPTION, @@ -274,13 +256,6 @@ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) FORMFIELD_REACHABLE_BY_NEW_NAMES, - /** - * Special behavior of IE6; the URL submitted by a form with method type 'GET' has - * a question mark at the end if there are no parameters. - */ - @BrowserFeature(@WebBrowser(value = IE, maxVersion = 6)) - FORM_SUBMISSION_URL_END_WITH_QUESTIONMARK, - /** Form submit is done without the hash part of the form action url. */ @BrowserFeature(@WebBrowser(IE)) FORM_SUBMISSION_URL_WITHOUT_HASH, @@ -501,10 +476,6 @@ @BrowserFeature(@WebBrowser(IE)) HTMLBGSOUND, - /** Set this checked state back to default when added to page (IE6). */ - @BrowserFeature(@WebBrowser(value = IE, maxVersion = 7)) - HTMLCHECKEDINPUT_SET_CHECKED_TO_DEFAULT_WHEN_ADDED, - /** Set this checked state to false when added to page (IE). */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) HTMLCHECKEDINPUT_SET_CHECKED_TO_FALSE_WHEN_CLONE, @@ -565,9 +536,6 @@ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 10) }) HTMLELEMENT_OUTER_INNER_HTML_QUOTE_ATTRIBUTES, - /** */ - HTMLELEMENT_TRIM_CLASS_ATTRIBUTE, - /** * Indicates if a self-closing <iframe/> tag should be considered as an opening tag. **/ @@ -620,10 +588,6 @@ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) HTMLSCRIPT_APPLICATION_JAVASCRIPT, - /** Runs <script src="javascript:'[code]'">. */ - @BrowserFeature(@WebBrowser(value = IE, maxVersion = 6)) - HTMLSCRIPT_SRC_JAVASCRIPT, - /** Trims the value of the type attribute before to verify it. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) HTMLSCRIPT_TRIM_TYPE, @@ -739,10 +703,6 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_BUTTON_SET_TYPE_THROWS_EXCEPTION, - /** IE uses the content of a button tag as value instead of the attribute. */ - @BrowserFeature(@WebBrowser(value = IE, maxVersion = 7)) - JS_BUTTON_USE_CONTENT_AS_VALUE, - /** Indicates that the browser emulates the char attribute. */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_CHAR_EMULATED, @@ -751,15 +711,6 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_CHAR_OFF_EMULATED, - /** Indicates that the browser tries to convert the char attribute values - * to integer. */ - @BrowserFeature(@WebBrowser(value = FF, maxVersion = 3.6f)) - JS_CHAR_OFF_INTEGER, - - /** Indicates that the browser returns a dot if the char attribute is not defined. */ - @BrowserFeature(@WebBrowser(value = FF, maxVersion = 3.6f)) - JS_CHAR_UNDEFINED_DOT, - /** Indicates that the click method call does not trigger the onchange * event handlers for checkboxes. */ @BrowserFeature(@WebBrowser(IE)) @@ -807,9 +758,6 @@ @BrowserFeature({@WebBrowser(value = FF, maxVersion = 3.6f), @WebBrowser(value = IE, minVersion = 10) }) JS_DOCTYPE_ENTITIES_NULL, - /** Javascript doctyp.internalSubset returns an empty string (IE). */ - JS_DOCTYPE_INTERNALSUBSET_EMPTY_STRING, - /** Javascript doctyp.notations returns an empty string (IE). */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_DOCTYPE_NOTATIONS_EMPTY_STRING, @@ -936,10 +884,6 @@ @BrowserFeature(@WebBrowser(IE)) JS_FUNCTION_DECLARED_FORWARD_IN_BLOCK, - /** Indicates if the method isXmlName exists in the window scope. */ - @BrowserFeature(@WebBrowser(value = FF, maxVersion = 10)) - JS_FUNCTION_ISXMLNAME, - /** * Indicates that function can be defined as * <code>function object.property() {}</code> instead of <code>object.property = function() {}</code>. @@ -971,10 +915,6 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_GET_ELEMENTS_BY_TAG_NAME_NOT_SUPPORTS_NAMESPACES, - /** Javascript function getElementById calls getElementByName if nothing found by id. */ - @BrowserFeature(@WebBrowser(value = IE, maxVersion = 6)) - JS_GET_ELEMENT_BY_ID_ALSO_BY_NAME, - /** Javascript function getElementById calls getElementByName if nothing found by id, only in quirks mode. */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_GET_ELEMENT_BY_ID_ALSO_BY_NAME_IN_QUICKS_MODE, @@ -983,10 +923,6 @@ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 10) }) JS_GET_ELEMENT_BY_ID_CASE_SENSITIVE, - /** Indicates that not defined function handler should be 'undefined', or 'null'. */ - @BrowserFeature(@WebBrowser(value = FF, maxVersion = 3.6f)) - JS_HANDLER_UNDEFINED, - /** Indicates that objects with prototype property available in window scope; Firefox does this. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 10) }) JS_HAS_OBJECT_WITH_PROTOTYPE_PROPERTY_IN_WINDOW_SCOPE, @@ -1104,10 +1040,6 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_PREFIX_RETURNS_EMPTY_WHEN_UNDEFINED, - /** Indicates that document.queryCommandSupported(..) is only available in design mode. */ - @BrowserFeature(@WebBrowser(value = FF, maxVersion = 3.6f)) - JS_QUERYCOMMAND_SUPPORTED_ONLY_DESIGNMODE, - /** Javascript script.text(...) reexecutes the script (IE). */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_SCRIPT_ALWAYS_REEXECUTE_ON_SET_TEXT, @@ -1151,12 +1083,6 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_SELECT_ADD_SECOND_PARAM_IS_INDEX, - /** Indicates if calling HTMLSelectElement.add without second parameter - * throws an exception. - */ - @BrowserFeature(@WebBrowser(value = FF, maxVersion = 3.6f)) - JS_SELECT_ADD_SECOND_PARAM_IS_REQUIRED, - /** Indicates if calling HTMLSelectElement.item with a negative value should throw. */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_SELECT_ITEM_THROWS_IF_NEGATIVE, @@ -1165,14 +1091,6 @@ @BrowserFeature(@WebBrowser(IE)) JS_SELECT_OPTIONS_HAS_CHILDNODES_PROPERTY, - /** Indicates if setting an out of bound value for HTMLSelectElement.selectedIndex should throw. */ - JS_SELECT_SELECTED_INDEX_THROWS_IF_BAD, - - /** Indicates that the set attribute method treads the synthetic - * empty attr for 'class' (IE6/7) as a normal one. */ - @BrowserFeature(@WebBrowser(value = IE, maxVersion = 7)) - JS_SET_ATTRIBUTE_CONSIDERS_ATTR_FOR_CLASS_AS_REAL, - /** Indicates that the set attribute method is able to update the event handlers also. * e.g. element.setAttribute("onclick", "test(1);"); */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 10) }) @@ -1222,18 +1140,6 @@ @BrowserFeature(@WebBrowser(IE)) JS_TABLE_VALIGN_SUPPORTS_IE_VALUES, - /** Getting the property cols returns 20, if the defined value is not convertible into an integer (IE). - * FF returns -1 in this case. - */ - @BrowserFeature(@WebBrowser(value = FF, maxVersion = 3.6f)) - JS_TEXT_AREA_COLS_RETURNS_MINUS1, - - /** Getting the property rows returns 2, if the defined value is not convertible into an integer (IE). - * FF returns -1 in this case. - */ - @BrowserFeature(@WebBrowser(value = FF, maxVersion = 3.6f)) - JS_TEXT_AREA_ROWS_RETURNS_MINUS1, - /** Setting the property cols throws an exception, if the provided value is less * than 0 (IE). * FF ignores the provided value in this case. @@ -1308,9 +1214,6 @@ @BrowserFeature(@WebBrowser(IE)) JS_XML_SERIALIZER_APPENDS_CRLF, - /** Indicates that new XMLSerializer().serializeToString(..) transforms the node name to upper case. */ - JS_XML_SERIALIZER_NODE_AS_UPPERCASE, - /** Indicates that new XMLSerializer().serializeToString(..) respects the XHTML definition for non empty tags. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) JS_XML_SERIALIZER_NON_EMPTY_TAGS, @@ -1382,10 +1285,6 @@ @BrowserFeature(@WebBrowser(FF)) SET_READONLY_PROPERTIES, - /** Indicates [object StorageObsolete] instead of [object Storage]. */ - @BrowserFeature({ @WebBrowser(value = FF, maxVersion = 10) }) - STORAGE_OBSOLETE, - /** Indicates that string.trim() is supported. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 10) }) STRING_TRIM, @@ -1474,9 +1373,6 @@ @BrowserFeature(@WebBrowser(IE)) XHR_ERRORHANDLER_NOT_SUPPORTED, - /** Indicates that 'this' corresponds to the handler function when a XMLHttpRequest handler is executed. */ - XHR_HANDLER_THIS_IS_FUNCTION, - /** Indicates if a same origin check should be skipped. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 8) }) XHR_IGNORE_SAME_ORIGIN, @@ -1530,8 +1426,4 @@ /** Indicates that the 'SelectionNamespaces' property is supported by XPath expressions. */ @BrowserFeature({ @WebBrowser(IE), @WebBrowser(CHROME) }) XPATH_SELECTION_NAMESPACES, - - /** Indicates if XUL is supported (FF only). */ - @BrowserFeature(@WebBrowser(value = FF, maxVersion = 3.6f)) - XUL_SUPPORT; } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebWindowImpl.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebWindowImpl.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebWindowImpl.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -14,8 +14,6 @@ */ package com.gargoylesoftware.htmlunit; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.DISPLAY_LARGE_MENU_BAR; - import java.util.ArrayList; import java.util.List; import java.util.ListIterator; @@ -77,11 +75,6 @@ WebAssert.notNull("webClient", webClient); webClient_ = webClient; jobManager_ = BackgroundJavaScriptFactory.theFactory().createJavaScriptJobManager(this); - - // adjust inner height for ff 3.6 - if (webClient.getBrowserVersion().hasFeature(DISPLAY_LARGE_MENU_BAR)) { - outerHeight_ = innerHeight_ + 166; - } } /** Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -17,7 +17,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.BUTTON_EMPTY_TYPE_BUTTON; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_INPUT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_PROPERTY_CHANGE; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLELEMENT_TRIM_CLASS_ATTRIBUTE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.KEYBOARD_EVENT_SPECIAL_KEYPRESS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.WINDOW_ACTIVE_ELEMENT_FOCUSED; @@ -110,12 +109,6 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); attributeListeners_ = new ArrayList<HtmlAttributeChangeListener>(); - if (page != null && hasFeature(HTMLELEMENT_TRIM_CLASS_ATTRIBUTE)) { - final String value = getAttribute("class"); - if (value != ATTRIBUTE_NOT_DEFINED) { - getAttributeNode("class").setValue(value.trim()); - } - } } /** Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -14,7 +14,6 @@ */ package com.gargoylesoftware.htmlunit.html; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.FORM_SUBMISSION_URL_END_WITH_QUESTIONMARK; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.FORM_SUBMISSION_URL_WITHOUT_HASH; import java.net.MalformedURLException; @@ -175,8 +174,7 @@ // action may already contain some query parameters: they have to be removed actionUrl = StringUtils.substringBefore(actionUrl, "#"); actionUrl = StringUtils.substringBefore(actionUrl, "?"); - if (browser.hasFeature(FORM_SUBMISSION_URL_END_WITH_QUESTIONMARK) - || queryFromFields.length() > 0) { + if (queryFromFields.length() > 0) { actionUrl += "?" + queryFromFields; } if (anchor.length() > 0 Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOption.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOption.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOption.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -18,8 +18,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONCLICK_FOR_SELECT_OPTION_ALSO; import static com.gargoylesoftware.htmlunit. BrowserVersionFeatures.EVENT_ONMOUSEDOWN_FOR_SELECT_OPTION_TRIGGERS_ADDITIONAL_DOWN_FOR_SELECT; -import static com.gargoylesoftware.htmlunit. - BrowserVersionFeatures.EVENT_ONMOUSEDOWN_FOR_SELECT_OPTION_TRIGGERS_ADDITIONAL_UP_FOR_SELECT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONMOUSEDOWN_NOT_FOR_SELECT_OPTION; import static com.gargoylesoftware.htmlunit. BrowserVersionFeatures.EVENT_ONMOUSEUP_FOR_SELECT_OPTION_TRIGGERS_ADDITIONAL_UP_FOR_SELECT; @@ -253,10 +251,6 @@ if (hasFeature(EVENT_ONMOUSEDOWN_FOR_SELECT_OPTION_TRIGGERS_ADDITIONAL_DOWN_FOR_SELECT)) { page = getEnclosingSelect().mouseDown(shiftKey, ctrlKey, altKey, button); } - if (hasFeature(EVENT_ONMOUSEDOWN_FOR_SELECT_OPTION_TRIGGERS_ADDITIONAL_UP_FOR_SELECT)) { - page = getEnclosingSelect().mouseUp(shiftKey, ctrlKey, altKey, button); - } - if (hasFeature(EVENT_ONMOUSEDOWN_NOT_FOR_SELECT_OPTION)) { return page; } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -14,7 +14,6 @@ */ package com.gargoylesoftware.htmlunit.html; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.BLUR_BEFORE_ONCHANGE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_DOM_CONTENT_LOADED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONLOAD_FRAMESET_FIRST; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONLOAD_IFRAME_CREATED_BY_JAVASCRIPT; @@ -1947,14 +1946,8 @@ } if (oldFocusedElement != null) { - if (hasFeature(BLUR_BEFORE_ONCHANGE)) { - oldFocusedElement.fireEvent(Event.TYPE_BLUR); - oldFocusedElement.removeFocus(); - } - else { // IE, FF3 - oldFocusedElement.removeFocus(); - oldFocusedElement.fireEvent(Event.TYPE_BLUR); - } + oldFocusedElement.removeFocus(); + oldFocusedElement.fireEvent(Event.TYPE_BLUR); } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -18,7 +18,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONLOAD_EXTERNAL_JAVASCRIPT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONREADY_STATE_CHANGE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLSCRIPT_APPLICATION_JAVASCRIPT; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLSCRIPT_SRC_JAVASCRIPT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLSCRIPT_TRIM_TYPE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_SCRIPT_ALWAYS_REEXECUTE_ON_SRC_CHANGE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_SCRIPT_SUPPORTS_FOR_AND_EVENT; @@ -374,7 +373,6 @@ } final HtmlPage page = (HtmlPage) getPage(); - final BrowserVersion browser = page.getWebClient().getBrowserVersion(); final String src = getSrcAttribute(); if (src.equals(SLASH_SLASH_COLON)) { @@ -382,24 +380,7 @@ } if (src != ATTRIBUTE_NOT_DEFINED) { - if (src.startsWith(JavaScriptURLConnection.JAVASCRIPT_PREFIX)) { - // <script src="javascript:'[code]'"></script> - if (browser.hasFeature(HTMLSCRIPT_SRC_JAVASCRIPT)) { - String code = StringUtils.removeStart(src, JavaScriptURLConnection.JAVASCRIPT_PREFIX).trim(); - final int len = code.length(); - if (len > 2) { - if ((code.charAt(0) == '\'' && code.charAt(len - 1) == '\'') - || (code.charAt(0) == '"' && code.charAt(len - 1) == '"')) { - code = code.substring(1, len - 1); - if (LOG.isDebugEnabled()) { - LOG.debug("Executing JavaScript: " + code); - } - page.executeJavaScriptIfPossible(code, code, getStartLineNumber()); - } - } - } - } - else { + if (!src.startsWith(JavaScriptURLConnection.JAVASCRIPT_PREFIX)) { // <script src="[url]"></script> if (LOG.isDebugEnabled()) { LOG.debug("Loading external JavaScript: " + src); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -21,7 +21,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DONT_ENUM_FUNCTIONS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ECMA5_FUNCTIONS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_FUNCTION_BIND; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_FUNCTION_ISXMLNAME; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_FUNCTION_TOSOURCE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_HAS_OBJECT_WITH_PROTOTYPE_PROPERTY_IN_WINDOW_SCOPE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML; @@ -319,9 +318,7 @@ removePrototypeProperties(window, "Number", "toSource"); removePrototypeProperties(window, "String", "toSource"); } - if (!browserVersion.hasFeature(JS_FUNCTION_ISXMLNAME)) { - deleteProperties(window, "isXMLName"); - } + deleteProperties(window, "isXMLName"); NativeFunctionToStringFunction.installFix(window, webClient.getBrowserVersion()); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Document.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Document.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Document.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -17,7 +17,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_CREATE_ELEMENT_EXTENDED_SYNTAX; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_DESIGN_MODE_INHERIT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_GET_ELEMENTS_BY_TAG_NAME_NOT_SUPPORTS_NAMESPACES; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XUL_SUPPORT; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; @@ -45,7 +44,6 @@ import com.gargoylesoftware.htmlunit.html.DomText; import com.gargoylesoftware.htmlunit.html.FrameWindow; import com.gargoylesoftware.htmlunit.html.HTMLParser; -import com.gargoylesoftware.htmlunit.html.HtmlDivision; import com.gargoylesoftware.htmlunit.html.HtmlInput; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.impl.SimpleRange; @@ -480,15 +478,11 @@ @JsxFunction({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 10) }) public Object createElementNS(final String namespaceURI, final String qualifiedName) { final org.w3c.dom.Element element; - final BrowserVersion browserVersion = getBrowserVersion(); if ("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul".equals(namespaceURI)) { - if (!browserVersion.hasFeature(XUL_SUPPORT)) { - throw Context.reportRuntimeError("XUL not available"); - } - // simple hack, no need to implement the XUL objects (at least in a first time) - element = new HtmlDivision(namespaceURI, qualifiedName, getPage(), null); + throw Context.reportRuntimeError("XUL not available"); } - else if (HTMLParser.XHTML_NAMESPACE.equals(namespaceURI) + + if (HTMLParser.XHTML_NAMESPACE.equals(namespaceURI) || HTMLParser.SVG_NAMESPACE.equals(namespaceURI)) { element = getPage().createElementNS(namespaceURI, qualifiedName); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DocumentType.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DocumentType.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DocumentType.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -16,7 +16,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCTYPE_ENTITIES_EMPTY_STRING; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCTYPE_ENTITIES_NULL; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCTYPE_INTERNALSUBSET_EMPTY_STRING; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCTYPE_NOTATIONS_EMPTY_STRING; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCTYPE_NOTATIONS_NULL; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; @@ -89,9 +88,6 @@ return subset; } - if (getBrowserVersion().hasFeature(JS_DOCTYPE_INTERNALSUBSET_EMPTY_STRING)) { - return ""; - } return null; } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -16,7 +16,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_37; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_GET_ATTRIBUTE_SUPPORTS_FLAGS_IN_QUIRKS_MODE; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_SET_ATTRIBUTE_CONSIDERS_ATTR_FOR_CLASS_AS_REAL; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; @@ -567,16 +566,8 @@ public Attr setAttributeNode(final Attr newAtt) { final String name = newAtt.getName(); - final Attr replacedAtt; - final boolean undefForClass = getBrowserVersion(). - hasFeature(JS_SET_ATTRIBUTE_CONSIDERS_ATTR_FOR_CLASS_AS_REAL); - if (undefForClass) { - replacedAtt = (Attr) getAttributeNode(name); - } - else { - final NamedNodeMap nodes = (NamedNodeMap) getAttributes(); - replacedAtt = (Attr) nodes.getNamedItemWithoutSytheticClassAttr(name); - } + final NamedNodeMap nodes = (NamedNodeMap) getAttributes(); + final Attr replacedAtt = (Attr) nodes.getNamedItemWithoutSytheticClassAttr(name); if (replacedAtt != null) { replacedAtt.detachFromParent(); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/HashChangeEvent.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/HashChangeEvent.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/HashChangeEvent.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -16,7 +16,6 @@ import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; -import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Storage.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Storage.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Storage.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -14,11 +14,6 @@ */ package com.gargoylesoftware.htmlunit.javascript.host; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.STORAGE_OBSOLETE; -import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; -import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; -import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; - import java.util.Arrays; import java.util.List; import java.util.Map; @@ -30,7 +25,6 @@ import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxFunction; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; -import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; /** * The JavaScript object that represents a Storage. @@ -154,17 +148,4 @@ public void clear() { getMap().clear(); } - - /** - * {@inheritDoc} - */ - @Override - public String getClassName() { - if (getWindow().getWebWindow() != null) { - if (getBrowserVersion().hasFeature(STORAGE_OBSOLETE)) { - return "StorageObsolete"; - } - } - return super.getClassName(); - } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -16,7 +16,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_133; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_EVENT_HANDLER_AS_PROPERTY_DONT_RECEIVE_EVENT; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_HANDLER_UNDEFINED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_WINDOW_CHANGE_OPENER_NOT_ALLOWED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_WINDOW_FRAMES_ACCESSIBLE_BY_ID; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_WINDOW_IS_A_FUNCTION; @@ -1249,11 +1248,7 @@ } private Object getHandlerForJavaScript(final String eventName) { - Object handler = getEventListenersContainer().getEventHandlerProp(eventName); - if (handler == null && getBrowserVersion().hasFeature(JS_HANDLER_UNDEFINED)) { - handler = Scriptable.NOT_FOUND; - } - return handler; + return getEventListenersContainer().getEventHandlerProp(eventName); } private void setHandlerForJavaScript(final String eventName, final Object handler) { Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -17,7 +17,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_IMAGE_URL_QUOTED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_PIXEL_VALUES_INT_ONLY; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_SUPPORTS_BEHAVIOR_PROPERTY; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_ZINDEX_ROUNDED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_ZINDEX_TYPE_NUMBER; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_ZINDEX_UNDEFINED_FORCES_RESET; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_ZINDEX_UNDEFINED_OR_NULL_THROWS_ERROR; @@ -3892,12 +3891,7 @@ throw new WrappedException(e); } } - if (getBrowserVersion().hasFeature(CSS_ZINDEX_ROUNDED)) { - setStyleAttribute(Z_INDEX, Integer.toString(Math.round(d.floatValue() - 0.00001f))); - } - else { - setStyleAttribute(Z_INDEX, Integer.toString(d.intValue())); - } + setStyleAttribute(Z_INDEX, Integer.toString(d.intValue())); return; } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -20,7 +20,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_DEFAULT_WIDTH_AUTO; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_FONT_STRECH_DEFAULT_NORMAL; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_TEXT_SHADOW_DEFAULT_NONE; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_WORD_SPACING_DEFAULT_NORMAL; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_GET_BACKGROUND_COLOR_FOR_COMPUTED_STYLE_AS_RGB; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_LENGTH_WITHOUT_PX; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.TREATS_POSITION_FIXED_LIKE_POSITION_STATIC; @@ -1745,12 +1744,7 @@ */ @Override public String getWordSpacing() { - String wordSpacing = "0px"; - if (getBrowserVersion().hasFeature(CSS_WORD_SPACING_DEFAULT_NORMAL)) { - wordSpacing = "normal"; - } - - return defaultIfEmpty(super.getWordSpacing(), wordSpacing); + return defaultIfEmpty(super.getWordSpacing(), "0px"); } /** Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLButtonElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLButtonElement.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLButtonElement.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -15,7 +15,6 @@ package com.gargoylesoftware.htmlunit.javascript.host.html; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_BUTTON_SET_TYPE_THROWS_EXCEPTION; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_BUTTON_USE_CONTENT_AS_VALUE; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; import java.io.IOException; @@ -66,30 +65,6 @@ } /** - * {@inheritDoc} - */ - @Override - @JsxGetter - public String getValue() { - if (getBrowserVersion().hasFeature(JS_BUTTON_USE_CONTENT_AS_VALUE)) { - return getText(); - } - return super.getValue(); - } - - /** - * {@inheritDoc} - */ - @Override - @JsxSetter - public void setValue(final String newValue) { - if (getBrowserVersion().hasFeature(JS_BUTTON_USE_CONTENT_AS_VALUE)) { - setInnerText(newValue); - } - super.setValue(newValue); - } - - /** * {@inheritDoc} Overridden to modify browser configurations. */ @Override Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -41,10 +41,8 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_FRAME_BODY_NULL_IF_NOT_LOADED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_GET_ELEMENTS_BY_NAME_EMPTY_RETURNS_NOTHING; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_GET_ELEMENTS_BY_NAME_NULL_RETURNS_NOTHING; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_GET_ELEMENT_BY_ID_ALSO_BY_NAME; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_GET_ELEMENT_BY_ID_ALSO_BY_NAME_IN_QUICKS_MODE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_GET_ELEMENT_BY_ID_CASE_SENSITIVE; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_QUERYCOMMAND_SUPPORTED_ONLY_DESIGNMODE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_TREEWALKER_EXPAND_ENTITY_REFERENCES_FALSE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.QUERYSELECTORALL_NOT_IN_QUIRKS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.QUIRKS_MODE_ALWAYS_DOC_MODE_5; @@ -1340,8 +1338,7 @@ catch (final ElementNotFoundException e) { // Just fall through - result is already set to null final BrowserVersion browser = getBrowserVersion(); - if (browser.hasFeature(JS_GET_ELEMENT_BY_ID_ALSO_BY_NAME) - || browser.hasFeature(JS_GET_ELEMENT_BY_ID_ALSO_BY_NAME_IN_QUICKS_MODE) + if (browser.hasFeature(JS_GET_ELEMENT_BY_ID_ALSO_BY_NAME_IN_QUICKS_MODE) && getHtmlPage().isQuirksMode()) { final HTMLCollection elements = getElementsByName(id); result = elements.get(0, elements); @@ -1992,13 +1989,6 @@ */ @JsxFunction public boolean queryCommandSupported(final String cmd) { - if (getBrowserVersion().hasFeature(JS_QUERYCOMMAND_SUPPORTED_ONLY_DESIGNMODE)) { - final String mode = getDesignMode(); - if (!"on".equals(mode)) { - final String msg = "queryCommandSupported() called while document.designMode='" + mode + "'."; - throw Context.reportRuntimeError(msg); - } - } return hasCommand(cmd); } @@ -2027,13 +2017,6 @@ */ @JsxFunction public boolean queryCommandEnabled(final String cmd) { - if (getBrowserVersion().hasFeature(JS_QUERYCOMMAND_SUPPORTED_ONLY_DESIGNMODE)) { - final String mode = getDesignMode(); - if (!"on".equals(mode)) { - final String msg = "queryCommandEnabled() called while document.designMode='" + mode + "'."; - throw Context.reportRuntimeError(msg); - } - } return hasCommand(cmd); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -29,8 +29,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_BOUNDING_CLIENT_RECT_OFFSET_TWO; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_CHAR_EMULATED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_CHAR_OFF_EMULATED; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_CHAR_OFF_INTEGER; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_CHAR_UNDEFINED_DOT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_CLIENT_LEFT_TOP_ZERO; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ELEMENT_EXTENT_WITHOUT_PADDING; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_ADD_CHILD_FOR_NULL_VALUE; @@ -2461,11 +2459,7 @@ return ch_; } - final String ch = getDomNodeOrDie().getAttribute("char"); - if ((ch == DomElement.ATTRIBUTE_NOT_DEFINED) && (getBrowserVersion().hasFeature(JS_CHAR_UNDEFINED_DOT))) { - return "."; - } - return ch; + return getDomNodeOrDie().getAttribute("char"); } /** @@ -2507,22 +2501,12 @@ try { final float f = Float.parseFloat(chOff); - if (getBrowserVersion().hasFeature(JS_CHAR_OFF_INTEGER)) { - if (f < 0) { - chOff = "0"; - } - else { - chOff = Integer.toString((int) f); - } + final int i = (int) f; + if (i == f) { + chOff = Integer.toString(i); } else { - final int i = (int) f; - if (i == f) { - chOff = Integer.toString(i); - } - else { - chOff = Float.toString(f); - } + chOff = Float.toString(f); } } catch (final NumberFormatException e) { Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSelectElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSelectElement.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSelectElement.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -16,9 +16,7 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_SELECT_INLINE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_SELECT_ADD_SECOND_PARAM_IS_INDEX; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_SELECT_ADD_SECOND_PARAM_IS_REQUIRED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_SELECT_ITEM_THROWS_IF_NEGATIVE; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_SELECT_SELECTED_INDEX_THROWS_IF_BAD; import java.util.List; @@ -172,9 +170,6 @@ beforeOption = null; } else if (Context.getUndefinedValue().equals(beforeOptionObject)) { - if (getBrowserVersion().hasFeature(JS_SELECT_ADD_SECOND_PARAM_IS_REQUIRED)) { - throw Context.reportRuntimeError("Not enough arguments [SelectElement.add]"); - } beforeOption = null; } else if (beforeOptionObject instanceof Number) { @@ -267,11 +262,6 @@ public void setSelectedIndex(final int index) { final HtmlSelect htmlSelect = getHtmlSelect(); - if (index != 0 && getBrowserVersion().hasFeature(JS_SELECT_SELECTED_INDEX_THROWS_IF_BAD) - && (index < -1 || index >= htmlSelect.getOptionSize())) { - throw Context.reportRuntimeError("Invalid index for select node: " + index); - } - for (final HtmlOption itemToUnSelect : htmlSelect.getSelectedOptions()) { htmlSelect.setSelectedAttribute(itemToUnSelect, false); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTextAreaElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTextAreaElement.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTextAreaElement.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -15,8 +15,6 @@ package com.gargoylesoftware.htmlunit.javascript.host.html; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_DISPLAY_DEFAULT; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_TEXT_AREA_COLS_RETURNS_MINUS1; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_TEXT_AREA_ROWS_RETURNS_MINUS1; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_TEXT_AREA_SET_COLS_NEGATIVE_THROWS_EXCEPTION; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_TEXT_AREA_SET_COLS_THROWS_EXCEPTION; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_TEXT_AREA_SET_ROWS_NEGATIVE_THROWS_EXCEPTION; @@ -96,9 +94,6 @@ return Integer.parseInt(s); } catch (final NumberFormatException e) { - if (getBrowserVersion().hasFeature(JS_TEXT_AREA_COLS_RETURNS_MINUS1)) { - return -1; - } return 20; } } @@ -113,8 +108,7 @@ try { i = Float.valueOf(cols).intValue(); if (i < 0) { - if (getBrowserVersion().hasFeature(JS_TEXT_AREA_SET_COLS_NEGATIVE_THROWS_EXCEPTION) - || getBrowserVersion().hasFeature(JS_TEXT_AREA_COLS_RETURNS_MINUS1)) { + if (getBrowserVersion().hasFeature(JS_TEXT_AREA_SET_COLS_NEGATIVE_THROWS_EXCEPTION)) { throw new NumberFormatException("New value for cols '" + cols + "' is smaller than zero."); } getDomNodeOrDie().setAttribute("cols", null); @@ -125,10 +119,7 @@ if (getBrowserVersion().hasFeature(JS_TEXT_AREA_SET_COLS_THROWS_EXCEPTION)) { throw Context.throwAsScriptRuntimeEx(e); } - if (!getBrowserVersion().hasFeature(JS_TEXT_AREA_COLS_RETURNS_MINUS1)) { - return; - } - i = 0; + return; } getDomNodeOrDie().setAttribute("cols", Integer.toString(i)); } @@ -144,9 +135,6 @@ return Integer.parseInt(s); } catch (final NumberFormatException e) { - if (getBrowserVersion().hasFeature(JS_TEXT_AREA_ROWS_RETURNS_MINUS1)) { - return -1; - } return 2; } } @@ -161,8 +149,7 @@ try { i = new Float(rows).intValue(); if (i < 0) { - if (getBrowserVersion().hasFeature(JS_TEXT_AREA_SET_ROWS_NEGATIVE_THROWS_EXCEPTION) - || getBrowserVersion().hasFeature(JS_TEXT_AREA_COLS_RETURNS_MINUS1)) { + if (getBrowserVersion().hasFeature(JS_TEXT_AREA_SET_ROWS_NEGATIVE_THROWS_EXCEPTION)) { throw new NumberFormatException("New value for rows '" + rows + "' is smaller than zero."); } getDomNodeOrDie().setAttribute("rows", null); @@ -173,10 +160,7 @@ if (getBrowserVersion().hasFeature(JS_TEXT_AREA_SET_ROWS_THROWS_EXCEPTION)) { throw Context.throwAsScriptRuntimeEx(e); } - if (!getBrowserVersion().hasFeature(JS_TEXT_AREA_COLS_RETURNS_MINUS1)) { - return; - } - i = 0; + return; } getDomNodeOrDie().setAttribute("rows", Integer.toString(i)); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -16,7 +16,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML_SUPPORT_VIA_ACTIVEXOBJECT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_ERRORHANDLER_NOT_SUPPORTED; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_HANDLER_THIS_IS_FUNCTION; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_IGNORE_SAME_ORIGIN; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_IGNORE_SAME_ORIGIN_TO_ABOUT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_ONREADYSTATECANGE_SYNC_REQUESTS_COMPLETED; @@ -205,13 +204,6 @@ final Scriptable scope = stateChangeHandler_.getParentScope(); final JavaScriptEngine jsEngine = containingPage_.getWebClient().getJavaScriptEngine(); - final Scriptable thisValue; - if (browser.hasFeature(XHR_HANDLER_THIS_IS_FUNCTION)) { - thisValue = stateChangeHandler_; - } - else { - thisValue = this; - } if (LOG.isDebugEnabled()) { LOG.debug("Calling onreadystatechange handler for state " + state); } @@ -222,7 +214,7 @@ params[0] = event; } - jsEngine.callFunction(containingPage_, stateChangeHandler_, scope, thisValue, params); + jsEngine.callFunction(containingPage_, stateChangeHandler_, scope, this, params); if (LOG.isDebugEnabled()) { if (context == null) { context = Context.getCurrentContext(); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLSerializer.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLSerializer.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLSerializer.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -16,7 +16,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML_SERIALIZER_ADD_XHTML_NAMESPACE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML_SERIALIZER_APPENDS_CRLF; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML_SERIALIZER_NODE_AS_UPPERCASE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML_SERIALIZER_NON_EMPTY_TAGS; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; @@ -126,8 +125,6 @@ final DomNode node = root.getDomNodeOrDie(); final SgmlPage page = node.getPage(); final boolean isHtmlPage = page != null && page.isHtmlPage(); - final boolean nodeNameAsUpperCase = getBrowserVersion().hasFeature(JS_XML_SERIALIZER_NODE_AS_UPPERCASE) - && isHtmlPage; final boolean appendCrlf = getBrowserVersion().hasFeature(JS_XML_SERIALIZER_APPENDS_CRLF); final boolean addXhtmlNamespace = getBrowserVersion().hasFeature(JS_XML_SERIALIZER_ADD_XHTML_NAMESPACE); @@ -137,7 +134,7 @@ forcedNamespace = "http://www.w3.org/1999/xhtml"; } } - toXml(1, node, buffer, forcedNamespace, nodeNameAsUpperCase, appendCrlf); + toXml(1, node, buffer, forcedNamespace, appendCrlf); if (appendCrlf) { buffer.append("\r\n"); @@ -149,11 +146,8 @@ private void toXml(final int indent, final DomNode node, final StringBuilder buffer, - final String foredNamespace, final boolean nodeNameAsUpperCase, final boolean appendCrLf) { - String nodeName = node.getNodeName(); - if (nodeNameAsUpperCase) { - nodeName = nodeName.toUpperCase(Locale.ENGLISH); - } + final String foredNamespace, final boolean appendCrLf) { + final String nodeName = node.getNodeName(); buffer.append('<').append(nodeName); String optionalPrefix = ""; @@ -190,7 +184,7 @@ } switch (child.getNodeType()) { case Node.ELEMENT_NODE: - toXml(indent + 1, child, buffer, null, nodeNameAsUpperCase, appendCrLf); + toXml(indent + 1, child, buffer, null, appendCrLf); break; case Node.TEXT_NODE: Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionFeaturesTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionFeaturesTest.java 2013-11-13 21:30:00 UTC (rev 8778) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionFeaturesTest.java 2013-11-13 21:48:50 UTC (rev 8779) @@ -17,6 +17,9 @@ import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.NONE; import static org.junit.Assert.fail; +import java.util.LinkedList; +import java.util.List; + import org.junit.Test; import org.junit.runner.RunWith; @@ -41,11 +44,36 @@ for (final BrowserVersionFeatures feature : BrowserVersionFeatures.values()) { final String featureName = feature.name(); if (lastFeatureName != null && featureName.compareTo(lastFeatureName) < 1) { - fail("BrowserVersionFeatures.java: \"" - + featureName + "\" should be before \"" + lastFeatureName + '"'); + fail("BrowserVersionFeatures.java: '" + + featureName + "' should be before '" + lastFeatureName + "'"); } lastFeatureName = featureName; } } + /** + * Test of alphabetical order. + */ + @Test + @Browsers(NONE) + public void unusedFeatures() { + final List<BrowserVersion> browsers = new LinkedList<BrowserVersion>(); + browsers.add(BrowserVersion.FIREFOX_17); + browsers.add(BrowserVersion.FIREFOX_24); + browsers.add(BrowserVersion.INTERNET_EXPLORER_8); + browsers.add(BrowserVersion.INTERNET_EXPLORER_9); + browsers.add(BrowserVersion.INTERNET_EXPLORER_10); + browsers.add(BrowserVersion.CHROME); + + for (final BrowserVersionFeatures feature : BrowserVersionFeatures.values()) { + boolean inUse = false; + for (BrowserVersion browserVersion : browsers) { + if (browserVersion.hasFeature(feature)) { + inUse = true; + continue; + } + } + assertTrue("BrowserVersionFeatures.java: '" + feature.name() + "' in no longer in use.", inUse); + } + } } |