From: <rb...@us...> - 2013-12-12 18:41:10
|
Revision: 8835 http://sourceforge.net/p/htmlunit/code/8835 Author: rbri Date: 2013-12-12 18:41:07 +0000 (Thu, 12 Dec 2013) Log Message: ----------- first huge implementation step forward to support IE11 [Frank Danek] this introduces a completely separate implementation of the MSXMLActiveXObject (IE11 supports this AND a build in one) Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomCharacterData.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/NamedNodeMap.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/xml/XmlPage.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/xml/XmlUtil.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserRunner.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersion2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionClassRunner.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionFeaturesTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/CookieManagerTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/NoHttpResponseTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient3Test.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/ Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2013-12-12 18:41:07 UTC (rev 8835) @@ -19,6 +19,7 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.PROTOCOL_DATA; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.URL_MINIMAL_QUERY_ENCODING; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.WINDOW_ACTIVE_ELEMENT_FOCUSED; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML_SUPPORT_VIA_ACTIVEXOBJECT; import java.io.BufferedInputStream; import java.io.File; @@ -54,6 +55,7 @@ import org.apache.http.client.CredentialsProvider; import org.w3c.css.sac.ErrorHandler; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLActiveXObjectFactory; import com.gargoylesoftware.htmlunit.attachment.Attachment; import com.gargoylesoftware.htmlunit.attachment.AttachmentHandler; import com.gargoylesoftware.htmlunit.gae.GAEUtils; @@ -117,6 +119,7 @@ * @author Amit Manjhi * @author Nicolas Belisle * @author Ronald Brill + * @author Frank Danek */ public class WebClient implements Serializable { @@ -167,6 +170,7 @@ private ScriptPreProcessor scriptPreProcessor_; private Map<String, String> activeXObjectMap_ = Collections.emptyMap(); + private transient MSXMLActiveXObjectFactory msxmlActiveXObjectFactory_; private RefreshHandler refreshHandler_ = new NiceRefreshHandler(2); private JavaScriptErrorListener javaScriptErrorListener_; @@ -220,8 +224,24 @@ addWebWindowListener(new CurrentWindowTracker(this)); currentWindow_ = new TopLevelWindow("", this); fireWindowOpened(new WebWindowEvent(currentWindow_, WebWindowEvent.OPEN, null, null)); + + if (getBrowserVersion().hasFeature(JS_XML_SUPPORT_VIA_ACTIVEXOBJECT)) { + initMSXMLActiveX(); + } } + private void initMSXMLActiveX() { + msxmlActiveXObjectFactory_ = new MSXMLActiveXObjectFactory(); + // TODO [IE11] initialize in #init or in #initialize? + try { + msxmlActiveXObjectFactory_.init(getBrowserVersion()); + } + catch (final Exception e) { + LOG.error("Exception while initializing MSXML ActiveX for the page", e); + throw new ScriptException(null, e); // BUG: null is not useful. + } + } + /** * Returns the object that will resolve all URL requests. * @@ -1453,6 +1473,14 @@ } /** + * Returns the MSXML ActiveX object factory (if supported). + * @return the msxmlActiveXObjectFactory + */ + public MSXMLActiveXObjectFactory getMSXMLActiveXObjectFactory() { + return msxmlActiveXObjectFactory_; + } + + /** * Sets the listener for messages generated by the HTML parser. * @param listener the new listener, <code>null</code> if messages should be totally ignored */ @@ -1852,6 +1880,10 @@ webConnection_ = createWebConnection(); scriptEngine_ = new JavaScriptEngine(this); jobManagers_ = Collections.synchronizedList(new ArrayList<WeakReference<JavaScriptJobManager>>()); + + if (getBrowserVersion().hasFeature(JS_XML_SUPPORT_VIA_ACTIVEXOBJECT)) { + initMSXMLActiveX(); + } } private WebConnection createWebConnection() { Index: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex 2013-12-12 18:41:07 UTC (rev 8835) Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex ___________________________________________________________________ Added: bugtraq:label ## -0,0 +1 ## +SF issue number (optional): \ No newline at end of property Added: bugtraq:url ## -0,0 +1 ## +http://sourceforge.net/support/tracker.php?aid=%BUGID% \ No newline at end of property Added: bugtraq:message ## -0,0 +1 ## +Issue %BUGID% \ No newline at end of property Index: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript 2013-12-12 18:41:07 UTC (rev 8835) Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript ___________________________________________________________________ Added: bugtraq:label ## -0,0 +1 ## +SF issue number (optional): \ No newline at end of property Added: bugtraq:url ## -0,0 +1 ## +http://sourceforge.net/support/tracker.php?aid=%BUGID% \ No newline at end of property Added: bugtraq:message ## -0,0 +1 ## +Issue %BUGID% \ No newline at end of property Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomCharacterData.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomCharacterData.java 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomCharacterData.java 2013-12-12 18:41:07 UTC (rev 8835) @@ -103,7 +103,7 @@ */ public void deleteData(final int offset, final int count) { if (offset < 0) { - throw new IllegalArgumentException("Provided offset: " + offset + "is less than zero."); + throw new IllegalArgumentException("Provided offset: " + offset + " is less than zero."); } final String data = data_.substring(0, offset); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/NamedNodeMap.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/NamedNodeMap.java 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/NamedNodeMap.java 2013-12-12 18:41:07 UTC (rev 8835) @@ -14,6 +14,7 @@ */ package com.gargoylesoftware.htmlunit.javascript; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ATTRIBUTES_BY_NAME_CASE_SENSITIVE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ATTRIBUTES_CONTAINS_EMPTY_ATTR_FOR_PROPERTIES; import net.sourceforge.htmlunit.corejs.javascript.Context; import net.sourceforge.htmlunit.corejs.javascript.Scriptable; @@ -38,6 +39,7 @@ * @author Ahmed Ashour * @author Marc Guillemot * @author Ronald Brill + * @author Frank Danek * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1780488922">DOM Level 2 Core Spec</a> * @see <a href="http://msdn2.microsoft.com/en-us/library/ms763824.aspx">IXMLDOMNamedNodeMap</a> */ @@ -89,7 +91,15 @@ public Object getWithFallback(final String name) { final Object response = getNamedItem(name); if (response != null) { - return response; + if (response instanceof Attr && getBrowserVersion().hasFeature(JS_ATTRIBUTES_BY_NAME_CASE_SENSITIVE)) { + final Attr attr = (Attr) response; + if (attr.getName().equals(name)) { + return response; + } + } + else { + return response; + } } if (useRecursiveAttributeForIE() && isRecursiveAttribute(name)) { return getUnspecifiedAttributeNode(name); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/xml/XmlPage.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/xml/XmlPage.java 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/xml/XmlPage.java 2013-12-12 18:41:07 UTC (rev 8835) @@ -50,6 +50,7 @@ * @author Marc Guillemot * @author David K. Taylor * @author Ahmed Ashour + * @author Frank Danek */ public class XmlPage extends SgmlPage { Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/xml/XmlUtil.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/xml/XmlUtil.java 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/xml/XmlUtil.java 2013-12-12 18:41:07 UTC (rev 8835) @@ -66,6 +66,7 @@ * @author Sudhan Moghe * @author Ronald Brill * @author Chuck Dumont + * @author Frank Danek */ public final class XmlUtil { Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserRunner.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserRunner.java 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserRunner.java 2013-12-12 18:41:07 UTC (rev 8835) @@ -82,8 +82,8 @@ if (/*browsers.contains("hu") ||*/ browsers.contains("hu-ie9")) { runners_.add(new BrowserVersionClassRunner(klass, BrowserVersion.INTERNET_EXPLORER_9, false)); } - if (/*browsers.contains("hu") ||*/ browsers.contains("hu-ie10")) { - runners_.add(new BrowserVersionClassRunner(klass, BrowserVersion.INTERNET_EXPLORER_10, false)); + if (/*browsers.contains("hu") ||*/ browsers.contains("hu-ie11")) { + runners_.add(new BrowserVersionClassRunner(klass, BrowserVersion.INTERNET_EXPLORER_11, false)); } if (/*browsers.contains("hu") || */browsers.contains("hu-chrome")) { runners_.add(new BrowserVersionClassRunner(klass, BrowserVersion.CHROME, false)); @@ -102,8 +102,8 @@ if (browsers.contains("ie9")) { runners_.add(new BrowserVersionClassRunner(klass, BrowserVersion.INTERNET_EXPLORER_9, true)); } - if (browsers.contains("ie10")) { - runners_.add(new BrowserVersionClassRunner(klass, BrowserVersion.INTERNET_EXPLORER_10, true)); + if (browsers.contains("ie11")) { + runners_.add(new BrowserVersionClassRunner(klass, BrowserVersion.INTERNET_EXPLORER_11, true)); } if (browsers.contains("chrome")) { runners_.add(new BrowserVersionClassRunner(klass, BrowserVersion.CHROME, true)); @@ -169,8 +169,8 @@ /** Internet Explorer 9. */ IE9, - /** Internet Explorer 10. */ - IE10, + /** Internet Explorer 11. */ + IE11, /** All versions of Firefox. */ FF, @@ -230,8 +230,8 @@ /** Alerts for Internet Explorer 9. If not defined, {@link #IE()} is used. */ String[] IE9() default { EMPTY_DEFAULT }; - /** Alerts for Internet Explorer 10. If not defined, {@link #IE()} is used. */ - String[] IE10() default { EMPTY_DEFAULT }; + /** Alerts for Internet Explorer 11. If not defined, {@link #IE()} is used. */ + String[] IE11() default { EMPTY_DEFAULT }; /** Alerts for any Firefox, it can be overridden by specific FF version. */ String[] FF() default { EMPTY_DEFAULT }; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersion2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersion2Test.java 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersion2Test.java 2013-12-12 18:41:07 UTC (rev 8835) @@ -43,7 +43,7 @@ @Test @Alerts(DEFAULT = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", IE = "Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, */*", - IE10 = "Accept: text/html, application/xhtml+xml, */*") + IE11 = "Accept: text/html, application/xhtml+xml, */*") public void acceptHeaderGetUrl() throws Exception { final String html = "<html><body>Response</body></html>"; loadPage2(html, getDefaultUrl()); @@ -57,7 +57,7 @@ @Test @Alerts(DEFAULT = { "2", "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" }, IE = { "2", "Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, */*" }, - IE10 = { "2", "Accept: text/html, application/xhtml+xml, */*" }) + IE11 = { "2", "Accept: text/html, application/xhtml+xml, */*" }) public void acceptHeaderWindowOpen() throws Exception { String html = "<html><body>Response</body></html>"; getMockWebConnection().setDefaultResponse(html); @@ -79,7 +79,7 @@ @Test @Alerts(DEFAULT = {"2", "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" }, IE = {"2", "Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, */*" }, - IE10 = {"2", "Accept: text/html, application/xhtml+xml, */*" }) + IE11 = {"2", "Accept: text/html, application/xhtml+xml, */*" }) public void acceptHeaderAnchorClick() throws Exception { String html = "<html><body>Response</body></html>"; getMockWebConnection().setDefaultResponse(html); @@ -101,7 +101,7 @@ @Test @Alerts(DEFAULT = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", IE = "Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, */*", - IE10 = "Accept: text/html, application/xhtml+xml, */*") + IE11 = "Accept: text/html, application/xhtml+xml, */*") public void acceptHeaderAnchorClickWithType() throws Exception { String html = "<html><body>Response</body></html>"; getMockWebConnection().setDefaultResponse(html); @@ -124,7 +124,7 @@ @Alerts(DEFAULT = "Accept: image/png,image/*;q=0.8,*/*;q=0.5", CHROME = "Accept: image/webp,*/*;q=0.8", IE = "Accept: */*", - IE10 = "Accept: image/png, image/svg+xml, image/*;q=0.8, */*;q=0.5") + IE11 = "Accept: image/png, image/svg+xml, image/*;q=0.8, */*;q=0.5") public void acceptHeaderImage() throws Exception { final String html = "<html><head>\n" @@ -149,7 +149,7 @@ @Test @Alerts(DEFAULT = "Accept: text/css,*/*;q=0.1", IE = "Accept: */*", - IE10 = "Accept: text/css") + IE11 = "Accept: text/css, */*") public void acceptHeaderCss() throws Exception { final String html = "<html><head>\n" @@ -174,7 +174,7 @@ */ @Test @Alerts(DEFAULT = "Accept: */*", - IE10 = "Accept: application/javascript, */*;q=0.8") + IE11 = "Accept: application/javascript, */*;q=0.8") public void acceptHeaderJavascript() throws Exception { final String html = "<html><head>\n" @@ -193,7 +193,7 @@ */ @Test @Alerts(DEFAULT = "Accept: */*", - IE10 = "Accept: application/javascript, */*;q=0.8") + IE11 = "Accept: application/javascript, */*;q=0.8") public void acceptHeaderJavascriptWithoutType() throws Exception { final String html = "<html><head>\n" @@ -213,7 +213,7 @@ @Test @Alerts(DEFAULT = "Accept: text/css,*/*;q=0.1", IE = "Accept: */*", - IE10 = "Accept: text/css") + IE11 = "Accept: text/css, */*") public void acceptHeaderCssWithoutType() throws Exception { final String html = "<html><head>\n" @@ -239,7 +239,7 @@ @Test @Alerts(DEFAULT = "Accept: text/css,*/*;q=0.1", IE = "Accept: */*", - IE10 = "Accept: text/css") + IE11 = "Accept: text/css, */*") public void acceptHeaderCssDifferentType() throws Exception { final String html = "<html><head>\n" Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionClassRunner.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionClassRunner.java 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionClassRunner.java 2013-12-12 18:41:07 UTC (rev 8835) @@ -77,8 +77,8 @@ else if (browserVersion_ == BrowserVersion.INTERNET_EXPLORER_9) { expectedAlerts = firstDefined(alerts.IE9(), alerts.IE(), alerts.DEFAULT()); } - else if (browserVersion_ == BrowserVersion.INTERNET_EXPLORER_10) { - expectedAlerts = firstDefined(alerts.IE10(), alerts.IE(), alerts.DEFAULT()); + else if (browserVersion_ == BrowserVersion.INTERNET_EXPLORER_11) { + expectedAlerts = firstDefined(alerts.IE11(), alerts.IE(), alerts.DEFAULT()); } else if (browserVersion_ == BrowserVersion.FIREFOX_17) { expectedAlerts = firstDefined(alerts.FF17(), alerts.FF(), alerts.DEFAULT()); @@ -239,8 +239,8 @@ } break; - case IE10: - if (browserVersion_ == BrowserVersion.INTERNET_EXPLORER_10) { + case IE11: + if (browserVersion_ == BrowserVersion.INTERNET_EXPLORER_11) { return true; } break; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionFeaturesTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionFeaturesTest.java 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionFeaturesTest.java 2013-12-12 18:41:07 UTC (rev 8835) @@ -34,6 +34,7 @@ * @version $Revision$ * @author Ahmed Ashour * @author Ronald Brill + * @author Frank Danek */ @RunWith(BrowserRunner.class) public class BrowserVersionFeaturesTest extends SimpleWebTestCase { @@ -67,7 +68,7 @@ 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.INTERNET_EXPLORER_11); browsers.add(BrowserVersion.CHROME); for (final BrowserVersionFeatures feature : BrowserVersionFeatures.values()) { Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionTest.java 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionTest.java 2013-12-12 18:41:07 UTC (rev 8835) @@ -34,7 +34,7 @@ assertEquals(17.0f, BrowserVersion.FIREFOX_17.getBrowserVersionNumeric()); assertEquals(8.0f, BrowserVersion.INTERNET_EXPLORER_8.getBrowserVersionNumeric()); assertEquals(9.0f, BrowserVersion.INTERNET_EXPLORER_9.getBrowserVersionNumeric()); - assertEquals(10.0f, BrowserVersion.INTERNET_EXPLORER_10.getBrowserVersionNumeric()); + assertEquals(11.0f, BrowserVersion.INTERNET_EXPLORER_11.getBrowserVersionNumeric()); assertEquals(29.0f, BrowserVersion.CHROME.getBrowserVersionNumeric()); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/CookieManagerTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/CookieManagerTest.java 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/CookieManagerTest.java 2013-12-12 18:41:07 UTC (rev 8835) @@ -135,7 +135,7 @@ * @throws Exception if the test fails */ @Test - // TODO [IE10]SINGLE-VS-BULK test runs when executed as single but breaks as bulk + // TODO [IE11]SINGLE-VS-BULK test runs when executed as single but breaks as bulk public void orderCookiesByPath_fromJs() throws Exception { final String html = "<html><body><script>\n" + "document.cookie = 'exampleCookie=rootPath;path=/';\n" @@ -161,8 +161,7 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = "key1=; key2=", - IE10 = "key1; key2") + @Alerts("key1=; key2=") public void emptyCookie() throws Exception { final List<NameValuePair> responseHeader = new ArrayList<NameValuePair>(); responseHeader.add(new NameValuePair("Set-Cookie", "key1=")); @@ -283,7 +282,7 @@ @Test @Alerts(DEFAULT = "first=1; second=2; third=3", CHROME = "third=3", - IE10 = "first=1; second=2; third=3; fourth=4") + IE11 = "first=1; second=2; third=3; fourth=4") public void setCookieExpired_badDateFormat() throws Exception { final List<NameValuePair> responseHeader1 = new ArrayList<NameValuePair>(); responseHeader1.add(new NameValuePair("Set-Cookie", "first=1;expires=Dec-1-94 16:00:00")); @@ -301,7 +300,7 @@ */ @Test @Alerts(DEFAULT = "cookie1=1; cookie2=2; cookie3=3", - IE10 = "cookie1=1; cookie2=2; cookie3=3; cookie4=4; cookie5=5; cookie6=6") + IE11 = "cookie1=1; cookie2=2; cookie3=3; cookie4=4; cookie5=5; cookie6=6") public void setCookieExpires_twoDigits() throws Exception { final List<NameValuePair> responseHeader1 = new ArrayList<NameValuePair>(); responseHeader1.add(new NameValuePair("Set-Cookie", "cookie1=1;expires=Sun 01-Dec-68 16:00:00 GMT")); @@ -321,7 +320,7 @@ */ @Test @Alerts(DEFAULT = "cookie1=1; cookie2=2; cookie3=3", - IE10 = "cookie1=1; cookie2=2; cookie3=3; cookie4=4; cookie5=5; cookie6=6") + IE11 = "cookie1=1; cookie2=2; cookie3=3; cookie4=4; cookie5=5; cookie6=6") public void setCookieExpires_twoDigits2() throws Exception { final List<NameValuePair> responseHeader1 = new ArrayList<NameValuePair>(); responseHeader1.add(new NameValuePair("Set-Cookie", "cookie1=1;expires=Sun,01 Dec 68 16:00:00 GMT")); @@ -342,7 +341,7 @@ */ @Test @Alerts(DEFAULT = "cookie1=1", - IE10 = "cookie1=1; cookie6=6") + IE11 = "cookie1=1; cookie6=6") public void setCookieExpires_badDateFormat() throws Exception { final List<NameValuePair> responseHeader1 = new ArrayList<NameValuePair>(); responseHeader1.add(new NameValuePair("Set-Cookie", "cookie1=1;expires=Sun-01 Dec 68 16:00:00 GMT")); @@ -437,7 +436,7 @@ */ @Test @Alerts(DEFAULT = "first=1", - IE10 = "") + IE11 = "") public void setCookieSubPath() throws Exception { final List<NameValuePair> responseHeader1 = new ArrayList<NameValuePair>(); responseHeader1.add(new NameValuePair("Set-Cookie", "first=1; path=/foo/blah")); @@ -455,7 +454,7 @@ */ @Test @Alerts(DEFAULT = "first=1", - IE10 = "") + IE11 = "") public void setCookieDifferentPath() throws Exception { final List<NameValuePair> responseHeader1 = new ArrayList<NameValuePair>(); responseHeader1.add(new NameValuePair("Set-Cookie", "first=1; path=/foo/blah")); @@ -532,7 +531,7 @@ */ @Test @Alerts(DEFAULT = "first=1", - IE10 = "") + IE11 = "") public void cookieSetFromJSWithoutPathUsesCurrentLocation2() throws Exception { final List<NameValuePair> responseHeader1 = new ArrayList<NameValuePair>(); responseHeader1.add(new NameValuePair("Set-Cookie", "first=1; path=/c")); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java 2013-12-12 18:41:07 UTC (rev 8835) @@ -34,6 +34,7 @@ * @version $Revision$ * @author Marc Guillemot * @author Ahmed Ashour + * @author Frank Danek */ @RunWith(BrowserRunner.class) public class HttpWebConnection2Test extends WebDriverTestCase { @@ -63,13 +64,13 @@ assertEquals(null, lastRequest.getRequestBody()); assertEquals(getDefaultUrl() + "foo", lastRequest.getUrl()); String expectedHeaders = ""; - if (getBrowserVersion() == BrowserVersion.INTERNET_EXPLORER_10) { + if (getBrowserVersion() == BrowserVersion.INTERNET_EXPLORER_11) { expectedHeaders += "Cache-Control: no-cache\n"; } expectedHeaders += "Connection: keep-alive\n" + "Content-Length: 48\n" + "Content-Type: application/x-www-form-urlencoded\n"; - if (getBrowserVersion() == BrowserVersion.INTERNET_EXPLORER_10) { + if (getBrowserVersion() == BrowserVersion.INTERNET_EXPLORER_11) { expectedHeaders += "DNT: 1\n"; } expectedHeaders += "Host: localhost:" + PORT + "\n" Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/NoHttpResponseTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/NoHttpResponseTest.java 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/NoHttpResponseTest.java 2013-12-12 18:41:07 UTC (rev 8835) @@ -71,7 +71,7 @@ * @throws Exception if the test fails */ @Test - // TODO [IE10] does not run in real IE10 (browser waits for a looooooong time) + // TODO [IE11] does not run in real IE11 (browser waits for a looooooong time) public void callSubmitInButtonAndReturnTrue() throws Exception { final MockWebConnection mockWebConnection = getMockWebConnection(); mockWebConnection.setResponse(getDefaultUrl(), html); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient3Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient3Test.java 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient3Test.java 2013-12-12 18:41:07 UTC (rev 8835) @@ -50,7 +50,7 @@ * Regression test for bug 2822048: a 302 redirect without Location header. * @throws Exception if an error occurs */ - // TODO [IE10]ERRORPAGE real IE10 displays his own error page (res://ieframe.dll/dnserror.htm#<url>) + // TODO [IE11]ERRORPAGE real IE11 displays his own error page (res://ieframe.dll/dnserror.htm#<url>) @Test public void redirect302WithoutLocation() throws Exception { final String html = "<html><body><a href='page2'>to redirect</a></body></html>"; @@ -235,7 +235,7 @@ */ @Test @Alerts ({ "open", "first", "second" }) - // TODO [IE10]MODALPANEL real IE10 opens a modal panel 'really close window?' which webdriver cannot handle + // TODO [IE11]MODALPANEL real IE11 opens a modal panel 'really close window?' which webdriver cannot handle public void windowOpenedByAnchorTargetIsAttachedToJavascriptEventLoop() throws Exception { final String firstContent = "<html>" + "<head>" @@ -280,7 +280,7 @@ */ @Test @Alerts ({ "open", "first", "second" }) - // TODO [IE10]MODALPANEL real IE10 opens a modal panel 'really close window?' which webdriver cannot handle + // TODO [IE11]MODALPANEL real IE11 opens a modal panel 'really close window?' which webdriver cannot handle public void windowOpenedByFormTargetIsAttachedToJavascriptEventLoop() throws Exception { final String firstContent = "<html>" + "<head>" @@ -419,7 +419,7 @@ */ @Test @Alerts ({ "Executed", "later" }) - // TODO [IE10]ERRORPAGE real IE10 displays own error page if response is to small + // TODO [IE11]ERRORPAGE real IE11 displays own error page if response is to small public void execJavascriptOnErrorPages() throws Exception { final String errorHtml = "<html>\n" + "<head>\n" @@ -462,7 +462,7 @@ */ @Test @Alerts("modified") - // TODO [IE10]SINGLE-VS-BULK test runs when executed as single but breaks as bulk + // TODO [IE11]SINGLE-VS-BULK test runs when executed as single but breaks as bulk public void deflateCompressionGZipCompatible() throws Exception { doTestDeflateCompression(true); } @@ -473,7 +473,7 @@ */ @Test @Alerts(DEFAULT = "modified", - IE10 = "Hello world") + IE11 = "Hello world") public void deflateCompressionNonGZipCompatible() throws Exception { doTestDeflateCompression(false); } Index: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex 2013-12-12 18:30:31 UTC (rev 8834) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex 2013-12-12 18:41:07 UTC (rev 8835) Property changes on: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex ___________________________________________________________________ Added: bugtraq:label ## -0,0 +1 ## +SF issue number (optional): \ No newline at end of property Added: bugtraq:url ## -0,0 +1 ## +http://sourceforge.net/support/tracker.php?aid=%BUGID% \ No newline at end of property Added: bugtraq:message ## -0,0 +1 ## +Issue %BUGID% \ No newline at end of property |
From: <rb...@us...> - 2013-12-12 18:52:09
|
Revision: 8836 http://sourceforge.net/p/htmlunit/code/8836 Author: rbri Date: 2013-12-12 18:52:03 +0000 (Thu, 12 Dec 2013) Log Message: ----------- first huge implementation step forward to support IE11 [Frank Danek] this introduces a completely separate implementation of the MSXMLActiveXObject (IE11 supports this AND a build in one) Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObject.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Attr.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/Event.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/KeyboardEvent.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MessageEvent.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEvent.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Navigator.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Selection.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Text.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/UIEvent.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfigurationTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObjectTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ObjectsTest.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactory.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLConfiguration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLJavaScriptEnvironment.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLScriptable.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttribute.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASection.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCharacterData.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMComment.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentFragment.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentType.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMImplementation.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNamedNodeMap.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNode.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNodeList.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMParseError.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMProcessingInstruction.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMSelection.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMText.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLHTTPRequest.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLSerializer.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLProcessor.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLTemplate.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/package.html trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/AbstractJavaScriptConfiguration.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/ Index: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml 2013-12-12 18:41:07 UTC (rev 8835) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml 2013-12-12 18:52:03 UTC (rev 8836) Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml ___________________________________________________________________ Added: bugtraq:label ## -0,0 +1 ## +SF issue number (optional): \ No newline at end of property Added: bugtraq:url ## -0,0 +1 ## +http://sourceforge.net/support/tracker.php?aid=%BUGID% \ No newline at end of property Added: bugtraq:message ## -0,0 +1 ## +Issue %BUGID% \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactory.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactory.java 2013-12-12 18:52:03 UTC (rev 8836) @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.activex.javascript.msxml; + +import java.util.Locale; + +import net.sourceforge.htmlunit.corejs.javascript.Scriptable; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import com.gargoylesoftware.htmlunit.BrowserVersion; +import com.gargoylesoftware.htmlunit.ScriptException; +import com.gargoylesoftware.htmlunit.WebWindow; + +/** + * ActiveXObjectFactory for the MSXML ActiveX library. + * + * @version $Revision$ + * @author Frank Danek + */ +public class MSXMLActiveXObjectFactory { + + private static final Log LOG = LogFactory.getLog(MSXMLActiveXObjectFactory.class); + + private MSXMLJavaScriptEnvironment environment_; + + /** + * Initializes the factory. + * + * @param browserVersion the browser version to use + * @throws Exception if something goes wrong + */ + public void init(final BrowserVersion browserVersion) throws Exception { + environment_ = new MSXMLJavaScriptEnvironment(browserVersion); + } + + /** + * Checks if the given ActiveX name is supported by this factory. + * + * @param activeXName the ActiveX name to check + * @return true if the given name is supported + */ + public boolean supports(final String activeXName) { + return isXMLDOMDocument(activeXName) + || isXMLHTTPRequest(activeXName) + || isXSLTemplate(activeXName); + } + + /** + * Indicates whether the ActiveX name is one flavor of XMLDOMDocument. + * @param name the ActiveX name + * @return <code>true</code> if this is an XMLDOMDocument + */ + static boolean isXMLDOMDocument(String name) { + if (name == null) { + return false; + } + name = name.toLowerCase(Locale.ENGLISH); + return "microsoft.xmldom".equals(name) + || name.startsWith("msxml2.domdocument") + || name.startsWith("msxml2.freethreadeddomdocument"); + } + + /** + * Indicates whether the ActiveX name is one flavor of XMLHTTPRequest. + * @param name the ActiveX name + * @return <code>true</code> if this is an XMLHTTPRequest + */ + static boolean isXMLHTTPRequest(String name) { + if (name == null) { + return false; + } + name = name.toLowerCase(Locale.ENGLISH); + return "microsoft.xmlhttp".equals(name) + || name.startsWith("msxml2.xmlhttp"); + } + + /** + * Indicates if the ActiveX name is one flavor of XSLTemplate. + * @param name the ActiveX name + * @return <code>true</code> if this is an XSLTemplate + */ + static boolean isXSLTemplate(String name) { + if (name == null) { + return false; + } + name = name.toLowerCase(Locale.ENGLISH); + return name.startsWith("msxml2.xsltemplate"); + } + + /** + * Creates an instance of the ActiveX object for the given name. + * + * @param activeXName the ActiveX name to create an object for + * @param enclosingWindow the enclosing window + * @return the created ActiveX object + */ + public Scriptable create(final String activeXName, final WebWindow enclosingWindow) { + if (isXMLDOMDocument(activeXName)) { + return createXMLDOMDocument(enclosingWindow); + } + + if (isXMLHTTPRequest(activeXName)) { + return createXMLHTTPRequest(enclosingWindow); + } + + if (isXSLTemplate(activeXName)) { + return createXSLTemplate(enclosingWindow); + } + return null; + } + + private XMLDOMDocument createXMLDOMDocument(final WebWindow enclosingWindow) { + final XMLDOMDocument document = new XMLDOMDocument(enclosingWindow); + initObject(document); + + try { + document.setParentScope((Scriptable) enclosingWindow.getScriptObject()); + } + catch (final Exception e) { + LOG.error("Exception while initializing JavaScript for the page", e); + throw new ScriptException(null, e); // BUG: null is not useful. + } + return document; + } + + private Scriptable createXMLHTTPRequest(final WebWindow enclosingWindow) { + final XMLHTTPRequest request = new XMLHTTPRequest(); + initObject(request); + return request; + } + + private Scriptable createXSLTemplate(final WebWindow enclosingWindow) { + final XSLTemplate template = new XSLTemplate(); + initObject(template); + return template; + } + + private void initObject(final MSXMLScriptable scriptable) { + try { + scriptable.setPrototype(environment_.getPrototype(scriptable.getClass())); + scriptable.setEnvironment(environment_); + } + catch (final Exception e) { + LOG.error("Exception while initializing JavaScript for the page", e); + throw new ScriptException(null, e); // BUG: null is not useful. + } + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactory.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLConfiguration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLConfiguration.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLConfiguration.java 2013-12-12 18:52:03 UTC (rev 8836) @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.activex.javascript.msxml; + +import java.util.Map; +import java.util.WeakHashMap; + +import com.gargoylesoftware.htmlunit.BrowserVersion; +import com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration; + +/** + * A container for all the JavaScript configuration information. + * + * @version $Revision$ + * @author <a href="mailto:mb...@Ga...">Mike Bowler</a> + * @author Chris Erskine + * @author Ahmed Ashour + * @author Ronald Brill + * @author Frank Danek + */ +public final class MSXMLConfiguration extends AbstractJavaScriptConfiguration { + + @SuppressWarnings("unchecked") + static final Class<MSXMLScriptable>[] CLASSES_ = new Class[] { + XMLDOMAttribute.class, XMLDOMCDATASection.class, XMLDOMCharacterData.class, XMLDOMComment.class, + XMLDOMDocument.class, XMLDOMDocumentFragment.class, XMLDOMDocumentType.class, XMLDOMElement.class, + XMLDOMImplementation.class, XMLDOMNamedNodeMap.class, XMLDOMNode.class, XMLDOMNodeList.class, + XMLDOMParseError.class, XMLDOMProcessingInstruction.class, XMLDOMSelection.class, XMLDOMText.class, + XMLHTTPRequest.class, XSLProcessor.class, XSLTemplate.class + }; + + /** Cache of browser versions and their corresponding JavaScript configurations. */ + private static final Map<BrowserVersion, MSXMLConfiguration> CONFIGURATION_MAP_ = + new WeakHashMap<BrowserVersion, MSXMLConfiguration>(); + + /** + * Constructor is only called from {@link #getInstance(BrowserVersion)} which is synchronized. + * @param browser the browser version to use + */ + private MSXMLConfiguration(final BrowserVersion browser) { + super(browser); + } + + /** + * Returns the instance that represents the configuration for the specified {@link BrowserVersion}. + * This method is synchronized to allow multi-threaded access to the JavaScript configuration. + * @param browserVersion the {@link BrowserVersion} + * @return the instance for the specified {@link BrowserVersion} + */ + public static synchronized MSXMLConfiguration getInstance(final BrowserVersion browserVersion) { + if (browserVersion == null) { + throw new IllegalStateException("BrowserVersion must be defined"); + } + MSXMLConfiguration configuration = CONFIGURATION_MAP_.get(browserVersion); + + if (configuration == null) { + configuration = new MSXMLConfiguration(browserVersion); + CONFIGURATION_MAP_.put(browserVersion, configuration); + } + return configuration; + } + + @Override + protected Class<MSXMLScriptable>[] getClasses() { + return CLASSES_; + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLConfiguration.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLJavaScriptEnvironment.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLJavaScriptEnvironment.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLJavaScriptEnvironment.java 2013-12-12 18:52:03 UTC (rev 8836) @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.activex.javascript.msxml; + +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +import net.sourceforge.htmlunit.corejs.javascript.Context; +import net.sourceforge.htmlunit.corejs.javascript.FunctionObject; +import net.sourceforge.htmlunit.corejs.javascript.Scriptable; +import net.sourceforge.htmlunit.corejs.javascript.ScriptableObject; + +import org.apache.commons.lang3.StringUtils; + +import com.gargoylesoftware.htmlunit.BrowserVersion; +import com.gargoylesoftware.htmlunit.javascript.ScriptableWithFallbackGetter; +import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; +import com.gargoylesoftware.htmlunit.javascript.configuration.ClassConfiguration; + +/** + * JavaScript environment for the MSXML ActiveX library. + * + * @version $Revision$ + * @author Frank Danek + */ +public class MSXMLJavaScriptEnvironment { + + private final MSXMLConfiguration config_; + + private Map<Class<? extends MSXMLScriptable>, Scriptable> prototypes_; + + /** + * Creates an instance for the given {@link BrowserVersion}. + * + * @param browserVersion the browser version to use + * @throws Exception if something goes wrong + */ + @SuppressWarnings("unchecked") + public MSXMLJavaScriptEnvironment(final BrowserVersion browserVersion) throws Exception { + config_ = MSXMLConfiguration.getInstance(browserVersion); + + final Map<String, ScriptableObject> prototypesPerJSName = new HashMap<String, ScriptableObject>(); + final Map<Class<? extends MSXMLScriptable>, Scriptable> prototypes = + new HashMap<Class<? extends MSXMLScriptable>, Scriptable>(); + + // put custom object to be called as very last prototype to call the fallback getter (if any) + final Scriptable fallbackCaller = new FallbackCaller(); + + for (final ClassConfiguration config : config_.getAll()) { + final ScriptableObject prototype = configureClass(config); + if (config.isJsObject()) { + prototypes.put((Class<? extends MSXMLScriptable>) config.getHostClass(), prototype); + } + prototypesPerJSName.put(config.getHostClass().getSimpleName(), prototype); + } + + // once all prototypes have been build, it's possible to configure the chains +// final Scriptable objectPrototype = ScriptableObject.getObjectPrototype(window); + for (final Map.Entry<String, ScriptableObject> entry : prototypesPerJSName.entrySet()) { + final String name = entry.getKey(); + final ClassConfiguration config = config_.getClassConfiguration(name); + Scriptable prototype = entry.getValue(); + if (prototype.getPrototype() != null) { + prototype = prototype.getPrototype(); // "double prototype" hack for FF + } + if (!StringUtils.isEmpty(config.getExtendedClassName())) { + final Scriptable parentPrototype = prototypesPerJSName.get(config.getExtendedClassName()); + prototype.setPrototype(parentPrototype); + } + else { +// prototype.setPrototype(objectPrototype); + prototype.setPrototype(fallbackCaller); + } + } + + prototypes_ = prototypes; + } + + /** + * Configures the specified class for access via JavaScript. + * @param config the configuration settings for the class to be configured + * @param window the scope within which to configure the class + * @throws InstantiationException if the new class cannot be instantiated + * @throws IllegalAccessException if we don't have access to create the new instance + * @return the created prototype + */ + private ScriptableObject configureClass(final ClassConfiguration config/*, final Scriptable window*/) + throws InstantiationException, IllegalAccessException { + + final Class<?> jsHostClass = config.getHostClass(); + final ScriptableObject prototype = (ScriptableObject) jsHostClass.newInstance(); +// prototype.setParentScope(window); + + configureConstantsPropertiesAndFunctions(config, prototype); + + return prototype; + } + + /** + * Configures constants, properties and functions on the object. + * @param config the configuration for the object + * @param scriptable the object to configure + */ + private void configureConstantsPropertiesAndFunctions(final ClassConfiguration config, + final ScriptableObject scriptable) { + + // the constants + configureConstants(config, scriptable); + + // the properties + for (final Entry<String, ClassConfiguration.PropertyInfo> propertyEntry : config.propertyEntries()) { + final String propertyName = propertyEntry.getKey(); + final Method readMethod = propertyEntry.getValue().getReadMethod(); + final Method writeMethod = propertyEntry.getValue().getWriteMethod(); + scriptable.defineProperty(propertyName, null, readMethod, writeMethod, ScriptableObject.EMPTY); + } + + final int attributes = ScriptableObject.DONTENUM; + // the functions + for (final Entry<String, Method> functionInfo : config.functionEntries()) { + final String functionName = functionInfo.getKey(); + final Method method = functionInfo.getValue(); + final FunctionObject functionObject = new FunctionObject(functionName, method, scriptable); + scriptable.defineProperty(functionName, functionObject, attributes); + } + } + + private void configureConstants(final ClassConfiguration config, + final ScriptableObject scriptable) { + final Class<?> linkedClass = config.getHostClass(); + for (final String constant : config.constants()) { + try { + final Object value = linkedClass.getField(constant).get(null); + scriptable.defineProperty(constant, value, ScriptableObject.EMPTY); + } + catch (final Exception e) { + throw Context.reportRuntimeError("Cannot get field '" + constant + "' for type: " + + config.getHostClass().getName()); + } + } + } + + /** + * Gets the class of the JavaScript object for the node class. + * @param c the node class <code>DomNode</code> or some subclass. + * @return <code>null</code> if none found + */ + @SuppressWarnings("unchecked") + public Class<? extends MSXMLScriptable> getJavaScriptClass(final Class<?> c) { + return (Class<? extends MSXMLScriptable>) config_.getDomJavaScriptMapping().get(c); + } + + /** + * Returns the prototype object corresponding to the specified HtmlUnit class inside the window scope. + * @param jsClass the class whose prototype is to be returned + * @return the prototype object corresponding to the specified class inside the specified scope + */ + public Scriptable getPrototype(final Class<? extends SimpleScriptable> jsClass) { + return prototypes_.get(jsClass); + } + + private static class FallbackCaller extends ScriptableObject { + private static final long serialVersionUID = 1402030469837200894L; + + @Override + public Object get(final String name, final Scriptable start) { + if (start instanceof ScriptableWithFallbackGetter) { + return ((ScriptableWithFallbackGetter) start).getWithFallback(name); + } + return NOT_FOUND; + } + + @Override + public String getClassName() { + return "htmlUnitHelper-fallbackCaller"; + } + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLJavaScriptEnvironment.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLScriptable.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLScriptable.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLScriptable.java 2013-12-12 18:52:03 UTC (rev 8836) @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.activex.javascript.msxml; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import net.sourceforge.htmlunit.corejs.javascript.Context; +import net.sourceforge.htmlunit.corejs.javascript.Scriptable; + +import com.gargoylesoftware.htmlunit.html.DomNode; +import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; + +/** + * Base class for MSXML's (ActiveX) JavaScript host objects in HtmlUnit. + * + * @version $Revision$ + * @author Frank Danek + */ +public class MSXMLScriptable extends SimpleScriptable { + + private static final Log LOG = LogFactory.getLog(MSXMLScriptable.class); + + private MSXMLJavaScriptEnvironment environment_; + + /** + * {@inheritDoc} + */ + @Override + public void setParentScope(final Scriptable m) { + super.setParentScope(m); + + if (m instanceof MSXMLScriptable) { + setEnvironment(((MSXMLScriptable) m).getEnvironment()); + } + } + + /** + * Builds a new the JavaScript object that corresponds to the specified object. + * @param domNode the DOM node for which a JS object should be created + * @return the JavaScript object + */ + public SimpleScriptable makeScriptableFor(final DomNode domNode) { + // Get the JS class name for the specified DOM node. + // Walk up the inheritance chain if necessary. + Class<? extends MSXMLScriptable> javaScriptClass = null; + for (Class<?> c = domNode.getClass(); javaScriptClass == null && c != null; c = c.getSuperclass()) { + javaScriptClass = getEnvironment().getJavaScriptClass(c); + } + + final MSXMLScriptable scriptable; + if (javaScriptClass == null) { + // We don't have a specific subclass for this element so create something generic. + scriptable = new XMLDOMElement(); + if (LOG.isDebugEnabled()) { + LOG.debug("No MSXML JavaScript class found for element <" + domNode.getNodeName() + + ">. Using XMLDOMElement"); + } + } + else { + try { + scriptable = javaScriptClass.newInstance(); + } + catch (final Exception e) { + throw Context.throwAsScriptRuntimeEx(e); + } + } + initParentScope(domNode, scriptable); + + scriptable.setPrototype(getPrototype(javaScriptClass)); + scriptable.setDomNode(domNode); + scriptable.setEnvironment(getEnvironment()); + + return scriptable; + } + + /** + * Gets the prototype object for the given host class. + * @param javaScriptClass the host class + * @return the prototype + */ + @SuppressWarnings("unchecked") + protected Scriptable getPrototype(final Class<? extends SimpleScriptable> javaScriptClass) { + final Scriptable prototype = getEnvironment().getPrototype(javaScriptClass); + if (prototype == null && javaScriptClass != SimpleScriptable.class) { + return getPrototype((Class<? extends SimpleScriptable>) javaScriptClass.getSuperclass()); + } + return prototype; + } + + /** + * {@inheritDoc} + */ + @Override + public String getClassName() { + return "Object"; + } + + /** + * @return the environment_ + */ + public MSXMLJavaScriptEnvironment getEnvironment() { + return environment_; + } + + /** + * @param environment the environment_ to set + */ + public void setEnvironment(final MSXMLJavaScriptEnvironment environment) { + environment_ = environment; + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLScriptable.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttribute.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttribute.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttribute.java 2013-12-12 18:52:03 UTC (rev 8836) @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.activex.javascript.msxml; + +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; +import net.sourceforge.htmlunit.corejs.javascript.Context; + +import com.gargoylesoftware.htmlunit.html.DomAttr; +import com.gargoylesoftware.htmlunit.html.DomElement; +import com.gargoylesoftware.htmlunit.html.DomText; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; +import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; +import com.gargoylesoftware.htmlunit.javascript.host.Node; +import com.gargoylesoftware.htmlunit.util.StringUtils; + +/** + * A JavaScript object for MSXML's (ActiveX) XMLDOMAttribute.<br> + * Represents an attribute of the IXMLDOMElement. Valid and default values for the attribute are defined in a + * document type definition (DTD) or schema. + * @see <a href="http://msdn.microsoft.com/en-us/library/ms762738.aspx">MSDN documentation</a> + * + * @version $Revision$ + * @author Sudhan Moghe + * @author Frank Danek + */ +@JsxClass(domClass = DomAttr.class, browsers = @WebBrowser(IE)) +public class XMLDOMAttribute extends XMLDOMNode { + + private XMLDOMText textNode_; + + /** + * Creates an instance. JavaScript objects must have a default constructor. + */ + public XMLDOMAttribute() { } + + /** + * Returns a node list containing the child nodes. + * @return a node list containing the child nodes + */ + @Override + public XMLDOMNodeList getChildNodes() { + initTextNode(); + + return super.getChildNodes(); + } + + /** + * Returns the first child of the attribute. + * @return the first child of the attribute + */ + @Override + public XMLDOMNode getFirstChild() { + return getLastChild(); + } + + /** + * Returns the last child attribute. + * @return the last child attribute + */ + @Override + public XMLDOMNode getLastChild() { + initTextNode(); + + return textNode_; + } + + private void initTextNode() { + if (textNode_ == null) { + final String value = getValue(); + if (!org.apache.commons.lang3.StringUtils.isEmpty(value)) { + final DomText text = new DomText(getDomNodeOrDie().getPage(), value); + getDomNodeOrDie().appendChild(text); + textNode_ = (XMLDOMText) text.getScriptObject(); + } + } + } + + /** + * Returns the attribute name. + * @return the attribute name + */ + @JsxGetter + public String getName() { + return getDomNodeOrDie().getName(); + } + + /** + * Returns the text associated with the attribute. + * @return the text associated with the attribute + */ + @Override + public String getNodeValue() { + return getValue(); + } + + /** + * Sets the text associated with the attribute. + * @param value the new text associated with the attribute + */ + @Override + public void setNodeValue(final String value) { + setValue(value); + } + + /** + * Returns the parent node. + * @return <code>null</code> + */ + @Override + public Node getParentNode() { + return null; + } + + /** + * Indicates whether the attribute is explicitly specified or derived from a default value in + * the document type definition (DTD) or schema. + * @return <code>true</code> if this attribute has been explicitly specified + */ + @JsxGetter + public boolean getSpecified() { + return getDomNodeOrDie().getSpecified(); + } + + /** + * Returns a string representing the value of the attribute with entities expanded. + * @return the value of this attribute + */ + @Override + public Object getText() { + return getValue(); + } + + /** + * Sets the text content of the attribute. + * @param value the text content of the attribute + */ + @Override + public void setText(final Object value) { + setValue(value == null ? null : Context.toString(value)); + } + + /** + * Returns the attribute value. + * @return the attribute value + */ + @JsxGetter + public String getValue() { + return getDomNodeOrDie().getValue(); + } + + /** + * Sets the attribute value. + * @param value the new attribute value + */ + @JsxSetter + public void setValue(final String value) { + getDomNodeOrDie().setValue(value); + + resetTextNode(); + } + + private void resetTextNode() { + if (textNode_ != null) { + getDomNodeOrDie().removeChild(textNode_.getDomNodeOrNull()); + textNode_ = null; + } + } + + /** + * {@inheritDoc} + */ + @Override + public String getXml() { + final StringBuilder sb = new StringBuilder(getName()); + sb.append('=').append('"'); + sb.append(StringUtils.escapeXmlAttributeValue(getValue())); + sb.append('"'); + return sb.toString(); + } + + /** + * Detaches this attribute from the parent HTML element after caching the attribute value. + */ + public void detachFromParent() { + final DomAttr domNode = getDomNodeOrDie(); + final DomElement parent = (DomElement) domNode.getParentNode(); + if (parent != null) { + domNode.setValue(parent.getAttribute(getName())); + } + domNode.remove(); + } + + /** + * {@inheritDoc} + */ + @Override + @SuppressWarnings("unchecked") + public DomAttr getDomNodeOrDie() throws IllegalStateException { + return super.getDomNodeOrDie(); + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttribute.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASection.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASection.java 2013-12-12 18:52:03 UTC (rev 8836) @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.activex.javascript.msxml; + +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; + +import com.gargoylesoftware.htmlunit.html.DomCDataSection; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; +import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; + +/** + * A JavaScript object for MSXML's (ActiveX) XMLDOMCDATASection.<br> + * Used to quote or escape blocks of text to keep that text from being interpreted as markup language. + * @see <a href="http://msdn.microsoft.com/en-us/library/ms762780.aspx">MSDN documentation</a> + * + * @version $Revision$ + * @author Ahmed Ashour + * @author Frank Danek + */ +@JsxClass(domClass = DomCDataSection.class, browsers = @WebBrowser(IE)) +public final class XMLDOMCDATASection extends XMLDOMText { + + /** + * Creates an instance. JavaScript objects must have a default constructor. + */ + public XMLDOMCDATASection() { + } + +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASection.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCharacterData.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCharacterData.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCharacterData.java 2013-12-12 18:52:03 UTC (rev 8836) @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.activex.javascript.msxml; + +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; +import net.sourceforge.htmlunit.corejs.javascript.Context; + +import com.gargoylesoftware.htmlunit.html.DomCharacterData; +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.JsxSetter; +import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; + +/** + * A JavaScript object for MSXML's (ActiveX) XMLDOMCharacterData.<br> + * Provides text manipulation methods that are used by several objects. + * @see <a href="http://msdn.microsoft.com/en-us/library/ms767515.aspx">MSDN documentation</a> + * + * @version $Revision$ + * @author David K. Taylor + * @author Chris Erskine + * @author Frank Danek + */ +@JsxClass(domClass = DomCharacterData.class, browsers = @WebBrowser(IE)) +public class XMLDOMCharacterData extends XMLDOMNode { + + /** + * Creates an instance. JavaScript objects must have a default constructor. + */ + public XMLDOMCharacterData() { + } + + /** + * Returns the node data depending on the node type. + * @return the node data depending on the node type + */ + @JsxGetter + public Object getData() { + final DomCharacterData domCharacterData = getDomNodeOrDie(); + return domCharacterData.getData(); + } + + /** + * Sets the node data depending on the node type. + * @param newData the node data depending on the node type + */ + @JsxSetter + public void setData(final String newData) { + if (newData == null || "null".equals(newData)) { + throw Context.reportRuntimeError("Type mismatch."); + } + + final DomCharacterData domCharacterData = getDomNodeOrDie(); + domCharacterData.setData(newData); + } + + /** + * Returns the length, in characters, of the data. + * @return the length of the data + */ + @JsxGetter + public int getLength() { + final DomCharacterData domCharacterData = getDomNodeOrDie(); + return domCharacterData.getLength(); + } + + /** + * Sets the text contained in the node. + * @param newText the text contained in the node + */ + @Override + public void setText(final Object newText) { + setData(newText == null ? null : Context.toString(newText)); + } + + /** + * {@inheritDoc} + */ + @Override + public Object getXml() { + Object xml = super.getXml(); + if (xml instanceof String) { + final String xmlString = (String) xml; + if (xmlString.indexOf('\n') >= 0) { + xml = xmlString.replaceAll("([^\r])\n", "$1\r\n"); + } + } + return xml; + } + + /** + * Appends the supplied string to the existing string data. + * @param data the data that is to be appended to the existing string + */ + @JsxFunction + public void appendData(final String data) { + if (data == null || "null".equals(data)) { + throw Context.reportRuntimeError("Type mismatch."); + } + + final DomCharacterData domCharacterData = getDomNodeOrDie(); + domCharacterData.appendData(data); + } + + /** + * Deletes specified data. + * @param offset the offset, in characters, at which to start deleting string data + * @param count the number of characters to delete + */ + @JsxFunction + public void deleteData(final int offset, final int count) { + if (offset < 0) { + throw Context.reportRuntimeError("The offset must be 0 or a positive number that is not greater than the " + + "number of characters in the data."); + } + if (count < 0) { + throw Context.reportRuntimeError("The offset must be 0 or a positive number that is not greater than the " + + "number of characters in the data."); + } + if (count == 0) { + return; + } + + final DomCharacterData domCharacterData = (DomCharacterData) getDomNodeOrDie(); + if (offset > domCharacterData.getLength()) { + throw Context.reportRuntimeError("The offset must be 0 or a positive number that is not greater than the " + + "number of characters in the data."); + } + + domCharacterData.deleteData(offset, count); + } + + /** + * Inserts a string at the specified offset. + * @param offset the offset, in characters, at which to insert the supplied string data + * @param data the data that is to be inserted into the existing string + */ + @JsxFunction + public void insertData(final int offset, final String data) { + if (data.isEmpty()) { + return; + } + if (offset < 0) { + throw Context.reportRuntimeError("The offset must be 0 or a positive number that is not greater than the " + + "number of characters in the data."); + } + if (data == null || "null".equals(data)) { + throw Context.reportRuntimeError("Type mismatch."); + } + + final DomCharacterData domCharacterData = getDomNodeOrDie(); + if (offset > domCharacterData.getLength()) { + throw Context.reportRuntimeError("The offset must be 0 or a positive number that is not greater than the " + + "number of characters in the data."); + } + + domCharacterData.insertData(offset, data); + } + + /** + * Replaces the specified number of characters with the supplied string. + * @param offset the offset, in characters, at which to start replacing string data + * @param count the number of characters to replace + * @param data the new data that replaces the old string data + */ + @JsxFunction + public void replaceData(final int offset, final int count, final String data) { + if (offset < 0) { + throw Context.reportRuntimeError("The offset must be 0 or a positive number that is not greater than the " + + "number of characters in the data."); + } + if (count < 0) { + throw Context.reportRuntimeError("The offset must be 0 or a positive number that is not greater than the " + + "number of characters in the data."); + } + if (data == null || "null".equals(data)) { + throw Context.reportRuntimeError("Type mismatch."); + } + + final DomCharacterData domCharacterData = getDomNodeOrDie(); + if (offset > domCharacterData.getLength()) { + throw Context.reportRuntimeError("The offset must be 0 or a positive number that is not greater than the " + + "number of characters in the data."); + } + + domCharacterData.replaceData(offset, count, data); + } + + /** + * Retrieves a substring of the full string from the specified range. + * @param offset the offset, in characters, from the beginning of the string. An offset of zero indicates + * copying from the start of the data + * @param count the number of characters to retrieve from the specified offset + * @return the substring + */ + @JsxFunction + public String substringData(final int offset, final int count) { + if (offset < 0) { + throw Context.reportRuntimeError("The offset must be 0 or a positive number that is not greater than the " + + "number of characters in the data."); + } + if (count < 0) { + throw Context.reportRuntimeError("The offset must be 0 or a positive number that is not greater than the " + + "number of characters in the data."); + } + + final DomCharacterData domCharacterData = getDomNodeOrDie(); + if (offset > domCharacterData.getLength()) { + throw Context.reportRuntimeError("The offset must be 0 or a positive number that is not greater than the " + + "number of characters in the data."); + } + + return domCharacterData.substringData(offset, count); + } + + /** + * {@inheritDoc} + */ + @Override + @SuppressWarnings("unchecked") + public DomCharacterData getDomNodeOrDie() { + return (DomCharacterData) super.getDomNodeOrDie(); + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCharacterData.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMComment.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMComment.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMComment.java 2013-12-12 18:52:03 UTC (rev 8836) @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.activex.javascript.msxml; + +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; + +import com.gargoylesoftware.htmlunit.html.DomComment; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; +import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; + +/** + * A JavaScript object for MSXML's (ActiveX) XMLDOMComment.<br> + * Represents the content of an XML comment. + * @see <a href="http://msdn.microsoft.com/en-us/library/ms765529.aspx">MSDN documentation</a> + * + * @version $Revision$ + * @author Mirko Friedenhagen + * @author Ahmed Ashour + * @author Frank Danek + */ +@JsxClass(domClass = DomComment.class, browsers = @WebBrowser(IE)) +public final class XMLDOMComment extends XMLDOMCharacterData { + + /** + * Creates an instance. JavaScript objects must have a default constructor. + */ + public XMLDOMComment() { + } + + /** + * Returns the text contained in the node. + * @return the text contained in the node + */ + @Override + public String getText() { + return (String) getData(); + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMComment.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument.java 2013-12-12 18:52:03 UTC (rev 8836) @@ -0,0 +1,710 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.activex.javascript.msxml; + +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; + +import java.io.IOException; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +import net.sourceforge.htmlunit.corejs.javascript.Context; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.w3c.dom.Node; + +import com.gargoylesoftware.htmlunit.ElementNotFoundException; +import com.gargoylesoftware.htmlunit.SgmlPage; +import com.gargoylesoftware.htmlunit.StringWebResponse; +import com.gargoylesoftware.htmlunit.WebRequest; +import com.gargoylesoftware.htmlunit.WebResponse; +import com.gargoylesoftware.htmlunit.WebWindow; +import com.gargoylesoftware.htmlunit.html.DomAttr; +import com.gargoylesoftware.htmlunit.html.DomCDataSection; +import com.gargoylesoftware.htmlunit.html.DomComment; +import com.gargoylesoftware.htmlunit.html.DomDocumentFragment; +import com.gargoylesoftware.htmlunit.html.DomElement; +import com.gargoylesoftware.htmlunit.html.DomNode; +import com.gargoylesoftware.htmlunit.html.DomProcessingInstruction; +import com.gargoylesoftware.htmlunit.html.DomText; +import com.gargoylesoftware.htmlunit.html.HTMLParser; +import com.gargoylesoftware.htmlunit.html.HtmlElement; +import com.gargoylesoftware.htmlunit.html.HtmlPage; +import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; +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.JsxSetter; +import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; +import com.gargoylesoftware.htmlunit.xml.XmlPage; + +/** + * A JavaScript object for MSXML's (ActiveX) XMLDOMDocument.<br> + * Represents the top level of the XML source. Includes members for retrieving and creating all other XML objects. + * @see <a href="http://msdn.microsoft.com/en-us/library/ms756987.aspx">MSDN documentation</a> + * + * @version $Revision$ + * @author Ahmed Ashour + * @author Marc Guillemot + * @author Sudhan Moghe + * @author Ronald Brill + * @author Chuck Dumont + * @author Frank Danek + */ +@JsxClass(browsers = @WebBrowser(IE)) +public class XMLDOMDocument extends XMLDOMNode { + + private static final Log LOG = LogFactory.getLog(XMLDOMDocument.class); + + private boolean async_ = true; + private XMLDOMImplementation implementation_; + private boolean preserveWhiteSpace_; + private boolean preserveWhiteSpaceDuringLoad_ = true; + private XMLDOMParseError parseError_; + private Map<String, String> properties_ = new HashMap<String, String>(); + private String url_ = ""; + + /** + * Creates a new instance. JavaScript objects must have a default constructor. + */ + public XMLDOMDocument() { + this(null); + } + + /** + * Creates a new instance, with associated {@link XmlPage}. + * @param enclosingWindow the window + */ + public XMLDOMDocument(final WebWindow enclosingWindow) { + if (enclosingWindow != null) { + try { + final XmlPage page = new XmlPage((WebResponse) null, enclosingWindow, true, false); + setDomNode(page); + } + catch (final IOException e) { + throw Context.reportRuntimeError("IOException: " + e); + } + } + } + + /** + * Returns if asynchronous download is permitted. + * @return if asynchronous download is permitted + */ + @JsxGetter + public boolean getAsync() { + return async_; + } + + /** + * Sets if asynchronous download is permitted. + * @param async if asynchronous download is permitted + */ + @JsxSetter + public void setAsync(final boolean async) { + async_ = async; + } + + /** + * Returns the document type node that specifies the DTD for this document. + * @return the document type node that specifies the DTD for this document + */ + @JsxGetter + public XMLDOMDocumentType getDoctype() { + final Object documentType = getPage().getDoctype(); + if (documentType == null) { + return null; + } + return (XMLDOMDocumentType) getScriptableFor(documentType); + } + + /** + * Returns the root element of the document. + * @return the root element of the document + */ + @JsxGetter + public XMLDOMElement getDocumentElement() { + final Object documentElement = getPage().getDocumentElement(); + if (documentElement == null) { + // for instance with an XML document with parsing error + return null; + } + return (XMLDOMElement) getScriptableFor(documentElement); + } + + /** + * Sets the root element of the document. + * @param element the root element of the document + */ + @JsxSetter + public void setDocumentElement(final XMLDOMElement element) { + if (element == null) { + throw Context.reportRuntimeError("Type mismatch."); + } + + final XMLDOMElement documentElement = getDocumentElement(); + if (documentElement != null) { + documentElement.getDomNodeOrDie().remove(); + } + + appendChild(element); + } + + /** + * Returns the implementation object for the document. + * @return the implementation object for the doc... [truncated message content] |
From: <rb...@us...> - 2013-12-12 18:55:32
|
Revision: 8838 http://sourceforge.net/p/htmlunit/code/8838 Author: rbri Date: 2013-12-12 18:55:29 +0000 (Thu, 12 Dec 2013) Log Message: ----------- first huge implementation step forward to support IE11 [Frank Danek] this introduces a completely separate implementation of the MSXMLActiveXObject (IE11 supports this AND a build in one) Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocument.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/javascript/host/xml/XMLDocument2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocumentTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequestCORSTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequestTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLSerializerTest.java Added Paths: ----------- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactoryTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLTestUtil.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttributeTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASectionTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCommentTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument3Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentFragmentTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentTypeTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMImplementationTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNamedNodeMapTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNodeListTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMParseErrorTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMProcessingInstructionTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMTextTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLHTTPRequestTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLSerializerTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLProcessorTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/package.html Removed Paths: ------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLAttr.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDOMParseError.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDomParserErrorTest.java Deleted: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLAttr.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLAttr.java 2013-12-12 18:54:25 UTC (rev 8837) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLAttr.java 2013-12-12 18:55:29 UTC (rev 8838) @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2002-2013 Gargoyle Software Inc. - * - * 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 com.gargoylesoftware.htmlunit.javascript.host.xml; - -import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; - -import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; -import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; -import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; -import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; -import com.gargoylesoftware.htmlunit.javascript.host.Attr; -import com.gargoylesoftware.htmlunit.util.StringUtils; - -/** - * A JavaScript object for an Attribute of XMLElement. - * - * @see <a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-63764602">W3C DOM Level 2</a> - * @see <a href="http://msdn.microsoft.com/en-us/library/ms762738.aspx">MSDN documentation</a> - * @version $Revision$ - * @author Sudhan Moghe - */ -@JsxClass -public class XMLAttr extends Attr { - - /** - * Creates an instance. JavaScript objects must have a default constructor. - */ - public XMLAttr() { } - - /** - * Returns the text of this attribute. - * @return the value of this attribute - */ - @JsxGetter(@WebBrowser(IE)) - public String getText() { - return getValue(); - } - - /** - * Sets the text of this attribute. - * @param value the new value of this attribute - */ - @JsxSetter(@WebBrowser(IE)) - public void setText(final String value) { - setValue(value); - } - - /** - * Returns the base name of this element. - * @return the base name of this element - */ - @JsxGetter(@WebBrowser(IE)) - public Object getBaseName() { - return getDomNodeOrDie().getLocalName(); - } - - /** - * {@inheritDoc} - */ - @Override - public String getXml() { - final StringBuilder sb = new StringBuilder(getName()); - sb.append('=').append('"'); - sb.append(StringUtils.escapeXmlAttributeValue(getValue())); - sb.append('"'); - return sb.toString(); - } -} Deleted: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDOMParseError.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDOMParseError.java 2013-12-12 18:54:25 UTC (rev 8837) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDOMParseError.java 2013-12-12 18:55:29 UTC (rev 8838) @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2002-2013 Gargoyle Software Inc. - * - * 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 com.gargoylesoftware.htmlunit.javascript.host.xml; - -import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; - -import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; -import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; -import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; -import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; - -/** - * A JavaScript object for XMLDOMParseError. - * @see <a href="http://msdn2.microsoft.com/en-us/library/ms757019.aspx">MSDN documentation</a> - * - * @version $Revision$ - * @author Ahmed Ashour - */ -@JsxClass(browsers = @WebBrowser(IE)) -public class XMLDOMParseError extends SimpleScriptable { - - private int errorCode_; - private int filepos_; - private int line_; - private int linepos_; - private String reason_ = ""; - private String srcText_ = ""; - private String url_ = ""; - - /** - * Returns the error code of the last parse error. - * @return the error code of the last parse error - */ - @JsxGetter - public int getErrorCode() { - return errorCode_; - } - - /** - * Returns the absolute file position where the error occurred. - * @return the absolute file position where the error occurred - */ - @JsxGetter - public int getFilepos() { - return filepos_; - } - - /** - * Returns the line number that contains the error. - * @return the line number that contains the error - */ - @JsxGetter - public int getLine() { - return line_; - } - - /** - * Returns the character position within the line where the error occurred. - * @return the character position within the line where the error occurred - */ - @JsxGetter - public int getLinepos() { - return linepos_; - } - - /** - * Returns the reason for the error. - * @return the reason for the error - */ - @JsxGetter - public String getReason() { - return reason_; - } - - /** - * Returns the full text of the line containing the error. - * @return the full text of the line containing the error - */ - @JsxGetter - public String getSrcText() { - return srcText_; - } - - /** - * Returns the URL of the XML document containing the last error. - * @return the URL of the XML document containing the last error - */ - @JsxGetter - public String getUrl() { - return url_; - } - - void setErrorCode(final int errorCode) { - errorCode_ = errorCode; - } - - void setFilepos(final int filepos) { - filepos_ = filepos; - } - - void setLine(final int line) { - line_ = line; - } - - void setLinepos(final int linepos) { - linepos_ = linepos; - } - - void setReason(final String reason) { - reason_ = reason; - } - - void setSrcText(final String srcText) { - srcText_ = srcText; - } - - void setUrl(final String url) { - url_ = url; - } -} Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocument.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocument.java 2013-12-12 18:54:25 UTC (rev 8837) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocument.java 2013-12-12 18:55:29 UTC (rev 8838) @@ -14,24 +14,18 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.xml; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML_ATTRIBUTE_HAS_TEXT_PROPERTY; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_CLASS_NAME; 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.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import net.sourceforge.htmlunit.corejs.javascript.Context; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Node; -import com.gargoylesoftware.htmlunit.SgmlPage; import com.gargoylesoftware.htmlunit.StringWebResponse; import com.gargoylesoftware.htmlunit.WebRequest; import com.gargoylesoftware.htmlunit.WebResponse; @@ -65,15 +59,12 @@ * @author Chuck Dumont * @author Frank Danek */ -@JsxClass(browsers = { @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 10) }) +@JsxClass(browsers = { @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public class XMLDocument extends Document { private static final Log LOG = LogFactory.getLog(XMLDocument.class); private boolean async_ = true; - private boolean preserveWhiteSpace_; - private XMLDOMParseError parseError_; - private Map<String, String> properties_ = new HashMap<String, String>(); /** * Creates a new instance. JavaScript objects must have a default constructor. @@ -99,10 +90,23 @@ } /** + * {@inheritDoc} + */ + @Override + public String getClassName() { + if (getWindow().getWebWindow() != null) { + if (getBrowserVersion().hasFeature(JS_DOCUMENT_CLASS_NAME)) { + return "Document"; + } + } + return super.getClassName(); + } + + /** * Sets the <tt>async</tt> attribute. * @param async Whether or not to send the request to the server asynchronously */ - @JsxSetter + @JsxSetter(@WebBrowser(FF)) public void setAsync(final boolean async) { async_ = async; } @@ -111,7 +115,7 @@ * Returns Whether or not to send the request to the server asynchronously. * @return the <tt>async</tt> attribute */ - @JsxGetter + @JsxGetter(@WebBrowser(FF)) public boolean getAsync() { return async_; } @@ -122,7 +126,7 @@ * @param xmlSource a string containing a URL that specifies the location of the XML file * @return true if the load succeeded; false if the load failed */ - @JsxFunction + @JsxFunction(@WebBrowser(FF)) public boolean load(final String xmlSource) { if (async_) { if (LOG.isDebugEnabled()) { @@ -138,14 +142,6 @@ return true; } catch (final IOException e) { - final XMLDOMParseError parseError = getParseError(); - parseError.setErrorCode(-1); - parseError.setFilepos(1); - parseError.setLine(1); - parseError.setLinepos(1); - parseError.setReason(e.getMessage()); - parseError.setSrcText("xml"); - parseError.setUrl(xmlSource); if (LOG.isDebugEnabled()) { LOG.debug("Error parsing XML from '" + xmlSource + "'", e); } @@ -160,7 +156,6 @@ * This string can contain an entire XML document or a well-formed fragment. * @return true if the load succeeded; false if the load failed */ - @JsxFunction({ @WebBrowser(IE), @WebBrowser(CHROME) }) public boolean loadXML(final String strXML) { try { final WebWindow webWindow = getWindow().getWebWindow(); @@ -191,12 +186,7 @@ scriptable = new Element(); } else if (domNode instanceof DomAttr) { - if (getPage().getWebClient().getBrowserVersion().hasFeature(JS_XML_ATTRIBUTE_HAS_TEXT_PROPERTY)) { - scriptable = new XMLAttr(); - } - else { - scriptable = new Attr(); - } + scriptable = new Attr(); } else { return super.makeScriptableFor(domNode); @@ -217,115 +207,10 @@ } /** - * Gets the JavaScript property "parseError" for the document. - * @return the ParserError object for the document - */ - @JsxGetter({ @WebBrowser(IE), @WebBrowser(CHROME) }) - public XMLDOMParseError getParseError() { - if (parseError_ == null) { - parseError_ = new XMLDOMParseError(); - parseError_.setPrototype(getPrototype(parseError_.getClass())); - parseError_.setParentScope(getParentScope()); - } - return parseError_; - } - - /** - * Contains the XML representation of the node and all its descendants. - * @return an XML representation of this node and all its descendants - */ - @Override - @JsxGetter({ @WebBrowser(IE), @WebBrowser(CHROME) }) - public String getXml() { - final XMLSerializer seralizer = new XMLSerializer(); - seralizer.setParentScope(getWindow()); - seralizer.setPrototype(getPrototype(seralizer.getClass())); - return seralizer.serializeToString(getDocumentElement()); - } - - /** - * Gets the current white space handling. - * @return the current white space handling - */ - @JsxGetter({ @WebBrowser(IE), @WebBrowser(CHROME) }) - public boolean getPreserveWhiteSpace() { - return preserveWhiteSpace_; - } - - /** - * Specifies the white space handling. - * @param preserveWhiteSpace white space handling - */ - @JsxSetter({ @WebBrowser(IE), @WebBrowser(CHROME) }) - public void setPreserveWhiteSpace(final boolean preserveWhiteSpace) { - preserveWhiteSpace_ = preserveWhiteSpace; - } - - /** - * This method is used to set - * <a href="http://msdn2.microsoft.com/en-us/library/ms766391.aspx">second-level properties</a> - * on the DOM object. - * - * @param name the name of the property to be set - * @param value the value of the specified property - */ - @JsxFunction({ @WebBrowser(IE), @WebBrowser(CHROME) }) - public void setProperty(final String name, final String value) { - properties_.put(name, value); - } - - /** - * Returns the value of the property set by {@link #setProperty(String, String)}. - * - * @param name the name of the property to get - * @return the property value - */ - @JsxFunction({ @WebBrowser(IE), @WebBrowser(CHROME) }) - public String getProperty(final String name) { - return properties_.get(name); - } - - /** - * Applies the specified XPath expression to this node's context and returns the generated list of matching nodes. - * @param expression a string specifying an XPath expression - * @return list of the found elements - */ - @JsxFunction({ @WebBrowser(IE), @WebBrowser(CHROME) }) - public HTMLCollection selectNodes(final String expression) { - final boolean attributeChangeSensitive = expression.contains("@"); - final String description = "XMLDocument.selectNodes('" + expression + "')"; - final SgmlPage page = getPage(); - final HTMLCollection collection = new HTMLCollection(page.getDocumentElement(), - attributeChangeSensitive, description) { - @Override - protected List<Object> computeElements() { - final List<Object> list = new ArrayList<Object>(page.getByXPath(expression)); - return list; - } - }; - return collection; - } - - /** - * Applies the specified pattern-matching operation to this node's context and returns the first matching node. - * @param expression a string specifying an XPath expression - * @return the first node that matches the given pattern-matching operation - * If no nodes match the expression, returns a null value. - */ - @JsxFunction({ @WebBrowser(IE), @WebBrowser(CHROME) }) - public Object selectSingleNode(final String expression) { - final HTMLCollection collection = selectNodes(expression); - if (collection.getLength() > 0) { - return collection.get(0, collection); - } - return null; - } - - /** * {@inheritDoc} */ @Override - @JsxFunction({ @WebBrowser(IE), @WebBrowser(CHROME) }) + @JsxFunction public HTMLCollection getElementsByTagName(final String tagName) { final DomNode firstChild = getDomNodeOrDie().getFirstChild(); if (firstChild == null) { @@ -366,16 +251,6 @@ } /** - * Since we are not processing DTD, this method always returns null. - * @param id the ID to search for - * @return null - */ - @JsxFunction({ @WebBrowser(IE), @WebBrowser(CHROME) }) - public Object nodeFromID(final String id) { - return null; - } - - /** * Creates a new ProcessingInstruction. * @param target the target * @param data the data @@ -397,28 +272,4 @@ final DomCDataSection node = ((XmlPage) getPage()).createCDATASection(data); return getScriptableFor(node); } - - /** - * Creates a node using the supplied type, name, and namespace. - * @param type a value that uniquely identifies the node type - * @param name the value for the new node's nodeName property - * @param namespaceURI A string defining the namespace URI. - * If specified, the node is created in the context of the namespaceURI parameter - * with the prefix specified on the node name. - * If the name parameter does not have a prefix, this is treated as the default namespace. - * @return the newly created node - */ - @JsxFunction({ @WebBrowser(IE), @WebBrowser(CHROME) }) - public Object createNode(final Object type, final String name, final Object namespaceURI) { - switch((short) Context.toNumber(type)) { - case Node.ELEMENT_NODE: - return createElementNS((String) namespaceURI, name); - case Node.ATTRIBUTE_NODE: - return createAttribute(name); - - default: - throw Context.reportRuntimeError("xmlDoc.createNode(): Unsupported type " - + (short) Context.toNumber(type)); - } - } } 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-12-12 18:54:25 UTC (rev 8837) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java 2013-12-12 18:55:29 UTC (rev 8838) @@ -14,7 +14,6 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.xml; -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_IGNORE_SAME_ORIGIN; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_IGNORE_SAME_ORIGIN_TO_ABOUT; @@ -23,6 +22,7 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_ONREADYSTATECHANGE_WITH_EVENT_PARAM; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_OPEN_ALLOW_EMTPY_URL; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_ORIGIN_HEADER; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_RESPONSE_XML_IS_ACTIVEXOBJECT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_STATUS_THROWS_EXCEPTION_WHEN_UNSET; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_TRIGGER_ONLOAD_ON_COMPLETED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_WITHCREDENTIALS_ALLOW_ORIGIN_ALL; @@ -61,6 +61,9 @@ import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebRequest; import com.gargoylesoftware.htmlunit.WebResponse; +import com.gargoylesoftware.htmlunit.WebWindow; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLActiveXObjectFactory; +import com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMDocument; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine; import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; @@ -72,7 +75,6 @@ import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; -import com.gargoylesoftware.htmlunit.javascript.host.ActiveXObject; import com.gargoylesoftware.htmlunit.javascript.host.Event; import com.gargoylesoftware.htmlunit.util.NameValuePair; import com.gargoylesoftware.htmlunit.util.WebResponseWrapper; @@ -88,6 +90,7 @@ * @author Stuart Begg * @author Ronald Brill * @author Sebastian Cato + * @author Frank Danek * * @see <a href="http://www.w3.org/TR/XMLHttpRequest/">W3C XMLHttpRequest</a> * @see <a href="http://developer.apple.com/internet/webcontent/xmlhttpreq.html">Safari documentation</a> @@ -237,7 +240,7 @@ * Returns the event handler that fires on load. * @return the event handler that fires on load */ - @JsxGetter({ @WebBrowser(value = IE, maxVersion = 6), @WebBrowser(FF) }) + @JsxGetter({ @WebBrowser(value = IE, minVersion = 11), @WebBrowser(FF) }) public Function getOnload() { return loadHandler_; } @@ -246,7 +249,7 @@ * Sets the event handler that fires on load. * @param loadHandler the event handler that fires on load */ - @JsxSetter({ @WebBrowser(value = IE, maxVersion = 6), @WebBrowser(FF) }) + @JsxSetter({ @WebBrowser(value = IE, minVersion = 11), @WebBrowser(FF) }) public void setOnload(final Function loadHandler) { loadHandler_ = loadHandler; } @@ -255,7 +258,7 @@ * Returns the event handler that fires on error. * @return the event handler that fires on error */ - @JsxGetter + @JsxGetter({ @WebBrowser(value = IE, minVersion = 11), @WebBrowser(FF) }) public Function getOnerror() { return errorHandler_; } @@ -264,7 +267,7 @@ * Sets the event handler that fires on error. * @param errorHandler the event handler that fires on error */ - @JsxSetter + @JsxSetter({ @WebBrowser(value = IE, minVersion = 11), @WebBrowser(FF) }) public void setOnerror(final Function errorHandler) { errorHandler_ = errorHandler; } @@ -341,19 +344,21 @@ } final String contentType = webResponse_.getContentType(); if (contentType.isEmpty() || contentType.contains("xml")) { + final WebWindow webWindow = getWindow().getWebWindow(); try { - final XmlPage page = new XmlPage(webResponse_, getWindow().getWebWindow()); - final XMLDocument doc; - if (getBrowserVersion().hasFeature(JS_XML_SUPPORT_VIA_ACTIVEXOBJECT)) { - doc = ActiveXObject.buildXMLDocument(getWindow().getWebWindow()); + if (getBrowserVersion().hasFeature(XHR_RESPONSE_XML_IS_ACTIVEXOBJECT)) { + final XmlPage page = new XmlPage(webResponse_, webWindow, true, false); + final MSXMLActiveXObjectFactory factory = webWindow.getWebClient().getMSXMLActiveXObjectFactory(); + final XMLDOMDocument document = (XMLDOMDocument) factory.create("Microsoft.XMLDOM", webWindow); + document.setDomNode(page); + return document; } - else { - doc = new XMLDocument(); - doc.setPrototype(getPrototype(doc.getClass())); - } - doc.setParentScope(getWindow()); - doc.setDomNode(page); - return doc; + final XmlPage page = new XmlPage(webResponse_, webWindow); + final XMLDocument document = new XMLDocument(); + document.setPrototype(getPrototype(document.getClass())); + document.setParentScope(getWindow()); + document.setDomNode(page); + return document; } catch (final IOException e) { LOG.warn("Failed parsing XML document " + webResponse_.getWebRequest().getUrl() + ": " @@ -851,7 +856,7 @@ * @param mimeType the type used to override that returned by the server (if any) * @see <a href="http://xulplanet.com/references/objref/XMLHttpRequest.html#method_overrideMimeType">XUL Planet</a> */ - @JsxFunction({ @WebBrowser(value = IE, maxVersion = 6), @WebBrowser(FF) }) + @JsxFunction(@WebBrowser(FF)) public void overrideMimeType(final String mimeType) { overriddenMimeType_ = mimeType; } @@ -869,7 +874,7 @@ * Sets the "withCredentials" property. * @param withCredentials the "withCredentials" property. */ - @JsxSetter + @JsxSetter({ @WebBrowser(value = IE, minVersion = 9), @WebBrowser(FF) }) public void setWithCredentials(final boolean withCredentials) { if (!async_ && state_ != STATE_UNSENT) { if (getBrowserVersion().hasFeature(XHR_WITHCREDENTIALS_SYNC_NOT_WRITEABLE_EXCEPTION)) { 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-12-12 18:54:25 UTC (rev 8837) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLSerializer.java 2013-12-12 18:55:29 UTC (rev 8838) @@ -49,7 +49,7 @@ * @author Ronald Brill * @author Frank Danek */ -@JsxClass(browsers = { @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 10) }) +@JsxClass(browsers = { @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public class XMLSerializer extends SimpleScriptable { // this is a bit strange but it is the way FF works Added: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactoryTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactoryTest.java (rev 0) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactoryTest.java 2013-12-12 18:55:29 UTC (rev 8838) @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.activex.javascript.msxml; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +/** + * Tests for {@link MSXMLActiveXObjectFactory}. + * + * @version $Revision$ + * @author Frank Danek + */ +public class MSXMLActiveXObjectFactoryTest { + + /** + * @throws Exception if the test fails + */ + @Test + public void supportsXMLDOMDocument() throws Exception { + assertFalse(MSXMLActiveXObjectFactory.isXMLDOMDocument(null)); + assertFalse(MSXMLActiveXObjectFactory.isXMLDOMDocument("foo")); + assertTrue(MSXMLActiveXObjectFactory.isXMLDOMDocument("Microsoft.XmlDom")); + assertTrue(MSXMLActiveXObjectFactory.isXMLDOMDocument("MSXML2.DOMDocument")); + assertTrue(MSXMLActiveXObjectFactory.isXMLDOMDocument("Msxml2.DOMDocument.3.0")); + assertTrue(MSXMLActiveXObjectFactory.isXMLDOMDocument("Msxml2.DOMDocument.4.0")); + assertTrue(MSXMLActiveXObjectFactory.isXMLDOMDocument("Msxml2.DOMDocument.5.0")); + assertTrue(MSXMLActiveXObjectFactory.isXMLDOMDocument("Msxml2.DOMDocument.6.0")); + assertTrue(MSXMLActiveXObjectFactory.isXMLDOMDocument("MSXML2.FreeThreadedDOMDocument")); + assertTrue(MSXMLActiveXObjectFactory.isXMLDOMDocument("Msxml2.FreeThreadedDOMDocument.3.0")); + assertTrue(MSXMLActiveXObjectFactory.isXMLDOMDocument("Msxml2.FreeThreadedDOMDocument.4.0")); + assertTrue(MSXMLActiveXObjectFactory.isXMLDOMDocument("Msxml2.FreeThreadedDOMDocument.5.0")); + assertTrue(MSXMLActiveXObjectFactory.isXMLDOMDocument("Msxml2.FreeThreadedDOMDocument.6.0")); + } + + /** + * @throws Exception if the test fails + */ + @Test + public void supportsXMLHTTPRequest() throws Exception { + assertFalse(MSXMLActiveXObjectFactory.isXMLHTTPRequest(null)); + assertFalse(MSXMLActiveXObjectFactory.isXMLHTTPRequest("foo")); + assertTrue(MSXMLActiveXObjectFactory.isXMLHTTPRequest("Microsoft.XMLHTTP")); + assertTrue(MSXMLActiveXObjectFactory.isXMLHTTPRequest("Msxml2.XMLHTTP")); + assertTrue(MSXMLActiveXObjectFactory.isXMLHTTPRequest("Msxml2.XMLHTTP.3.0")); + assertTrue(MSXMLActiveXObjectFactory.isXMLHTTPRequest("Msxml2.XMLHTTP.4.0")); + assertTrue(MSXMLActiveXObjectFactory.isXMLHTTPRequest("Msxml2.XMLHTTP.5.0")); + assertTrue(MSXMLActiveXObjectFactory.isXMLHTTPRequest("Msxml2.XMLHTTP.6.0")); + } + + /** + * @throws Exception if the test fails + */ + @Test + public void supportsXSLTemplate() throws Exception { + assertFalse(MSXMLActiveXObjectFactory.isXSLTemplate(null)); + assertFalse(MSXMLActiveXObjectFactory.isXSLTemplate("foo")); + assertTrue(MSXMLActiveXObjectFactory.isXSLTemplate("Msxml2.XSLTemplate")); + assertTrue(MSXMLActiveXObjectFactory.isXSLTemplate("Msxml2.XSLTemplate.3.0")); + assertTrue(MSXMLActiveXObjectFactory.isXSLTemplate("Msxml2.XSLTemplate.4.0")); + assertTrue(MSXMLActiveXObjectFactory.isXSLTemplate("Msxml2.XSLTemplate.5.0")); + assertTrue(MSXMLActiveXObjectFactory.isXSLTemplate("Msxml2.XSLTemplate.6.0")); + } +} Property changes on: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactoryTest.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLTestUtil.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLTestUtil.java (rev 0) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLTestUtil.java 2013-12-12 18:55:29 UTC (rev 8838) @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.activex.javascript.msxml; + +import com.gargoylesoftware.htmlunit.html.HtmlPageTest; + +/** + * Test utility stuff for MSXML tests. + * + * @version $Revision$ + * @author Frank Danek + */ +public final class MSXMLTestUtil { + + /** Helper. */ + public static final String CREATE_XMLDOMDOCUMENT_FUNCTION_NAME = "createXMLDOMDocument"; + + /** Helper. **/ + public static final String CREATE_XMLDOMDOCUMENT_FUNCTION = "" + + " function " + CREATE_XMLDOMDOCUMENT_FUNCTION_NAME + "() {\n" + + " return new ActiveXObject('Microsoft.XMLDOM');\n" + + " }\n"; + + /** + * Helper. + * @return xml helper + **/ + public static String callCreateXMLDOMDocument() { + return CREATE_XMLDOMDOCUMENT_FUNCTION_NAME + "()"; + } + + /** Helper. */ + public static final String LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION_NAME = "loadXMLDOMDocumentFromString"; + + /** Helper. **/ + public static final String LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION = "" + + " function " + LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION_NAME + "(xml) {\n" + + " xmlDoc = new ActiveXObject(\"Microsoft.XMLDOM\");\n" + + " xmlDoc.async = false;\n" + + " xmlDoc.loadXML(xml);\n" + + " return xmlDoc;\n" + + " }\n"; + + /** + * Helper. + * @param string the parameter + * @return xml helper + **/ + public static String callLoadXMLDOMDocumentFromString(final String string) { + return LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION_NAME + "(" + string + ")"; + } + + /** Helper. */ + public static final String LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION_NAME = "loadXMLDOMDocumentFromURL"; + + /** Helper. **/ + public static final String LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION = "" + + " function " + LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION_NAME + "(url) {\n" + + " xmlDoc = new ActiveXObject(\"Microsoft.XMLDOM\");\n" + + " xmlDoc.async = false;\n" + + " xmlDoc.load(url);\n" + + " return xmlDoc;\n" + + " }\n"; + + /** + * Helper. + * @param url the parameter + * @return xml helper + **/ + public static String callLoadXMLDOMDocumentFromURL(final String url) { + return LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION_NAME + "(" + url + ")"; + } + + /** Helper. */ + public static final String CREATE_XMLHTTPREQUEST_FUNCTION_NAME = "createXMLHTTPRequest"; + + /** Helper. */ + public static final String CREATE_XMLHTTPREQUEST_FUNCTION = "" + + " function " + CREATE_XMLHTTPREQUEST_FUNCTION_NAME + "() {\n" + + " return new ActiveXObject(\"Microsoft.XMLHTTP\");\n" + + " }\n"; + + /** + * Helper. + * @return xml helper + **/ + public static String callCreateXMLHTTPRequest() { + return CREATE_XMLHTTPREQUEST_FUNCTION_NAME + "()"; + } + + /** Helper. */ + public static final String LOAD_XMLHTTPREQUEST_FROM_URL_FUNCTION_NAME = "loadXMLHTTPRequestFromURL"; + + /** Helper. **/ + public static final String LOAD_XMLHTTPREQUEST_FROM_URL_FUNCTION = "" + + " function " + LOAD_XMLHTTPREQUEST_FROM_URL_FUNCTION_NAME + "(url) {\n" + + " xhr = new ActiveXObject(\"Microsoft.XMLHTTP\");\n" + + " xhr.open(\"GET\", url, false);\n" + + " xhr.send();\n" + + " return xhr;\n" + + " }\n"; + + /** + * Helper. + * @param url the parameter + * @return xml helper + **/ + public static String callLoadXMLHTTPRequestFromURL(final String url) { + return LOAD_XMLHTTPREQUEST_FROM_URL_FUNCTION_NAME + "(" + url + ")"; + } + + /** Helper. */ + public static final String SERIALIZE_XMLDOMDOCUMENT_TO_STRING_FUNCTION_NAME = "serializeXMLDOMDocumentToString"; + + /** Helper. **/ + public static final String SERIALIZE_XMLDOMDOCUMENT_TO_STRING_FUNCTION = "" + + " function " + SERIALIZE_XMLDOMDOCUMENT_TO_STRING_FUNCTION_NAME + "(doc) {\n" + + " return doc.xml;\n" + + " }\n"; + + /** + * Helper. + * @param doc the doc parameter + * @return xml helper + **/ + public static String callSerializeXMLDOMDocumentToString(final String doc) { + return SERIALIZE_XMLDOMDOCUMENT_TO_STRING_FUNCTION_NAME + "(" + doc + ")"; + } + + /** + * @param scriptContent the header script content to test + * @return the HTML page + */ + public static String createTestHTML(final String scriptContent) { + return HtmlPageTest.STANDARDS_MODE_PREFIX_ + + "<html><head><title>foo</title><script>\n" + + scriptContent + + "</script></head><body onload='test()'>\n" + + "</body></html>"; + } + + private MSXMLTestUtil() { + super(); + } +} Property changes on: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLTestUtil.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttributeTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttributeTest.java (rev 0) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttributeTest.java 2013-12-12 18:55:29 UTC (rev 8838) @@ -0,0 +1,481 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.activex.javascript.msxml; + +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. + LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import com.gargoylesoftware.htmlunit.BrowserRunner; +import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; +import com.gargoylesoftware.htmlunit.WebDriverTestCase; + +/** + * Tests for {@link XMLDOMAttribute}. + * + * @version $Revision$ + * @author Marc Guillemot + * @author Ahmed Ashour + * @author Daniel Gredler + * @author Ronald Brill + * @author Frank Danek + */ +@RunWith(BrowserRunner.class) +public class XMLDOMAttributeTest extends WebDriverTestCase { + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("[object Object]") + public void scriptableToString() throws Exception { + tester("alert(Object.prototype.toString.call(att));\n"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("null") + public void attributes() throws Exception { + property("attributes"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("testAttr") + public void baseName() throws Exception { + property("baseName"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts({ "1", "#text", "test", "true", "true" }) + public void childNodes() throws Exception { + final String test = "" + + "alert(att.childNodes.length);\n" + + "alert(att.childNodes.item(0).nodeName);\n" + + "alert(att.childNodes.item(0).text);\n" + + "alert(att.childNodes.item(0).parentNode === att);\n" + + "alert(att.childNodes.item(0).ownerDocument === doc);\n"; + + tester(test); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("0") + public void childNodes_empty() throws Exception { + final String xml = "" + + "<root>" + + "<elem testAttr=''/>" + + "</root>"; + + tester("alert(att.childNodes.length);\n", xml); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("null") + public void dataType() throws Exception { + property("dataType"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("null") + public void definition() throws Exception { + property("definition"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts({ "true", "#text", "test", "true", "true" }) + public void firstChild() throws Exception { + final String test = "" + + "alert(att.firstChild != null);\n" + + "alert(att.firstChild.nodeName);\n" + + "alert(att.firstChild.text);\n" + + "alert(att.firstChild.parentNode === att);\n" + + "alert(att.firstChild.ownerDocument === doc);\n"; + + tester(test); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("false") + public void firstChild_empty() throws Exception { + final String xml = "" + + "<root>" + + "<elem testAttr=''/>" + + "</root>"; + + tester("alert(att.firstChild != null);\n", xml); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts({ "true", "#text", "test", "true", "true" }) + public void lastChild() throws Exception { + final String test = "" + + "alert(att.lastChild != null);\n" + + "alert(att.lastChild.nodeName);\n" + + "alert(att.lastChild.text);\n" + + "alert(att.firstChild.parentNode === att);\n" + + "alert(att.firstChild.ownerDocument === doc);\n"; + + tester(test); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("false") + public void lastChild_empty() throws Exception { + final String xml = "" + + "<root>" + + "<elem testAttr=''/>" + + "</root>"; + + tester("alert(att.lastChild != null);\n", xml); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts({ "testAttr", "exception-write" }) + public void name() throws Exception { + final String test = "" + + "try {\n" + + " alert(att.name);\n" + + "} catch(e) { alert('exception-read'); }\n" + + "try {\n" + + " att.name = 'other';\n" + + "} catch(e) { alert('exception-write'); }\n"; + + tester(test); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("") + public void namespaceURI() throws Exception { + property("namespaceURI"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("testAttr") + public void nodeName() throws Exception { + property("nodeName"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("2") + public void nodeType() throws Exception { + property("nodeType"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts({ "test", "other", "other", "other", "1" }) + public void nodeValue() throws Exception { + final String test = "" + + "try {\n" + + " alert(att.nodeValue);\n" + + "} catch(e) { alert('exception-read'); }\n" + + "try {\n" + + " att.nodeValue = 'other';\n" + + " alert(att.nodeValue);\n" + + " alert(att.text);\n" + + " alert(att.value);\n" + + " alert(att.childNodes.length);\n" + + "} catch(e) { alert('exception-write'); }\n"; + + tester(test); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("true") + public void ownerDocument() throws Exception { + tester("alert(att.ownerDocument === doc);\n"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("true") + public void ownerDocument_created() throws Exception { + final String html = "" + + " function test() {\n" + + " var doc = " + callCreateXMLDOMDocument() + ";\n" + + " var att = doc.createAttribute('something');\n" + + " try {\n" + + " alert(att.ownerDocument === doc);\n" + + " } catch(e) { alert('exception'); }\n" + + " }\n" + + CREATE_XMLDOMDOCUMENT_FUNCTION; + + loadPageWithAlerts2(createTestHTML(html)); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("true") + public void parentNode() throws Exception { + tester("alert(att.parentNode == null);\n"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("") + public void prefix() throws Exception { + property("prefix"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("true") + public void specified() throws Exception { + property("specified"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("false") + public void specified_inDTD() throws Exception { + final String xml = "" + + "<!DOCTYPE root [ " + + "<!ELEMENT root (elem+)> <!ELEMENT elem (#PCDATA)> <!ATTLIST elem testAttr CDATA \"0\">" + + " ]>\n" + + "<root>" + + "<elem/>" + + "</root>"; + + property("specified", xml); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts({ "test", "other", "other", "other", "1" }) + public void text() throws Exception { + final String test = "" + + "try {\n" + + " alert(att.text);\n" + + "} catch(e) { alert('exception-read'); }\n" + + "try {\n" + + " att.text = 'other';\n" + + " alert(att.text);\n" + + " alert(att.nodeValue);\n" + + " alert(att.value);\n" + + " alert(att.childNodes.length);\n" + + "} catch(e) { alert('exception-write'); }\n"; + + tester(test); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts({ "test", "other", "other", "other", "1" }) + public void value() throws Exception { + final String test = "" + + "try {\n" + + " alert(att.value);\n" + + "} catch(e) { alert('exception-read'); }\n" + + "try {\n" + + " att.value = 'other';\n" + + " alert(att.value);\n" + + " alert(att.nodeValue);\n" + + " alert(att.text);\n" + + " alert(att.childNodes.length);\n" + + "} catch(e) { alert('exception-write'); }\n"; + + tester(test); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("testAttr=\"test\"") + public void xml() throws Exception { + property("xml"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("testAttr=\"\"") + public void xml_empty() throws Exception { + final String xml = "" + + "<root>" + + "<elem testAttr=''/>" + + "</root>"; + + property("xml", xml); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("undefined") + public void not_baseURI() throws Exception { + property("baseURI"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("undefined") + public void not_expando() throws Exception { + property("expando"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("undefined") + public void not_localName() throws Exception { + property("localName"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("undefined") + public void not_textContent() throws Exception { + property("textContent"); + } + + private void property(final String property) throws Exception { + tester("alert(att." + property + ");\n"); + } + + private void property(final String property, final String xml) throws Exception { + tester("alert(att." + property + ");\n", xml); + } + + private void tester(final String test) throws Exception { + final String xml = "" + + "<root>" + + "<elem testAttr='test'/>" + + "</root>"; + + tester(test, xml); + } + + private void tester(final String test, final String xml) throws Exception { + final String html = "" + + " function test() {\n" + + " var doc = " + callLoadXMLDOMDocumentFromURL("'" + URL_SECOND + "'") + ";\n" + + " try {\n" + + " var elem = doc.documentElement.firstChild;\n" + + " var att = elem.getAttributeNode('testAttr');\n" + + test + + " } catch(e) { alert('exception'); }\n" + + " }\n" + + LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; + + getMockWebConnection().setResponse(URL_SECOND, xml, "text/xml"); + loadPageWithAlerts2(createTestHTML(html)); + } +} Property changes on: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttributeTest.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASectionTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASectionTest.java (rev 0) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASectionTest.java 2013-12-12 18:55:29 UTC (rev 8838) @@ -0,0 +1,767 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.activex.javascript.msxml; + +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.CREATE_XMLDOMDOCUMENT_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil. + LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callCreateXMLDOMDocument; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.callLoadXMLDOMDocumentFromURL; +import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestUtil.createTestHTML; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import com.gargoylesoftware.htmlunit.BrowserRunner; +import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; +import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; +import com.gargoylesoftware.htmlunit.WebDriverTestCase; + +/** + * Tests for {@link XMLDOMCDATASection}. + * + * @version $Revision$ + * @author Mirko Friedenhagen + * @author Ahmed Ashour + * @author Frank Danek + */ +@RunWith(BrowserRunner.class) +public class XMLDOMCDATASectionTest extends WebDriverTestCase { + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("[object Object]") + public void scriptableToString() throws Exception { + tester("alert(Object.prototype.toString.call(cdata));\n"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("null") + public void attributes() throws Exception { + property("attributes"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("") + public void baseName() throws Exception { + property("baseName"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts("0") + public void childNodes() throws Exception { + tester("alert(cdata.childNodes.length);\n"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Browsers(IE) + @Alerts({ " ", " ", " ", + "exception-setNull", + "", "", "", + "test", "test", "test", + "test\ntest", "test\ntest", "test\ntest", + "<tag/>", "<tag/>", "<tag/>" }) + public void data() throws Exception { + final String test = "" + + "alert(cdata.data);\n" + + "alert(cdata.nodeValue);\n" + + "alert(cdata.text);\n" + // null + + "try {\n" + + " cdata.data = null;\n" + + "} catch(e) { alert('exception-setNull'); }\n" + // empty + + "cdata.data = '';\n" + + "alert(cdata.data);\n" + + "alert(cdata.nodeValue);\n" + + "alert(cdata.text);\n" + // normal + + "cdata.data = 'test';\n" + + "alert(cdata.data);\n" + + "alert(cdata.nodeValue);\n" + + "alert(cdata.text);\n" + // linebreak + + "cdata.data = 'test\\ntest';\n" + + "alert(cdata.data);\n" + + "alert(cdata.nodeValue);\n" + + "alert(cdata.text);\n" + // xml + + "cdata.data = '<tag/>';\n" + + "alert(cdata.data);\n" + + "alert(cdata.nodeValue);\n" + + "alert(cdata... [truncated message content] |
From: <asa...@us...> - 2013-12-13 12:02:42
|
Revision: 8841 http://sourceforge.net/p/htmlunit/code/8841 Author: asashour Date: 2013-12-13 12:02:39 +0000 (Fri, 13 Dec 2013) Log Message: ----------- Trivial javadoc trailing asterisk. Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.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/svg/SVGMatrix.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebTestCase.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLTestUtil.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocumentTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2013-12-12 19:17:25 UTC (rev 8840) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2013-12-13 12:02:39 UTC (rev 8841) @@ -120,7 +120,7 @@ /** * Firefox 17 ESR. * @since 2.12 - **/ + */ public static final BrowserVersion FIREFOX_17 = new BrowserVersion( NETSCAPE, "5.0 (Windows)", "Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0", @@ -129,7 +129,7 @@ /** * Firefox 24 ESR. * @since 2.14 - **/ + */ public static final BrowserVersion FIREFOX_24 = new BrowserVersion( NETSCAPE, "5.0 (Windows)", "Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0", Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-12 19:17:25 UTC (rev 8840) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-13 12:02:39 UTC (rev 8841) @@ -520,13 +520,13 @@ /** * Indicates outer/innerHtml quotes attributes. - **/ + */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) HTMLELEMENT_OUTER_INNER_HTML_QUOTE_ATTRIBUTES, /** * Indicates if a self-closing <iframe/> tag should be considered as an opening tag. - **/ + */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) HTMLIFRAME_IGNORE_SELFCLOSING, 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-12-12 19:17:25 UTC (rev 8840) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2013-12-13 12:02:39 UTC (rev 8841) @@ -1743,7 +1743,7 @@ return 0; } - /** Definition of special cases for the smart DomHtmlAttributeChangeListenerImpl **/ + /** Definition of special cases for the smart DomHtmlAttributeChangeListenerImpl */ private static final Set<String> ATTRIBUTES_AFFECTING_PARENT = new HashSet<String>(Arrays.asList( "style", "class", 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-12-12 19:17:25 UTC (rev 8840) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2013-12-13 12:02:39 UTC (rev 8841) @@ -238,7 +238,7 @@ private static final String Z_INDEX = "z-index"; private static final String ZOOM = "zoom"; - /** The width style attribute. **/ + /** The width style attribute. */ protected static final String WIDTH = "width"; private static final Pattern TO_INT_PATTERN = Pattern.compile("(\\d+).*"); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGMatrix.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGMatrix.java 2013-12-12 19:17:25 UTC (rev 8840) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGMatrix.java 2013-12-13 12:02:39 UTC (rev 8841) @@ -59,7 +59,7 @@ /** * Gets the <code>a</code> entry of the matrix. * @return the field - **/ + */ @JsxGetter public double getA() { return fieldA_; @@ -68,7 +68,7 @@ /** * Gets the <code>b</code> entry of the matrix. * @return the field - **/ + */ @JsxGetter public double getB() { return fieldB_; @@ -77,7 +77,7 @@ /** * Gets the <code>c</code> entry of the matrix. * @return the field - **/ + */ @JsxGetter public double getC() { return fieldC_; @@ -86,7 +86,7 @@ /** * Gets the <code>d</code> entry of the matrix. * @return the field - **/ + */ @JsxGetter public double getD() { return fieldD_; @@ -95,7 +95,7 @@ /** * Gets the <code>e</code> entry of the matrix. * @return the field - **/ + */ @JsxGetter public double getE() { return fieldE_; @@ -104,7 +104,7 @@ /** * Gets the <code>f</code> entry of the matrix. * @return the field - **/ + */ @JsxGetter public double getF() { return fieldF_; @@ -113,7 +113,7 @@ /** * Sets the <code>a</code> entry of the matrix. * @param newValue the new value for the field - **/ + */ @JsxSetter public void setA(final double newValue) { fieldA_ = newValue; @@ -122,7 +122,7 @@ /** * Sets the <code>b</code> entry of the matrix. * @param newValue the new value for the field - **/ + */ @JsxSetter public void setB(final double newValue) { fieldB_ = newValue; @@ -131,7 +131,7 @@ /** * Sets the <code>c</code> entry of the matrix. * @param newValue the new value for the field - **/ + */ @JsxSetter public void setC(final double newValue) { fieldC_ = newValue; @@ -140,7 +140,7 @@ /** * Sets the <code>d</code> entry of the matrix. * @param newValue the new value for the field - **/ + */ @JsxSetter public void setD(final double newValue) { fieldD_ = newValue; @@ -149,7 +149,7 @@ /** * Sets the <code>e</code> entry of the matrix. * @param newValue the new value for the field - **/ + */ @JsxSetter public void setE(final double newValue) { fieldE_ = newValue; @@ -158,7 +158,7 @@ /** * Sets the <code>f</code> entry of the matrix. * @param newValue the new value for the field - **/ + */ @JsxSetter public void setF(final double newValue) { fieldF_ = newValue; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebTestCase.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebTestCase.java 2013-12-12 19:17:25 UTC (rev 8840) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebTestCase.java 2013-12-13 12:02:39 UTC (rev 8841) @@ -107,7 +107,7 @@ /** * Constant for the URL which is used in the tests. * This URL doesn't use the same host name as {@link #URL_FIRST} and {@link #URL_SECOND}. - **/ + */ public static final URL URL_THIRD; /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLTestUtil.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLTestUtil.java 2013-12-12 19:17:25 UTC (rev 8840) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLTestUtil.java 2013-12-13 12:02:39 UTC (rev 8841) @@ -27,7 +27,7 @@ /** Helper. */ public static final String CREATE_XMLDOMDOCUMENT_FUNCTION_NAME = "createXMLDOMDocument"; - /** Helper. **/ + /** Helper. */ public static final String CREATE_XMLDOMDOCUMENT_FUNCTION = "" + " function " + CREATE_XMLDOMDOCUMENT_FUNCTION_NAME + "() {\n" + " return new ActiveXObject('Microsoft.XMLDOM');\n" @@ -36,7 +36,7 @@ /** * Helper. * @return xml helper - **/ + */ public static String callCreateXMLDOMDocument() { return CREATE_XMLDOMDOCUMENT_FUNCTION_NAME + "()"; } @@ -44,7 +44,7 @@ /** Helper. */ public static final String LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION_NAME = "loadXMLDOMDocumentFromString"; - /** Helper. **/ + /** Helper. */ public static final String LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION = "" + " function " + LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION_NAME + "(xml) {\n" + " xmlDoc = new ActiveXObject(\"Microsoft.XMLDOM\");\n" @@ -57,7 +57,7 @@ * Helper. * @param string the parameter * @return xml helper - **/ + */ public static String callLoadXMLDOMDocumentFromString(final String string) { return LOAD_XMLDOMDOCUMENT_FROM_STRING_FUNCTION_NAME + "(" + string + ")"; } @@ -65,7 +65,7 @@ /** Helper. */ public static final String LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION_NAME = "loadXMLDOMDocumentFromURL"; - /** Helper. **/ + /** Helper. */ public static final String LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION = "" + " function " + LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION_NAME + "(url) {\n" + " xmlDoc = new ActiveXObject(\"Microsoft.XMLDOM\");\n" @@ -78,7 +78,7 @@ * Helper. * @param url the parameter * @return xml helper - **/ + */ public static String callLoadXMLDOMDocumentFromURL(final String url) { return LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION_NAME + "(" + url + ")"; } @@ -95,7 +95,7 @@ /** * Helper. * @return xml helper - **/ + */ public static String callCreateXMLHTTPRequest() { return CREATE_XMLHTTPREQUEST_FUNCTION_NAME + "()"; } @@ -103,7 +103,7 @@ /** Helper. */ public static final String LOAD_XMLHTTPREQUEST_FROM_URL_FUNCTION_NAME = "loadXMLHTTPRequestFromURL"; - /** Helper. **/ + /** Helper. */ public static final String LOAD_XMLHTTPREQUEST_FROM_URL_FUNCTION = "" + " function " + LOAD_XMLHTTPREQUEST_FROM_URL_FUNCTION_NAME + "(url) {\n" + " xhr = new ActiveXObject(\"Microsoft.XMLHTTP\");\n" @@ -116,7 +116,7 @@ * Helper. * @param url the parameter * @return xml helper - **/ + */ public static String callLoadXMLHTTPRequestFromURL(final String url) { return LOAD_XMLHTTPREQUEST_FROM_URL_FUNCTION_NAME + "(" + url + ")"; } @@ -124,7 +124,7 @@ /** Helper. */ public static final String SERIALIZE_XMLDOMDOCUMENT_TO_STRING_FUNCTION_NAME = "serializeXMLDOMDocumentToString"; - /** Helper. **/ + /** Helper. */ public static final String SERIALIZE_XMLDOMDOCUMENT_TO_STRING_FUNCTION = "" + " function " + SERIALIZE_XMLDOMDOCUMENT_TO_STRING_FUNCTION_NAME + "(doc) {\n" + " return doc.xml;\n" @@ -134,7 +134,7 @@ * Helper. * @param doc the doc parameter * @return xml helper - **/ + */ public static String callSerializeXMLDOMDocumentToString(final String doc) { return SERIALIZE_XMLDOMDOCUMENT_TO_STRING_FUNCTION_NAME + "(" + doc + ")"; } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocumentTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocumentTest.java 2013-12-12 19:17:25 UTC (rev 8840) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocumentTest.java 2013-12-13 12:02:39 UTC (rev 8841) @@ -42,7 +42,7 @@ private static final String CREATE_XML_DOCUMENT_FUNCTION_NAME = "createXMLDocument"; - /** Helper. **/ + /** Helper. */ public static final String CREATE_XML_DOCUMENT_FUNCTION = "" + " function " + CREATE_XML_DOCUMENT_FUNCTION_NAME + "() {\n" + " if (document.implementation && document.implementation.createDocument) {\n" @@ -52,13 +52,13 @@ + " }\n" + " }\n"; - /** Helper. **/ + /** Helper. */ public static final String CREATE_NATIVE_XML_DOCUMENT_FUNCTION = "" + " function " + CREATE_XML_DOCUMENT_FUNCTION_NAME + "() {\n" + " return document.implementation.createDocument('', '', null);\n" + " }\n"; - /** Helper. **/ + /** Helper. */ public static final String CREATE_ACTIVEX_XML_DOCUMENT_FUNCTION = "" + " function " + CREATE_XML_DOCUMENT_FUNCTION_NAME + "() {\n" + " return new ActiveXObject('Microsoft.XMLDOM');\n" @@ -67,14 +67,14 @@ /** * Helper. * @return xml helper - **/ + */ public static String callCreateXMLDocument() { return CREATE_XML_DOCUMENT_FUNCTION_NAME + "()"; } private static final String LOAD_XML_DOCUMENT_FROM_FILE_FUNCTION_NAME = "loadXMLDocumentFromFile"; - /** Helper. **/ + /** Helper. */ public static final String LOAD_XML_DOCUMENT_FROM_FILE_FUNCTION = "" + " function " + LOAD_XML_DOCUMENT_FROM_FILE_FUNCTION_NAME + "(file) {\n" + " if (window.XMLHttpRequest) {\n" @@ -87,7 +87,7 @@ + " return xhttp.responseXML;\n" + " }\n"; - /** Helper. **/ + /** Helper. */ public static final String LOAD_NATIVE_XML_DOCUMENT_FROM_FILE_FUNCTION = "" + " function " + LOAD_XML_DOCUMENT_FROM_FILE_FUNCTION_NAME + "(file) {\n" + " xhttp = new XMLHttpRequest();\n" @@ -96,7 +96,7 @@ + " return xhttp.responseXML;\n" + " }\n"; - /** Helper. **/ + /** Helper. */ public static final String LOAD_ACTIVEX_XML_DOCUMENT_FROM_FILE_FUNCTION = "" + " function " + LOAD_XML_DOCUMENT_FROM_FILE_FUNCTION_NAME + "(file) {\n" + " xhttp = new ActiveXObject(\"Microsoft.XMLHTTP\");\n" @@ -109,14 +109,14 @@ * Helper. * @param file the file parameter * @return xml helper - **/ + */ public static String callLoadXMLDocumentFromFile(final String file) { return LOAD_XML_DOCUMENT_FROM_FILE_FUNCTION_NAME + "(" + file + ")"; } private static final String LOAD_XML_DOCUMENT_FROM_STRING_FUNCTION_NAME = "loadXMLDocumentFromString"; - /** Helper. **/ + /** Helper. */ public static final String LOAD_XML_DOCUMENT_FROM_STRING_FUNCTION = "" + " function " + LOAD_XML_DOCUMENT_FROM_STRING_FUNCTION_NAME + "(xml) {\n" + " if (window.DOMParser) {\n" @@ -130,14 +130,14 @@ + " }\n" + " }\n"; - /** Helper. **/ + /** Helper. */ public static final String LOAD_NATIVE_XML_DOCUMENT_FROM_STRING_FUNCTION = "" + " function " + LOAD_XML_DOCUMENT_FROM_STRING_FUNCTION_NAME + "(xml) {\n" + " parser = new DOMParser();\n" + " return parser.parseFromString(xml,\"text/xml\");\n" + " }\n"; - /** Helper. **/ + /** Helper. */ public static final String LOAD_ACTIVEX_XML_DOCUMENT_FROM_STRING_FUNCTION = "" + " function " + LOAD_XML_DOCUMENT_FROM_STRING_FUNCTION_NAME + "(xml) {\n" + " xmlDoc = new ActiveXObject(\"Microsoft.XMLDOM\");\n" @@ -150,14 +150,14 @@ * Helper. * @param string the parameter * @return xml helper - **/ + */ public static String callLoadXMLDocumentFromString(final String string) { return LOAD_XML_DOCUMENT_FROM_STRING_FUNCTION_NAME + "(" + string + ")"; } private static final String SERIALIZE_XML_DOCUMENT_TO_STRING_FUNCTION_NAME = "serializeXMLDocumentToString"; - /** Helper. **/ + /** Helper. */ public static final String SERIALIZE_XML_DOCUMENT_TO_STRING_FUNCTION = "" + " function " + SERIALIZE_XML_DOCUMENT_TO_STRING_FUNCTION_NAME + "(doc) {\n" + " if (window.XMLSerializer) {\n" @@ -168,14 +168,14 @@ + " }\n" + " }\n"; - /** Helper. **/ + /** Helper. */ public static final String SERIALIZE_NATIVE_XML_DOCUMENT_TO_STRING_FUNCTION = "" + " function " + SERIALIZE_XML_DOCUMENT_TO_STRING_FUNCTION_NAME + "(doc) {\n" + " serializer = new XMLSerializer();\n" + " return serializer.serializeToString(doc);\n" + " }\n"; - /** Helper. **/ + /** Helper. */ public static final String SERIALIZE_ACTIVEX_XML_DOCUMENT_TO_STRING_FUNCTION = "" + " function " + SERIALIZE_XML_DOCUMENT_TO_STRING_FUNCTION_NAME + "(doc) {\n" + " return doc.xml;" @@ -185,7 +185,7 @@ * Helper. * @param doc the doc parameter * @return xml helper - **/ + */ public static String callSerializeXMLDocumentToString(final String doc) { return SERIALIZE_XML_DOCUMENT_TO_STRING_FUNCTION_NAME + "(" + doc + ")"; } |
From: <asa...@us...> - 2013-12-13 22:52:09
|
Revision: 8845 http://sourceforge.net/p/htmlunit/code/8845 Author: asashour Date: 2013-12-13 22:52:06 +0000 (Fri, 13 Dec 2013) Log Message: ----------- JavaScript: node and window.addEventListener() and .removeEventListener() are supported starting IE 9. - Some other fixes for NodeTest for IE9 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLBaseFontElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NodeTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-12-13 19:13:41 UTC (rev 8844) +++ trunk/htmlunit/src/changes/changes.xml 2013-12-13 22:52:06 UTC (rev 8845) @@ -8,6 +8,9 @@ <body> <release version="2.14" date="???" description="Bugfixes"> + <action type="add" dev="asashour"> + JavaScript: node and window.addEventListener() and .removeEventListener() are supported starting IE 9. + </action> <action type="fix" dev="rbri" due-to="Frank Danek"> JavaScript: XMLDocument.firstChild() is now enabled to support more nodes at the root level like ProcessingInstruction, Comment. Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-13 19:13:41 UTC (rev 8844) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-13 22:52:06 UTC (rev 8845) @@ -270,10 +270,6 @@ /** Was originally .isIE(). */ @BrowserFeature(@WebBrowser(IE)) - GENERATED_121, - - /** Was originally .isIE(). */ - @BrowserFeature(@WebBrowser(IE)) GENERATED_124, /** Was originally .isIE(). */ @@ -658,7 +654,7 @@ /** Indicates that the appendChild call throws no exception * if the provided node cannot be inserted. */ - @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 8)) JS_APPEND_CHILD_THROWS_NO_EXCEPTION_FOR_WRONG_NODE, /** Indicates that the class name of "arguments" object is "Object". */ @@ -972,7 +968,7 @@ JS_GET_ELEMENT_BY_ID_CASE_SENSITIVE, /** Indicates that objects with prototype property available in window scope; Firefox does this. */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 9) }) JS_HAS_OBJECT_WITH_PROTOTYPE_PROPERTY_IN_WINDOW_SCOPE, /** HTMLGenericElement instead of HTMLUnknownElement. */ @@ -1048,12 +1044,16 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_NATIVE_FUNCTION_TOSTRING_NEW_LINE, + /** Should throw exception if extra argument is passed to node.insertBefore(). */ + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 8)) + JS_NODE_INSERT_BEFORE_THROW_EXCEPTION_FOR_EXTRA_ARGUMENT, + /** If <tt>true</tt>, Date.prototype.getYear subtracts 1900 only if 1900 <= date < 2000. */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_NON_ECMA_GET_YEAR, /** "[object]" in quirks mode. */ - @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 8)) JS_OBJECT_IN_QUIRKS_MODE, /** Indicates that someObj.offsetParent throws an exception when called on an object that is not yet attached Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java 2013-12-13 19:13:41 UTC (rev 8844) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java 2013-12-13 22:52:06 UTC (rev 8845) @@ -14,13 +14,13 @@ */ package com.gargoylesoftware.htmlunit.javascript.host; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_121; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_124; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_45; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_APPEND_CHILD_CREATE_DOCUMENT_FRAGMENT_PARENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_APPEND_CHILD_THROWS_NO_EXCEPTION_FOR_WRONG_NODE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_CLONE_NODE_COPIES_EVENT_LISTENERS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_EVENT_HANDLER_AS_PROPERTY_DONT_RECEIVE_EVENT; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_NODE_INSERT_BEFORE_THROW_EXCEPTION_FOR_EXTRA_ARGUMENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_PREFIX_RETURNS_EMPTY_WHEN_UNDEFINED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML_SERIALIZER_APPENDS_CRLF; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; @@ -87,75 +87,75 @@ private EventListenersContainer eventListenersContainer_; /** @see org.w3c.dom.Node#ELEMENT_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short ELEMENT_NODE = org.w3c.dom.Node.ELEMENT_NODE; /** @see org.w3c.dom.Node#ATTRIBUTE_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short ATTRIBUTE_NODE = org.w3c.dom.Node.ATTRIBUTE_NODE; /** @see org.w3c.dom.Node#TEXT_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short TEXT_NODE = org.w3c.dom.Node.TEXT_NODE; /** @see org.w3c.dom.Node#CDATA_SECTION_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short CDATA_SECTION_NODE = org.w3c.dom.Node.CDATA_SECTION_NODE; /** @see org.w3c.dom.Node#ENTITY_REFERENCE_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short ENTITY_REFERENCE_NODE = org.w3c.dom.Node.ENTITY_REFERENCE_NODE; /** @see org.w3c.dom.Node#ENTITY_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short ENTITY_NODE = org.w3c.dom.Node.ENTITY_NODE; /** @see org.w3c.dom.Node#PROCESSING_INSTRUCTION_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short PROCESSING_INSTRUCTION_NODE = org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE; /** @see org.w3c.dom.Node#COMMENT_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short COMMENT_NODE = org.w3c.dom.Node.COMMENT_NODE; /** @see org.w3c.dom.Node#DOCUMENT_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_NODE = org.w3c.dom.Node.DOCUMENT_NODE; /** @see org.w3c.dom.Node#DOCUMENT_TYPE_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_TYPE_NODE = org.w3c.dom.Node.DOCUMENT_TYPE_NODE; /** @see org.w3c.dom.Node#DOCUMENT_FRAGMENT_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_FRAGMENT_NODE = org.w3c.dom.Node.DOCUMENT_FRAGMENT_NODE; /** @see org.w3c.dom.Node#NOTATION_NODE */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short NOTATION_NODE = org.w3c.dom.Node.NOTATION_NODE; /** @see org.w3c.dom.Node#DOCUMENT_POSITION_DISCONNECTED */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_POSITION_DISCONNECTED = org.w3c.dom.Node.DOCUMENT_POSITION_DISCONNECTED; /** @see org.w3c.dom.Node#DOCUMENT_POSITION_PRECEDING */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_POSITION_PRECEDING = org.w3c.dom.Node.DOCUMENT_POSITION_PRECEDING; /** @see org.w3c.dom.Node#DOCUMENT_POSITION_FOLLOWING */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_POSITION_FOLLOWING = org.w3c.dom.Node.DOCUMENT_POSITION_FOLLOWING; /** @see org.w3c.dom.Node#DOCUMENT_POSITION_CONTAINS */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_POSITION_CONTAINS = org.w3c.dom.Node.DOCUMENT_POSITION_CONTAINS; /** @see org.w3c.dom.Node#DOCUMENT_POSITION_CONTAINED_BY */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_POSITION_CONTAINED_BY = org.w3c.dom.Node.DOCUMENT_POSITION_CONTAINED_BY; /** @see org.w3c.dom.Node#DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC */ - @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxConstant({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public static final short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = org.w3c.dom.Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC; @@ -390,9 +390,9 @@ return newChildObject; } final DomNode refChildNode; - // IE accepts non standard calls with only one arg + // IE accepts non standard calls with only one argument if (refChildObject == Undefined.instance) { - if (getBrowserVersion().hasFeature(GENERATED_121)) { + if (getBrowserVersion().hasFeature(JS_NODE_INSERT_BEFORE_THROW_EXCEPTION_FOR_EXTRA_ARGUMENT)) { if (args.length > 1) { throw Context.reportRuntimeError("Invalid argument."); } @@ -446,7 +446,7 @@ * * @return whether this node is the same node as the given one */ - @JsxFunction({ @WebBrowser(value = FF, maxVersion = 3.6f), @WebBrowser(value = IE, minVersion = 11) }) + @JsxFunction(@WebBrowser(value = IE, minVersion = 9)) public boolean isSameNode(final Object other) { return other == this; } @@ -675,7 +675,7 @@ * @see <a href="https://developer.mozilla.org/en-US/docs/DOM/element.addEventListener">Mozilla documentation</a> * @see #attachEvent(String, Function) */ - @JsxFunction({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) + @JsxFunction({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 9) }) public void addEventListener(final String type, final Function listener, final boolean useCapture) { getEventListenersContainer().addEventListener(type, listener, useCapture); } @@ -710,7 +710,7 @@ * @see <a href="https://developer.mozilla.org/en-US/docs/DOM/element.removeEventListener">Mozilla * documentation</a> */ - @JsxFunction({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) + @JsxFunction({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 9) }) public void removeEventListener(final String type, final Function listener, final boolean useCapture) { getEventListenersContainer().removeEventListener(type, listener, useCapture); } @@ -947,7 +947,7 @@ * @see <a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-compareDocumentPosition">DOM level 3</a> * @see org.w3c.dom.Node#compareDocumentPosition(org.w3c.dom.Node) */ - @JsxFunction({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxFunction({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) public short compareDocumentPosition(final Object node) { if (!(node instanceof Node)) { throw Context.reportRuntimeError("Could not convert JavaScript argument arg 0"); 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-12-13 19:13:41 UTC (rev 8844) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2013-12-13 22:52:06 UTC (rev 8845) @@ -1152,7 +1152,7 @@ * @param useCapture If <code>true</code>, indicates that the user wishes to initiate capture (not yet implemented) * @see <a href="https://developer.mozilla.org/en-US/docs/DOM/element.addEventListener">Mozilla documentation</a> */ - @JsxFunction({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) + @JsxFunction({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 9) }) public void addEventListener(final String type, final Function listener, final boolean useCapture) { getEventListenersContainer().addEventListener(type, listener, useCapture); } @@ -1176,7 +1176,7 @@ * @see <a href="https://developer.mozilla.org/en-US/docs/DOM/element.removeEventListener">Mozilla * documentation</a> */ - @JsxFunction({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) + @JsxFunction({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 9) }) public void removeEventListener(final String type, final Function listener, final boolean useCapture) { getEventListenersContainer().removeEventListener(type, listener, useCapture); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLBaseFontElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLBaseFontElement.java 2013-12-13 19:13:41 UTC (rev 8844) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLBaseFontElement.java 2013-12-13 22:52:06 UTC (rev 8845) @@ -15,7 +15,6 @@ package com.gargoylesoftware.htmlunit.javascript.host.html; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLBASEFONT_END_TAG_FORBIDDEN; -import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import net.sourceforge.htmlunit.corejs.javascript.Context; @@ -31,7 +30,7 @@ * @version $Revision$ * @author Ahmed Ashour */ -@JsxClass(domClass = HtmlBaseFont.class, browsers = { @WebBrowser(IE), @WebBrowser(value = FF, maxVersion = 3.6f) }) +@JsxClass(domClass = HtmlBaseFont.class, browsers = @WebBrowser(IE)) public class HTMLBaseFontElement extends HTMLElement { /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NodeTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NodeTest.java 2013-12-13 19:13:41 UTC (rev 8844) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NodeTest.java 2013-12-13 22:52:06 UTC (rev 8845) @@ -18,6 +18,7 @@ import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.FF17; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.FF24; import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE11; +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE9; import org.junit.Test; import org.junit.runner.RunWith; @@ -338,8 +339,9 @@ @Test @Alerts(FF = { "isSameNode not supported" }, IE = { "isSameNode not supported" }, + IE9 = { "true", "false" }, IE11 = { "true", "false" }) - public void testIsSameNode() throws Exception { + public void isSameNode() throws Exception { final String html = "<html><head><title>foo</title><script>\n" + " function test() {\n" + " var d1 = document.getElementById('div1');\n" @@ -628,7 +630,7 @@ * @throws Exception if the test fails */ @Test - @Browsers({ FF, IE11 }) + @Browsers({ FF, IE9, IE11 }) @Alerts({ "0", "20", "20", "4", "10", "10", "2", "20", "exception" }) public void compareDocumentPosition() throws Exception { final String html |
From: <rb...@us...> - 2013-12-15 11:58:54
|
Revision: 8849 http://sourceforge.net/p/htmlunit/code/8849 Author: rbri Date: 2013-12-15 11:58:50 +0000 (Sun, 15 Dec 2013) Log Message: ----------- next try in the fight with or line break handling Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomText.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlOrderedListTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlScriptTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlUnorderedListTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java 2013-12-14 16:05:37 UTC (rev 8848) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java 2013-12-15 11:58:50 UTC (rev 8849) @@ -163,12 +163,15 @@ printOpeningTagContentAsXml(printWriter); if (!hasChildren && !isEmptyXmlTagExpanded()) { - printWriter.println("/>"); + printWriter.print("/>"); + printWriter.print("\r\n"); } else { - printWriter.println(">"); + printWriter.print(">"); + printWriter.print("\r\n"); printChildrenAsXml(indent, printWriter); - printWriter.println(indent + "</" + getTagName() + ">"); + printWriter.print(indent + "</" + getTagName() + ">"); + printWriter.print("\r\n"); } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java 2013-12-14 16:05:37 UTC (rev 8848) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java 2013-12-15 11:58:50 UTC (rev 8849) @@ -784,7 +784,8 @@ final StringWriter stringWriter = new StringWriter(); final PrintWriter printWriter = new PrintWriter(stringWriter); if (charsetName != null && this instanceof HtmlHtml) { - printWriter.println("<?xml version=\"1.0\" encoding=\"" + charsetName + "\"?>"); + printWriter.print("<?xml version=\"1.0\" encoding=\"" + charsetName + "\"?>"); + printWriter.print("\r\n"); } printXml("", printWriter); printWriter.close(); @@ -798,7 +799,9 @@ * @param printWriter writer where child nodes are written */ protected void printXml(final String indent, final PrintWriter printWriter) { - printWriter.println(indent + this); + printWriter.print(indent); + printWriter.print(this); + printWriter.print("\r\n"); printChildrenAsXml(indent, printWriter); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomText.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomText.java 2013-12-14 16:05:37 UTC (rev 8848) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomText.java 2013-12-15 11:58:50 UTC (rev 8849) @@ -133,7 +133,8 @@ if (!(getParentNode() instanceof HtmlStyle) || !data.startsWith("<!--") || !data.endsWith("-->")) { data = StringUtils.escapeXmlChars(data); } - printWriter.println(data); + printWriter.print(data); + printWriter.print("\r\n"); } printChildrenAsXml(indent, printWriter); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java 2013-12-14 16:05:37 UTC (rev 8848) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java 2013-12-15 11:58:50 UTC (rev 8849) @@ -560,12 +560,16 @@ final String data = textNode.getData(); if (data.contains("//<![CDATA[")) { - printWriter.println(data); + printWriter.print(data); + printWriter.print("\r\n"); } else { - printWriter.println("//<![CDATA["); - printWriter.println(data); - printWriter.println("//]]>"); + printWriter.print("//<![CDATA["); + printWriter.print("\r\n"); + printWriter.print(data); + printWriter.print("\r\n"); + printWriter.print("//]]>"); + printWriter.print("\r\n"); } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlElementTest.java 2013-12-14 16:05:37 UTC (rev 8848) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlElementTest.java 2013-12-15 11:58:50 UTC (rev 8849) @@ -1239,14 +1239,12 @@ final HtmlPage page = loadPage(html); - final String htmlDiv1XML = "<div id=\"div1\" onclick=\"alert('hello')\">" + LINE_SEPARATOR - + " click me" + LINE_SEPARATOR - + "</div>" + LINE_SEPARATOR; + final String htmlDiv1XML = "<div id=\"div1\" onclick=\"alert('hello')\">\r\n click me" + + "\r\n</div>\r\n"; assertEquals(htmlDiv1XML, page.getElementById("div1").asXml()); - final String htmlDiv2XML = "<div id=\"div2\" onclick=\"alert("hello again")\">" + LINE_SEPARATOR - + " click me again" + LINE_SEPARATOR - + "</div>" + LINE_SEPARATOR; + final String htmlDiv2XML = "<div id=\"div2\" onclick=\"alert("hello again")\">\r\n click me again" + + "\r\n</div>\r\n"; assertEquals(htmlDiv2XML, page.getElementById("div2").asXml()); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlOrderedListTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlOrderedListTest.java 2013-12-14 16:05:37 UTC (rev 8848) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlOrderedListTest.java 2013-12-15 11:58:50 UTC (rev 8849) @@ -87,7 +87,7 @@ final HtmlPage page = loadPage(content); final HtmlElement element = page.getHtmlElementById("myNode"); - assertEquals("<ol id=\"myNode\">" + LINE_SEPARATOR + "</ol>" + LINE_SEPARATOR, element.asXml()); + assertEquals("<ol id=\"myNode\">\r\n</ol>\r\n", element.asXml()); assertTrue(page.asXml().contains("</ol>")); } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlScriptTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlScriptTest.java 2013-12-14 16:05:37 UTC (rev 8848) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlScriptTest.java 2013-12-15 11:58:50 UTC (rev 8849) @@ -141,7 +141,7 @@ final String html = "<html><body><script id='s'>" + script + "</script></body></html>"; final HtmlPage page = loadPage(html); final HtmlScript scriptElement = page.getHtmlElementById("s"); - assertEquals("<script id=\"s\">" + LINE_SEPARATOR + script + LINE_SEPARATOR + "</script>" + LINE_SEPARATOR, + assertEquals("<script id=\"s\">\r\n" + script + "\r\n</script>\r\n", scriptElement.asXml()); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlUnorderedListTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlUnorderedListTest.java 2013-12-14 16:05:37 UTC (rev 8848) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlUnorderedListTest.java 2013-12-15 11:58:50 UTC (rev 8849) @@ -70,7 +70,7 @@ final HtmlPage page = loadPage(content); final HtmlElement element = page.getHtmlElementById("myNode"); - assertEquals("<ul id=\"myNode\">" + LINE_SEPARATOR + "</ul>" + LINE_SEPARATOR, element.asXml()); + assertEquals("<ul id=\"myNode\">\r\n</ul>\r\n", element.asXml()); assertTrue(page.asXml().contains("</ul>")); } } |
From: <asa...@us...> - 2013-12-18 09:48:03
|
Revision: 8869 http://sourceforge.net/p/htmlunit/code/8869 Author: asashour Date: 2013-12-18 09:48:00 +0000 (Wed, 18 Dec 2013) Log Message: ----------- JavaScript: fix parseInt() when the value has a leading 0. Issue 1563 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/GlobalFunctionsTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-12-18 09:32:11 UTC (rev 8868) +++ trunk/htmlunit/src/changes/changes.xml 2013-12-18 09:48:00 UTC (rev 8869) @@ -8,6 +8,9 @@ <body> <release version="2.14" date="???" description="Bugfixes"> + <action type="fix" dev="asashour" issue="1563"> + JavaScript: fix parseInt() when the value has a leading 0. + </action> <action type="add" dev="asashour" issue="1536"> JavaScript: node and window.addEventListener() and .removeEventListener() are supported starting IE 9. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-18 09:32:11 UTC (rev 8868) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-18 09:48:00 UTC (rev 8869) @@ -1070,6 +1070,11 @@ @BrowserFeature(@WebBrowser(IE)) JS_PARENT_PROTO_PROPERTIES, + /** Indicates that parseInt() should have radix 10 by default. */ + @BrowserFeature({ @WebBrowser(value = IE, minVersion = 11), @WebBrowser(value = FF, minVersion = 24), + @WebBrowser(CHROME)}) + JS_PARSE_INT_RADIX_10, + /** Indicates that HTMLPhraseElements returning 'HTMLElement' * as class name. */ @BrowserFeature(@WebBrowser(FF)) Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java 2013-12-18 09:32:11 UTC (rev 8868) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java 2013-12-18 09:48:00 UTC (rev 8869) @@ -341,6 +341,8 @@ return browserVersion_.hasFeature(BrowserVersionFeatures.JS_FUNCTION_OBJECT_METHOD); case Context.FEATURE_HTMLUNIT_FUNCTION_DECLARED_FORWARD_IN_BLOCK: return browserVersion_.hasFeature(BrowserVersionFeatures.JS_FUNCTION_DECLARED_FORWARD_IN_BLOCK); + case Context.FEATURE_HTMLUNIT_PARSE_INT_RADIX_10: + return browserVersion_.hasFeature(BrowserVersionFeatures.JS_PARSE_INT_RADIX_10); default: return super.hasFeature(cx, featureIndex); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/GlobalFunctionsTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/GlobalFunctionsTest.java 2013-12-18 09:32:11 UTC (rev 8868) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/GlobalFunctionsTest.java 2013-12-18 09:48:00 UTC (rev 8869) @@ -19,7 +19,6 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; -import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** @@ -65,7 +64,6 @@ CHROME = { "0", "1", "-2345", "1", "12", "NaN", "0", "1", "8", "9", "100", "0", "1", "8", "9", "100" }, FF24 = { "0", "1", "-2345", "1", "12", "NaN", "0", "1", "8", "9", "100", "0", "1", "8", "9", "100" }, IE11 = { "0", "1", "-2345", "1", "12", "NaN", "0", "1", "8", "9", "100", "0", "1", "8", "9", "100" }) - @NotYetImplemented public void parseInt() throws Exception { final String html = "<html><head><title>foo</title><script>\n" |
From: <rb...@us...> - 2013-12-18 19:59:28
|
Revision: 8871 http://sourceforge.net/p/htmlunit/code/8871 Author: rbri Date: 2013-12-18 19:59:25 +0000 (Wed, 18 Dec 2013) Log Message: ----------- and again fixes for our javascript objects Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLElementsTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArticle.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAside.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigure.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFooter.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeader.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMark.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNav.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSection.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-18 12:08:40 UTC (rev 8870) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-18 19:59:25 UTC (rev 8871) @@ -54,7 +54,8 @@ * You can generate your own test cases by looking into TestSource.generateTestForHtmlElements */ static final List<String> SUPPORTED_TAGS_ = Arrays.asList(HtmlAbbreviated.TAG_NAME, HtmlAcronym.TAG_NAME, - HtmlAnchor.TAG_NAME, HtmlAddress.TAG_NAME, HtmlApplet.TAG_NAME, HtmlArea.TAG_NAME, HtmlAudio.TAG_NAME, + HtmlAnchor.TAG_NAME, HtmlAddress.TAG_NAME, HtmlApplet.TAG_NAME, HtmlArea.TAG_NAME, + HtmlArticle.TAG_NAME, HtmlAside.TAG_NAME, HtmlAudio.TAG_NAME, HtmlBackgroundSound.TAG_NAME, HtmlBase.TAG_NAME, HtmlBaseFont.TAG_NAME, HtmlBidirectionalOverride.TAG_NAME, HtmlBig.TAG_NAME, HtmlBlink.TAG_NAME, HtmlBlockQuote.TAG_NAME, HtmlBody.TAG_NAME, HtmlBold.TAG_NAME, @@ -65,19 +66,21 @@ HtmlDeletedText.TAG_NAME, HtmlDirectory.TAG_NAME, HtmlDivision.TAG_NAME, HtmlDefinitionList.TAG_NAME, HtmlDefinitionTerm.TAG_NAME, HtmlEmbed.TAG_NAME, - HtmlEmphasis.TAG_NAME, HtmlFieldSet.TAG_NAME, - HtmlFont.TAG_NAME, HtmlForm.TAG_NAME, - HtmlFrame.TAG_NAME, HtmlFrameSet.TAG_NAME, HtmlHeading1.TAG_NAME, - HtmlHeading2.TAG_NAME, HtmlHeading3.TAG_NAME, - HtmlHeading4.TAG_NAME, HtmlHeading5.TAG_NAME, - HtmlHeading6.TAG_NAME, HtmlHead.TAG_NAME, + HtmlEmphasis.TAG_NAME, + HtmlFieldSet.TAG_NAME, HtmlFigure.TAG_NAME, + HtmlFont.TAG_NAME, HtmlForm.TAG_NAME, HtmlFooter.TAG_NAME, + HtmlFrame.TAG_NAME, HtmlFrameSet.TAG_NAME, + HtmlHead.TAG_NAME, HtmlHeader.TAG_NAME, + HtmlHeading1.TAG_NAME, HtmlHeading2.TAG_NAME, HtmlHeading3.TAG_NAME, + HtmlHeading4.TAG_NAME, HtmlHeading5.TAG_NAME, HtmlHeading6.TAG_NAME, HtmlHorizontalRule.TAG_NAME, HtmlHtml.TAG_NAME, HtmlInlineFrame.TAG_NAME, HtmlInlineQuotation.TAG_NAME, HtmlImage.TAG_NAME, HtmlImage.TAG_NAME2, HtmlInsertedText.TAG_NAME, HtmlIsIndex.TAG_NAME, HtmlItalic.TAG_NAME, HtmlKeyboard.TAG_NAME, HtmlLabel.TAG_NAME, HtmlLegend.TAG_NAME, HtmlListing.TAG_NAME, HtmlListItem.TAG_NAME, - HtmlLink.TAG_NAME, HtmlMap.TAG_NAME, HtmlMarquee.TAG_NAME, + HtmlLink.TAG_NAME, HtmlMap.TAG_NAME, HtmlMark.TAG_NAME, HtmlMarquee.TAG_NAME, HtmlMenu.TAG_NAME, HtmlMeta.TAG_NAME, HtmlMeter.TAG_NAME, HtmlMultiColumn.TAG_NAME, + HtmlNav.TAG_NAME, HtmlNoBreak.TAG_NAME, HtmlNoEmbed.TAG_NAME, HtmlNoFrames.TAG_NAME, HtmlNoScript.TAG_NAME, HtmlObject.TAG_NAME, HtmlOrderedList.TAG_NAME, HtmlOptionGroup.TAG_NAME, HtmlOption.TAG_NAME, HtmlParagraph.TAG_NAME, @@ -85,7 +88,7 @@ HtmlProgress.TAG_NAME, HtmlRp.TAG_NAME, HtmlRt.TAG_NAME, HtmlRuby.TAG_NAME, HtmlS.TAG_NAME, HtmlSample.TAG_NAME, - HtmlScript.TAG_NAME, HtmlSelect.TAG_NAME, HtmlSmall.TAG_NAME, + HtmlScript.TAG_NAME, HtmlSection.TAG_NAME, HtmlSelect.TAG_NAME, HtmlSmall.TAG_NAME, HtmlSource.TAG_NAME, HtmlSpacer.TAG_NAME, HtmlSpan.TAG_NAME, HtmlStrike.TAG_NAME, HtmlStrong.TAG_NAME, HtmlStyle.TAG_NAME, HtmlSubscript.TAG_NAME, HtmlSuperscript.TAG_NAME, @@ -172,6 +175,22 @@ else if (tagName.equals(HtmlArea.TAG_NAME)) { element = new HtmlArea(namespaceURI, qualifiedName, page, attributeMap); } + else if (tagName.equals(HtmlArticle.TAG_NAME)) { + if (page.getWebClient().getBrowserVersion().hasFeature(HTML5_TAGS)) { + element = new HtmlArticle(namespaceURI, qualifiedName, page, attributeMap); + } + else { + return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes); + } + } + else if (tagName.equals(HtmlAside.TAG_NAME)) { + if (page.getWebClient().getBrowserVersion().hasFeature(HTML5_TAGS)) { + element = new HtmlAside(namespaceURI, qualifiedName, page, attributeMap); + } + else { + return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes); + } + } else if (tagName.equals(HtmlAudio.TAG_NAME)) { if (page.getWebClient().getBrowserVersion().hasFeature(HTML5_TAGS)) { element = new HtmlAudio(namespaceURI, qualifiedName, page, attributeMap); @@ -273,12 +292,28 @@ else if (tagName.equals(HtmlFieldSet.TAG_NAME)) { element = new HtmlFieldSet(namespaceURI, qualifiedName, page, attributeMap); } + else if (tagName.equals(HtmlFigure.TAG_NAME)) { + if (page.getWebClient().getBrowserVersion().hasFeature(HTML5_TAGS)) { + element = new HtmlFigure(namespaceURI, qualifiedName, page, attributeMap); + } + else { + return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes); + } + } else if (tagName.equals(HtmlFont.TAG_NAME)) { element = new HtmlFont(namespaceURI, qualifiedName, page, attributeMap); } else if (tagName.equals(HtmlForm.TAG_NAME)) { element = new HtmlForm(namespaceURI, qualifiedName, page, attributeMap); } + else if (tagName.equals(HtmlFooter.TAG_NAME)) { + if (page.getWebClient().getBrowserVersion().hasFeature(HTML5_TAGS)) { + element = new HtmlFooter(namespaceURI, qualifiedName, page, attributeMap); + } + else { + return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes); + } + } else if (tagName.equals(HtmlFrame.TAG_NAME)) { if (attributeMap != null) { final DomAttr srcAttribute = attributeMap.get("src"); @@ -294,6 +329,14 @@ else if (tagName.equals(HtmlHead.TAG_NAME)) { element = new HtmlHead(namespaceURI, qualifiedName, page, attributeMap); } + else if (tagName.equals(HtmlHeader.TAG_NAME)) { + if (page.getWebClient().getBrowserVersion().hasFeature(HTML5_TAGS)) { + element = new HtmlHeader(namespaceURI, qualifiedName, page, attributeMap); + } + else { + return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes); + } + } else if (tagName.equals(HtmlHeading1.TAG_NAME)) { element = new HtmlHeading1(namespaceURI, qualifiedName, page, attributeMap); } @@ -363,6 +406,14 @@ else if (tagName.equals(HtmlMap.TAG_NAME)) { element = new HtmlMap(namespaceURI, qualifiedName, page, attributeMap); } + else if (tagName.equals(HtmlMark.TAG_NAME)) { + if (page.getWebClient().getBrowserVersion().hasFeature(HTML5_TAGS)) { + element = new HtmlMark(namespaceURI, qualifiedName, page, attributeMap); + } + else { + return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes); + } + } else if (tagName.equals(HtmlMarquee.TAG_NAME)) { element = new HtmlMarquee(namespaceURI, qualifiedName, page, attributeMap); } @@ -383,6 +434,14 @@ else if (tagName.equals(HtmlMultiColumn.TAG_NAME)) { element = new HtmlMultiColumn(namespaceURI, qualifiedName, page, attributeMap); } + else if (tagName.equals(HtmlNav.TAG_NAME)) { + if (page.getWebClient().getBrowserVersion().hasFeature(HTML5_TAGS)) { + element = new HtmlNav(namespaceURI, qualifiedName, page, attributeMap); + } + else { + return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes); + } + } else if (tagName.equals(HtmlNoBreak.TAG_NAME)) { element = new HtmlNoBreak(namespaceURI, qualifiedName, page, attributeMap); } @@ -455,6 +514,14 @@ else if (tagName.equals(HtmlScript.TAG_NAME)) { element = new HtmlScript(namespaceURI, qualifiedName, page, attributeMap); } + else if (tagName.equals(HtmlSection.TAG_NAME)) { + if (page.getWebClient().getBrowserVersion().hasFeature(HTML5_TAGS)) { + element = new HtmlSection(namespaceURI, qualifiedName, page, attributeMap); + } + else { + return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes); + } + } else if (tagName.equals(HtmlSelect.TAG_NAME)) { element = new HtmlSelect(namespaceURI, qualifiedName, page, attributeMap); } Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArticle.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArticle.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArticle.java 2013-12-18 19:59:25 UTC (rev 8871) @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.html; + +import java.util.Map; + +import com.gargoylesoftware.htmlunit.SgmlPage; + +/** + * Wrapper for the HTML element "article". + * + * @version $Revision$ + * @author Ronald Brill + */ +public class HtmlArticle extends HtmlElement { + + /** The HTML tag represented by this element. */ + public static final String TAG_NAME = "article"; + + /** + * Creates a new instance. + * + * @param namespaceURI the URI that identifies an XML namespace + * @param qualifiedName the qualified name of the element type to instantiate + * @param page the page that contains this element + * @param attributes the initial attributes + */ + HtmlArticle(final String namespaceURI, final String qualifiedName, final SgmlPage page, + final Map<String, DomAttr> attributes) { + super(namespaceURI, qualifiedName, page, attributes); + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArticle.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAside.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAside.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAside.java 2013-12-18 19:59:25 UTC (rev 8871) @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.html; + +import java.util.Map; + +import com.gargoylesoftware.htmlunit.SgmlPage; + +/** + * Wrapper for the HTML element "aside". + * + * @version $Revision$ + * @author Ronald Brill + */ +public class HtmlAside extends HtmlElement { + + /** The HTML tag represented by this element. */ + public static final String TAG_NAME = "aside"; + + /** + * Creates a new instance. + * + * @param namespaceURI the URI that identifies an XML namespace + * @param qualifiedName the qualified name of the element type to instantiate + * @param page the page that contains this element + * @param attributes the initial attributes + */ + HtmlAside(final String namespaceURI, final String qualifiedName, final SgmlPage page, + final Map<String, DomAttr> attributes) { + super(namespaceURI, qualifiedName, page, attributes); + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAside.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigure.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigure.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigure.java 2013-12-18 19:59:25 UTC (rev 8871) @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.html; + +import java.util.Map; + +import com.gargoylesoftware.htmlunit.SgmlPage; + +/** + * Wrapper for the HTML element "figure". + * + * @version $Revision$ + * @author Ronald Brill + */ +public class HtmlFigure extends HtmlElement { + + /** The HTML tag represented by this element. */ + public static final String TAG_NAME = "figure"; + + /** + * Creates a new instance. + * + * @param namespaceURI the URI that identifies an XML namespace + * @param qualifiedName the qualified name of the element type to instantiate + * @param page the page that contains this element + * @param attributes the initial attributes + */ + HtmlFigure(final String namespaceURI, final String qualifiedName, final SgmlPage page, + final Map<String, DomAttr> attributes) { + super(namespaceURI, qualifiedName, page, attributes); + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigure.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFooter.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFooter.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFooter.java 2013-12-18 19:59:25 UTC (rev 8871) @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.html; + +import java.util.Map; + +import com.gargoylesoftware.htmlunit.SgmlPage; + +/** + * Wrapper for the HTML element "footer". + * + * @version $Revision$ + * @author Ronald Brill + */ +public class HtmlFooter extends HtmlElement { + + /** The HTML tag represented by this element. */ + public static final String TAG_NAME = "footer"; + + /** + * Creates a new instance. + * + * @param namespaceURI the URI that identifies an XML namespace + * @param qualifiedName the qualified name of the element type to instantiate + * @param page the page that contains this element + * @param attributes the initial attributes + */ + HtmlFooter(final String namespaceURI, final String qualifiedName, final SgmlPage page, + final Map<String, DomAttr> attributes) { + super(namespaceURI, qualifiedName, page, attributes); + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFooter.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeader.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeader.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeader.java 2013-12-18 19:59:25 UTC (rev 8871) @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.html; + +import java.util.Map; + +import com.gargoylesoftware.htmlunit.SgmlPage; + +/** + * Wrapper for the HTML element "header". + * + * @version $Revision$ + * @author Ronald Brill + */ +public class HtmlHeader extends HtmlElement { + + /** The HTML tag represented by this element. */ + public static final String TAG_NAME = "header"; + + /** + * Creates a new instance. + * + * @param namespaceURI the URI that identifies an XML namespace + * @param qualifiedName the qualified name of the element type to instantiate + * @param page the page that contains this element + * @param attributes the initial attributes + */ + HtmlHeader(final String namespaceURI, final String qualifiedName, final SgmlPage page, + final Map<String, DomAttr> attributes) { + super(namespaceURI, qualifiedName, page, attributes); + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeader.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMark.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMark.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMark.java 2013-12-18 19:59:25 UTC (rev 8871) @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.html; + +import java.util.Map; + +import com.gargoylesoftware.htmlunit.SgmlPage; + +/** + * Wrapper for the HTML element "mark". + * + * @version $Revision$ + * @author Ronald Brill + */ +public class HtmlMark extends HtmlElement { + + /** The HTML tag represented by this element. */ + public static final String TAG_NAME = "mark"; + + /** + * Creates a new instance. + * + * @param namespaceURI the URI that identifies an XML namespace + * @param qualifiedName the qualified name of the element type to instantiate + * @param page the page that contains this element + * @param attributes the initial attributes + */ + HtmlMark(final String namespaceURI, final String qualifiedName, final SgmlPage page, + final Map<String, DomAttr> attributes) { + super(namespaceURI, qualifiedName, page, attributes); + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMark.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNav.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNav.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNav.java 2013-12-18 19:59:25 UTC (rev 8871) @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.html; + +import java.util.Map; + +import com.gargoylesoftware.htmlunit.SgmlPage; + +/** + * Wrapper for the HTML element "nav". + * + * @version $Revision$ + * @author Ronald Brill + */ +public class HtmlNav extends HtmlElement { + + /** The HTML tag represented by this element. */ + public static final String TAG_NAME = "nav"; + + /** + * Creates a new instance. + * + * @param namespaceURI the URI that identifies an XML namespace + * @param qualifiedName the qualified name of the element type to instantiate + * @param page the page that contains this element + * @param attributes the initial attributes + */ + HtmlNav(final String namespaceURI, final String qualifiedName, final SgmlPage page, + final Map<String, DomAttr> attributes) { + super(namespaceURI, qualifiedName, page, attributes); + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNav.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSection.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSection.java 2013-12-18 19:59:25 UTC (rev 8871) @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.html; + +import java.util.Map; + +import com.gargoylesoftware.htmlunit.SgmlPage; + +/** + * Wrapper for the HTML element "section". + * + * @version $Revision$ + * @author Ronald Brill + */ +public class HtmlSection extends HtmlElement { + + /** The HTML tag represented by this element. */ + public static final String TAG_NAME = "section"; + + /** + * Creates a new instance. + * + * @param namespaceURI the URI that identifies an XML namespace + * @param qualifiedName the qualified name of the element type to instantiate + * @param page the page that contains this element + * @param attributes the initial attributes + */ + HtmlSection(final String namespaceURI, final String qualifiedName, final SgmlPage page, + final Map<String, DomAttr> attributes) { + super(namespaceURI, qualifiedName, page, attributes); + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSection.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property 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-12-18 12:08:40 UTC (rev 8870) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-12-18 19:59:25 UTC (rev 8871) @@ -91,15 +91,23 @@ import com.gargoylesoftware.htmlunit.html.HTMLParser; import com.gargoylesoftware.htmlunit.html.HtmlAnchor; import com.gargoylesoftware.htmlunit.html.HtmlArea; +import com.gargoylesoftware.htmlunit.html.HtmlArticle; +import com.gargoylesoftware.htmlunit.html.HtmlAside; import com.gargoylesoftware.htmlunit.html.HtmlBody; import com.gargoylesoftware.htmlunit.html.HtmlDivision; import com.gargoylesoftware.htmlunit.html.HtmlElement; +import com.gargoylesoftware.htmlunit.html.HtmlFigure; +import com.gargoylesoftware.htmlunit.html.HtmlFooter; import com.gargoylesoftware.htmlunit.html.HtmlFrameSet; +import com.gargoylesoftware.htmlunit.html.HtmlHeader; +import com.gargoylesoftware.htmlunit.html.HtmlMark; +import com.gargoylesoftware.htmlunit.html.HtmlNav; import com.gargoylesoftware.htmlunit.html.HtmlNoBreak; import com.gargoylesoftware.htmlunit.html.HtmlNoEmbed; import com.gargoylesoftware.htmlunit.html.HtmlNoFrames; import com.gargoylesoftware.htmlunit.html.HtmlNoScript; import com.gargoylesoftware.htmlunit.html.HtmlPage; +import com.gargoylesoftware.htmlunit.html.HtmlSection; import com.gargoylesoftware.htmlunit.html.HtmlTable; import com.gargoylesoftware.htmlunit.html.HtmlTableDataCell; import com.gargoylesoftware.htmlunit.html.HtmlWordBreak; @@ -153,11 +161,19 @@ * @author Frank Danek */ @JsxClasses({ + @JsxClass(domClass = HtmlArticle.class), + @JsxClass(domClass = HtmlAside.class), @JsxClass(domClass = HtmlElement.class), + @JsxClass(domClass = HtmlFigure.class), + @JsxClass(domClass = HtmlFooter.class), + @JsxClass(domClass = HtmlHeader.class), + @JsxClass(domClass = HtmlMark.class), + @JsxClass(domClass = HtmlNav.class), @JsxClass(domClass = HtmlNoBreak.class, browsers = { @WebBrowser(FF) }), @JsxClass(domClass = HtmlNoEmbed.class, browsers = { @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }), @JsxClass(domClass = HtmlNoFrames.class, browsers = { @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }), @JsxClass(domClass = HtmlNoScript.class, browsers = { @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }), + @JsxClass(domClass = HtmlSection.class), @JsxClass(domClass = HtmlWordBreak.class, browsers = { @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 9) }) }) public class HTMLElement extends Element implements ScriptableWithFallbackGetter { @@ -2911,7 +2927,7 @@ } return "inline"; } - if ("WBR".equals(tagName)) { + if ("WBR".equals(tagName) || "MARK".equals(tagName)) { return "inline"; } return super.getDefaultStyleDisplay(); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLElementsTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLElementsTest.java 2013-12-18 12:08:40 UTC (rev 8870) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLElementsTest.java 2013-12-18 19:59:25 UTC (rev 8871) @@ -113,6 +113,28 @@ @Alerts(DEFAULT = "1", IE8 = "0") @NotYetImplemented(IE8) + public void elementClosesItself_article() throws Exception { + loadPageWithAlerts2(elementClosesItself("article")); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = "1", + IE8 = "0") + @NotYetImplemented(IE8) + public void elementClosesItself_aside() throws Exception { + loadPageWithAlerts2(elementClosesItself("aside")); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = "1", + IE8 = "0") + @NotYetImplemented(IE8) public void elementClosesItself_audio() throws Exception { loadPageWithAlerts2(elementClosesItself("audio")); } @@ -272,7 +294,9 @@ * @throws Exception if the test fails */ @Test - @Alerts("1") + @Alerts(DEFAULT = "1", + IE8 = "0") + @NotYetImplemented(IE8) public void elementClosesItself_datalist() throws Exception { loadPageWithAlerts2(elementClosesItself("datalist")); } @@ -372,6 +396,17 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = "1", + IE8 = "0") + @NotYetImplemented(IE8) + public void elementClosesItself_figure() throws Exception { + loadPageWithAlerts2(elementClosesItself("figure")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts("1") public void elementClosesItself_font() throws Exception { loadPageWithAlerts2(elementClosesItself("font")); @@ -381,6 +416,17 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = "1", + IE8 = "0") + @NotYetImplemented(IE8) + public void elementClosesItself_footer() throws Exception { + loadPageWithAlerts2(elementClosesItself("footer")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts("1") @NotYetImplemented(IE8) public void elementClosesItself_form() throws Exception { @@ -488,6 +534,17 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = "1", + IE8 = "0") + @NotYetImplemented(IE8) + public void elementClosesItself_header() throws Exception { + loadPageWithAlerts2(elementClosesItself("header")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts("0") public void elementClosesItself_hr() throws Exception { loadPageWithAlerts2(elementClosesItself("hr")); @@ -649,6 +706,17 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = "1", + IE8 = "0") + @NotYetImplemented(IE8) + public void elementClosesItself_mark() throws Exception { + loadPageWithAlerts2(elementClosesItself("mark")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts("1") public void elementClosesItself_menu() throws Exception { loadPageWithAlerts2(elementClosesItself("menu")); @@ -667,7 +735,9 @@ * @throws Exception if the test fails */ @Test - @Alerts("1") + @Alerts(DEFAULT = "1", + IE8 = "0") + @NotYetImplemented(IE8) public void elementClosesItself_meter() throws Exception { loadPageWithAlerts2(elementClosesItself("meter")); } @@ -700,6 +770,17 @@ @Alerts(DEFAULT = "1", IE8 = "0") @NotYetImplemented(IE8) + public void elementClosesItself_nav() throws Exception { + loadPageWithAlerts2(elementClosesItself("nav")); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = "1", + IE8 = "0") + @NotYetImplemented(IE8) public void elementClosesItself_noembed() throws Exception { loadPageWithAlerts2(elementClosesItself("noembed")); } @@ -730,7 +811,7 @@ */ @Test @Alerts(DEFAULT = "1", - IE8 = "0") + IE8 = "null") @NotYetImplemented(IE8) public void elementClosesItself_object() throws Exception { loadPageWithAlerts2(elementClosesItself("object")); @@ -879,6 +960,17 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = "1", + IE8 = "0") + @NotYetImplemented(IE8) + public void elementClosesItself_section() throws Exception { + loadPageWithAlerts2(elementClosesItself("section")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts("0") public void elementClosesItself_select() throws Exception { loadPageWithAlerts2(elementClosesItself("select")); @@ -956,7 +1048,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("1") + @Alerts(DEFAULT = "1") public void elementClosesItself_sub() throws Exception { loadPageWithAlerts2(elementClosesItself("sub")); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java 2013-12-18 12:08:40 UTC (rev 8870) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java 2013-12-18 19:59:25 UTC (rev 8871) @@ -373,6 +373,28 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = { "1", "0", "1", "1", "0", "1" }, + IE8 = { "2", "2", "2", "4", "4", "3" }) + @NotYetImplemented + public void childNodes_article() throws Exception { + loadPageWithAlerts2(createHtmlForChildNodes("article")); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = { "1", "0", "1", "1", "0", "1" }, + IE8 = { "2", "2", "2", "4", "4", "3" }) + @NotYetImplemented + public void childNodes_aside() throws Exception { + loadPageWithAlerts2(createHtmlForChildNodes("aside")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = { "3", "2", "2", "3", "2", "2" }, IE8 = { "2", "2", "2", "4", "4", "3" }) @NotYetImplemented(IE8) @@ -663,6 +685,17 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = { "1", "0", "1", "1", "0", "1" }, + IE8 = { "2", "2", "2", "4", "4", "3" }) + @NotYetImplemented + public void childNodes_figure() throws Exception { + loadPageWithAlerts2(createHtmlForChildNodes("figure")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = { "3", "2", "2", "3", "2", "2" }, IE8 = { "1", "1", "1", "2", "2", "1" }) public void childNodes_font() throws Exception { @@ -684,6 +717,17 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = { "1", "0", "1", "1", "0", "1" }, + IE8 = { "2", "2", "2", "4", "4", "3" }) + @NotYetImplemented + public void childNodes_footer() throws Exception { + loadPageWithAlerts2(createHtmlForChildNodes("footer")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = { "1", "1", "1", "1", "1", "1" }, IE8 = { "2", "2", "2", "4", "4", "3" }) @NotYetImplemented @@ -777,6 +821,17 @@ */ @Test @Alerts(DEFAULT = { "1", "0", "1", "1", "0", "1" }, + IE8 = { "2", "2", "2", "4", "4", "3" }) + @NotYetImplemented + public void childNodes_header() throws Exception { + loadPageWithAlerts2(createHtmlForChildNodes("header")); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = { "1", "0", "1", "1", "0", "1" }, IE8 = { "0", "0", "0", "0", "0", "0" }) public void childNodes_hr() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("hr")); @@ -941,6 +996,17 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = { "3", "2", "2", "3", "2", "2" }, + IE8 = { "2", "2", "2", "4", "4", "3" }) + @NotYetImplemented(IE8) + public void childNodes_mark() throws Exception { + loadPageWithAlerts2(createHtmlForChildNodes("mark")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = { "1", "0", "1", "1", "0", "1" }, IE8 = { "0", "0", "0", "0", "0", "0" }) public void childNodes_menu() throws Exception { @@ -984,6 +1050,17 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = { "1", "0", "1", "1", "0", "1" }, + IE8 = { "2", "2", "2", "4", "4", "3" }) + @NotYetImplemented + public void childNodes_nav() throws Exception { + loadPageWithAlerts2(createHtmlForChildNodes("nav")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = { "3", "2", "2", "3", "2", "2" }, IE8 = { "1", "1", "1", "2", "2", "1" }) public void childNodes_nobr() throws Exception { @@ -1141,7 +1218,7 @@ */ @Test @Alerts(DEFAULT = { "3", "2", "2", "3", "2", "2" }, - IE8 = { "1", "1", "1", "2", "2", "1" }) + IE8 = { "2", "2", "2", "4", "4", "3" }) @NotYetImplemented() public void childNodes_rt() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("rt")); @@ -1152,7 +1229,7 @@ */ @Test @Alerts(DEFAULT = { "3", "2", "2", "3", "2", "2" }, - IE8 = { "1", "1", "1", "2", "2", "1" }) + IE8 = { "2", "2", "2", "4", "4", "3" }) @NotYetImplemented() public void childNodes_rp() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("rp")); @@ -1193,6 +1270,17 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = { "1", "0", "1", "1", "0", "1" }, + IE8 = { "2", "2", "2", "4", "4", "3" }) + @NotYetImplemented + public void childNodes_section() throws Exception { + loadPageWithAlerts2(createHtmlForChildNodes("section")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = { "3", "2", "2", "3", "2", "2" }, IE8 = { "2", "2", "1", "2", "2", "1" }) @NotYetImplemented(IE8) Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java 2013-12-18 12:08:40 UTC (rev 8870) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java 2013-12-18 19:59:25 UTC (rev 8871) @@ -2992,12 +2992,15 @@ } private String outerHTML(final String elementName) { - return "<html><head>\n" + return "<!DOCTYPE html><html><head>\n" + " <script>\n" + " function test(){\n" - + " var value = document.createElement('" + elementName + "').cloneNode(true).outerHTML;\n" - + " while (value && (value.charAt(0) == '\\r' || value.charAt(0) == '\\n'))\n" + + " var value = document.createElement('" + elementName + "').outerHTML;\n" + + " while (value && (value.charAt(0) == '\\r' || value.charAt(0) == '\\n')) {\n" + " value = value.substring(1);\n" + + " }\n" + // IE8 inserts a fancy namespace declaration if the tag is unknown + + " value = value.replace('<?XML:NAMESPACE PREFIX = PUBLIC NS = \"URN:COMPONENT\" />', '');\n" + " alert(value);\n" + " }\n" + " </script>\n" @@ -3069,6 +3072,24 @@ * @throws Exception if the test fails */ @Test + @Alerts("<article></article>") + public void outerHTML_article() throws Exception { + loadPageWithAlerts2(outerHTML("article")); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("<aside></aside>") + public void outerHTML_aside() throws Exception { + loadPageWithAlerts2(outerHTML("aside")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts("<audio></audio>") public void outerHTML_audio() throws Exception { loadPageWithAlerts2(outerHTML("audio")); @@ -3258,9 +3279,7 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = "<datalist></datalist>", - IE8 = "<:datalist></:datalist>") - @NotYetImplemented(IE8) + @Alerts("<datalist></datalist>") public void outerHTML_datalist() throws Exception { loadPageWithAlerts2(outerHTML("datalist")); } @@ -3369,6 +3388,15 @@ * @throws Exception if the test fails */ @Test + @Alerts("<figure></figure>") + public void outerHTML_figure() throws Exception { + loadPageWithAlerts2(outerHTML("figure")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = "<font></font>", IE8 = "<FONT></FONT>") public void outerHTML_font() throws Exception { @@ -3389,6 +3417,15 @@ * @throws Exception if the test fails */ @Test + @Alerts("<footer></footer>") + public void outerHTML_footer() throws Exception { + loadPageWithAlerts2(outerHTML("footer")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = "<frame>", IE8 = "<FRAME>") public void outerHTML_frame() throws Exception { @@ -3479,6 +3516,15 @@ * @throws Exception if the test fails */ @Test + @Alerts("<header></header>") + public void outerHTML_header() throws Exception { + loadPageWithAlerts2(outerHTML("header")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = "<hr>", IE8 = "<HR>") public void outerHTML_hr() throws Exception { @@ -3682,6 +3728,15 @@ * @throws Exception if the test fails */ @Test + @Alerts("<mark></mark>") + public void outerHTML_mark() throws Exception { + loadPageWithAlerts2(outerHTML("mark")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = "<menu></menu>", IE8 = "<MENU></MENU>") public void outerHTML_menu() throws Exception { @@ -3720,6 +3775,15 @@ * @throws Exception if the test fails */ @Test + @Alerts("<nav></nav>") + public void outerHTML_nav() throws Exception { + loadPageWithAlerts2(outerHTML("nav")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = "<nobr></nobr>", IE8 = "<NOBR></NOBR>") public void outerHTML_nobr() throws Exception { @@ -3879,6 +3943,15 @@ * @throws Exception if the test fails */ @Test + @Alerts("<section></section>") + public void outerHTML_section() throws Exception { + loadPageWithAlerts2(outerHTML("section")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = "<select></select>", IE8 = "<SELECT></SELECT>") public void outerHTML_select() throws Exception { |
From: <rb...@us...> - 2013-12-18 21:44:01
|
Revision: 8872 http://sourceforge.net/p/htmlunit/code/8872 Author: rbri Date: 2013-12-18 21:43:54 +0000 (Wed, 18 Dec 2013) Log Message: ----------- and again fixes for our javascript objects Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLSerializer.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java Removed Paths: ------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSpacer.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSpacerElement.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-18 19:59:25 UTC (rev 8871) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-18 21:43:54 UTC (rev 8872) @@ -89,7 +89,7 @@ HtmlRp.TAG_NAME, HtmlRt.TAG_NAME, HtmlRuby.TAG_NAME, HtmlS.TAG_NAME, HtmlSample.TAG_NAME, HtmlScript.TAG_NAME, HtmlSection.TAG_NAME, HtmlSelect.TAG_NAME, HtmlSmall.TAG_NAME, - HtmlSource.TAG_NAME, HtmlSpacer.TAG_NAME, HtmlSpan.TAG_NAME, + HtmlSource.TAG_NAME, HtmlSpan.TAG_NAME, HtmlStrike.TAG_NAME, HtmlStrong.TAG_NAME, HtmlStyle.TAG_NAME, HtmlSubscript.TAG_NAME, HtmlSuperscript.TAG_NAME, HtmlTable.TAG_NAME, HtmlTableColumn.TAG_NAME, HtmlTableColumnGroup.TAG_NAME, @@ -536,9 +536,6 @@ return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes); } } - else if (tagName.equals(HtmlSpacer.TAG_NAME)) { - element = new HtmlSpacer(namespaceURI, qualifiedName, page, attributeMap); - } else if (tagName.equals(HtmlSpan.TAG_NAME)) { element = new HtmlSpan(namespaceURI, qualifiedName, page, attributeMap); } Deleted: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSpacer.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSpacer.java 2013-12-18 19:59:25 UTC (rev 8871) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSpacer.java 2013-12-18 21:43:54 UTC (rev 8872) @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002-2013 Gargoyle Software Inc. - * - * 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 com.gargoylesoftware.htmlunit.html; - -import java.util.Map; - -import com.gargoylesoftware.htmlunit.SgmlPage; - -/** - * Wrapper for the HTML element "spacer". - * - * @version $Revision$ - * @author Ahmed Ashour - */ -public class HtmlSpacer extends HtmlElement { - - /** The HTML tag represented by this element. */ - public static final String TAG_NAME = "spacer"; - - /** - * Creates a new instance. - * - * @param namespaceURI the URI that identifies an XML namespace - * @param qualifiedName the qualified name of the element type to instantiate - * @param page the page that contains this element - * @param attributes the initial attributes - */ - HtmlSpacer(final String namespaceURI, final String qualifiedName, final SgmlPage page, - final Map<String, DomAttr> attributes) { - super(namespaceURI, qualifiedName, page, attributes); - } -} Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java 2013-12-18 19:59:25 UTC (rev 8871) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java 2013-12-18 21:43:54 UTC (rev 8872) @@ -177,7 +177,6 @@ import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLScriptElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLSelectElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLSourceElement; -import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLSpacerElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLSpanElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLStyleElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLTableCaptionElement; @@ -315,7 +314,7 @@ HTMLOptionElement.class, HTMLOptionsCollection.class, HTMLParagraphElement.class, HTMLParamElement.class, HTMLPhraseElement.class, HTMLPreElement.class, HTMLProgressElement.class, HTMLScriptElement.class, - HTMLSelectElement.class, HTMLSourceElement.class, HTMLSpacerElement.class, HTMLSpanElement.class, + HTMLSelectElement.class, HTMLSourceElement.class, HTMLSpanElement.class, HTMLStyleElement.class, HTMLTableCaptionElement.class, HTMLTableCellElement.class, HTMLTableColElement.class, HTMLTableComponent.class, HTMLTableElement.class, HTMLTableRowElement.class, HTMLTableSectionElement.class, HTMLTextElement.class, HTMLTextAreaElement.class, HTMLTitleElement.class, Deleted: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSpacerElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSpacerElement.java 2013-12-18 19:59:25 UTC (rev 8871) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSpacerElement.java 2013-12-18 21:43:54 UTC (rev 8872) @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002-2013 Gargoyle Software Inc. - * - * 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 com.gargoylesoftware.htmlunit.javascript.host.html; - -import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; -import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; - -import com.gargoylesoftware.htmlunit.html.HtmlSpacer; -import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; -import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; - -/** - * The JavaScript object "HTMLSpacerElement". - * - * @version $Revision$ - * @author Ahmed Ashour - * @author Ronald Brill - */ -@JsxClass(domClass = HtmlSpacer.class, browsers = { @WebBrowser(FF), @WebBrowser(CHROME) }) -public class HTMLSpacerElement extends HTMLElement { - - /** - * {@inheritDoc} - */ - protected boolean isLowerCaseInOuterHtml() { - return true; - } -} 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-12-18 19:59:25 UTC (rev 8871) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLSerializer.java 2013-12-18 21:43:54 UTC (rev 8872) @@ -85,7 +85,7 @@ HtmlPlainText.TAG_NAME, HtmlPreformattedText.TAG_NAME, HtmlInlineQuotation.TAG_NAME, HtmlS.TAG_NAME, HtmlSample.TAG_NAME, HtmlScript.TAG_NAME, HtmlSelect.TAG_NAME, HtmlSmall.TAG_NAME, - HtmlSource.TAG_NAME, HtmlSpacer.TAG_NAME, HtmlSpan.TAG_NAME, + HtmlSource.TAG_NAME, HtmlSpan.TAG_NAME, HtmlStrike.TAG_NAME, HtmlStrong.TAG_NAME, HtmlStyle.TAG_NAME, HtmlSubscript.TAG_NAME, HtmlSuperscript.TAG_NAME, HtmlTitle.TAG_NAME, HtmlTable.TAG_NAME, HtmlTableColumn.TAG_NAME, HtmlTableColumnGroup.TAG_NAME, Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java 2013-12-18 19:59:25 UTC (rev 8871) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java 2013-12-18 21:43:54 UTC (rev 8872) @@ -101,7 +101,7 @@ "HtmlPlainText", "HtmlPreformattedText", "HtmlRadioButtonInput", "HtmlResetInput", "HtmlS", "HtmlSample", "HtmlScript", "HtmlSelect", "HtmlSmall", - "HtmlSpacer", "HtmlSpan", "HtmlSource", "HtmlStrike", + "HtmlSpan", "HtmlSource", "HtmlStrike", "HtmlStrong", "HtmlStyle", "HtmlSubmitInput", "HtmlSubscript", "HtmlSuperscript", "HtmlTable", "HtmlTableBody", /*"HtmlTableCell",*/ "HtmlTableColumn", |
From: <asa...@us...> - 2013-12-19 10:26:22
|
Revision: 8874 http://sourceforge.net/p/htmlunit/code/8874 Author: asashour Date: 2013-12-19 10:26:18 +0000 (Thu, 19 Dec 2013) Log Message: ----------- Change old SourceForge bug URLs Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClientTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomTextTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchorTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFileInputTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrameSetTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrameTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlImageInputTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlPageTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/xpath/HtmlUnitXPathTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/SimpleScriptableTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/background/MemoryLeakTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/LocationTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Node2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Window2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WindowConcurrencyTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WindowTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentWriteTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElement2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFrameElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLOptionElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSelectElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest3Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequestTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/regexp/HtmlUnitRegExpProxyTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/LibraryDependencyTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/YuiTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -261,7 +261,7 @@ * probably be done by NekoHTML. See the bug linked below. If and when that bug is fixed, * we may be able to get rid of this code. * - * http://sourceforge.net/tracker/index.php?func=detail&aid=1898038&group_id=195122&atid=952178 + * http://sourceforge.net/p/nekohtml/bugs/15/ * @param page * @param originalCall * @param checkInsideFrameOnly true if the original page had body that was removed by JavaScript Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClientTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClientTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClientTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -1215,7 +1215,7 @@ } /** - * Regression test for https://sf.net/tracker/index.php?func=detail&aid=1669097&group_id=47038&atid=448266. + * Regression test for http://sourceforge.net/p/htmlunit/bugs/431/. * @throws Exception if an error occurs */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomTextTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomTextTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomTextTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -55,8 +55,8 @@ } /** - * Test font formats, as per bug #1731042. - * See http://sourceforge.net/tracker/index.php?func=detail&aid=1731042&group_id=47038&atid=448266. + * Test font formats, as per bug #490. + * See http://sourceforge.net/p/htmlunit/bugs/490/. * * @throws Exception if the test fails */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchorTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchorTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchorTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -473,7 +473,7 @@ * Links with an href and a non-false returning onclick that opens a new window should still * open the href in the first window. * - * https://sourceforge.net/tracker/index.php?func=detail&aid=1587110&group_id=47038&atid=448266 + * http://sourceforge.net/p/htmlunit/bugs/394/ * * @throws Exception on test failure */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFileInputTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFileInputTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFileInputTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -349,7 +349,7 @@ * Test HttpClient for uploading a file with non-ASCII name, if it works it means HttpClient has fixed its bug. * * Test for http://issues.apache.org/jira/browse/HTTPCLIENT-293, - * which is related to http://sourceforge.net/tracker/index.php?func=detail&aid=1818569&group_id=47038&atid=448266 + * which is related to http://sourceforge.net/p/htmlunit/bugs/535/ * * @throws Exception if the test fails */ @@ -391,7 +391,7 @@ /** * Test uploading a file with non-ASCII name. * - * Test for http://sourceforge.net/tracker/index.php?func=detail&aid=1818569&group_id=47038&atid=448266 + * Test for http://sourceforge.net/p/htmlunit/bugs/535/ * * @throws Exception if the test fails */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrameSetTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrameSetTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrameSetTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -115,7 +115,7 @@ } /** - * Regression test for http://sourceforge.net/tracker/index.php?func=detail&aid=1101525&group_id=47038&atid=448266. + * Regression test for http://sourceforge.net/p/htmlunit/bugs/203/. * @throws Exception if the test fails */ @Test @@ -181,8 +181,8 @@ /** * Forward referencing issue in FrameSet. - * Test for bug 1239285 - * https://sourceforge.net/tracker/index.php?func=detail&aid=1239285&group_id=47038&atid=448266 + * Test for bug 291 + * http://sourceforge.net/p/htmlunit/bugs/291/ * @throws Exception if the test fails */ @Test @@ -293,7 +293,7 @@ } /** - * Regression test for https://sf.net/tracker/index.php?func=detail&aid=1794764&group_id=47038&atid=448266. + * Regression test for http://sourceforge.net/p/htmlunit/bugs/521/. * @throws Exception if the test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrameTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrameTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrameTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -184,8 +184,8 @@ } /** - * Regression test for bug 1518195. - * See http://sourceforge.net/tracker/index.php?func=detail&aid=1518195&group_id=47038&atid=448266. + * Regression test for bug 363. + * See http://sourceforge.net/p/htmlunit/bugs/363/. * @throws Exception if the test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlImageInputTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlImageInputTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlImageInputTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -177,7 +177,7 @@ } /** - * Test for bug: http://sourceforge.net/tracker/index.php?func=detail&aid=2013891&group_id=47038&atid=448266. + * Test for bug: http://sourceforge.net/p/htmlunit/bugs/646/. * @throws Exception if an error occurs */ @Test @@ -191,7 +191,7 @@ } /** - * Test for bug: http://sourceforge.net/tracker/index.php?func=detail&aid=2013891&group_id=47038&atid=448266. + * Test for bug: http://sourceforge.net/p/htmlunit/bugs/646/. * @throws Exception if an error occurs */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlPageTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlPageTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlPageTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -1788,7 +1788,7 @@ /** * HtmlPage.getReadyState() should give the same information than the document element. - * @see <a href="http://sf.net/tracker/index.php?func=detail&aid=1592733&group_id=47038&atid=448266">1592733</a> + * @see <a href="http://sourceforge.net/p/htmlunit/bugs/402/">402</a> * @exception Exception If the test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/xpath/HtmlUnitXPathTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/xpath/HtmlUnitXPathTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/xpath/HtmlUnitXPathTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -218,7 +218,7 @@ } /** - * Regression test for https://sf.net/tracker/index.php?func=detail&aid=1527799&group_id=47038&atid=448266. + * Regression test for http://sourceforge.net/p/htmlunit/bugs/365/. * @throws Exception if test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/SimpleScriptableTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/SimpleScriptableTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/SimpleScriptableTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -243,7 +243,7 @@ } /** - * Test for https://sourceforge.net/tracker/index.php?func=detail&aid=1933943&group_id=47038&atid=448266. + * Test for http://sourceforge.net/p/htmlunit/bugs/587/. * See also http://groups.google.com/group/mozilla.dev.tech.js-engine.rhino/browse_thread/thread/1f1c24f58f662c58. * @throws Exception if the test fails */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/background/MemoryLeakTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/background/MemoryLeakTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/background/MemoryLeakTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -56,8 +56,8 @@ /** * Verifies that windows don't get leaked, especially when there are long-running background JS tasks * scheduled via <tt>setTimeout</tt> or <tt>setInterval</tt>. See the following bugs: - * https://sourceforge.net/tracker/index.php?func=detail&aid=2003396&group_id=47038&atid=448266 - * https://sourceforge.net/tracker/index.php?func=detail&aid=2014629&group_id=47038&atid=448266 + * http://sourceforge.net/p/htmlunit/bugs/639/ + * http://sourceforge.net/p/htmlunit/bugs/648/ * * @throws Exception if an error occurs */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/LocationTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/LocationTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/LocationTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -304,7 +304,7 @@ } /** - * Regression test for http://sourceforge.net/tracker/index.php?func=detail&aid=1289060&group_id=47038&atid=448266. + * Regression test for http://sourceforge.net/p/htmlunit/bugs/307/. * @throws Exception if the test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Node2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Node2Test.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Node2Test.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -122,7 +122,7 @@ /** * Verifies that attributes belonging to cloned nodes are available via JavaScript. - * http://sourceforge.net/tracker/index.php?func=detail&aid=2024741&group_id=47038&atid=448266 + * http://sourceforge.net/p/htmlunit/bugs/659/ * @throws Exception if an error occurs */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Window2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Window2Test.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Window2Test.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -341,7 +341,7 @@ } /** - * Regression test for https://sf.net/tracker/index.php?func=detail&aid=1153708&group_id=47038&atid=448266 + * Regression test for http://sourceforge.net/p/htmlunit/bugs/234/ * and https://bugzilla.mozilla.org/show_bug.cgi?id=443491. * @throws Exception if the test fails */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WindowConcurrencyTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WindowConcurrencyTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WindowConcurrencyTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -348,8 +348,8 @@ } /** - * Regression test for bug #2093370 with clearInterval. - * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=2093370&group_id=47038&atid=448266"> + * Regression test for bug #693 with clearInterval. + * @see <a href="http://sourceforge.net/p/htmlunit/bugs/693/"> * bug details</a> * @throws Exception if the test fails */ @@ -360,7 +360,7 @@ /** * Regression test for bug #2093370 with clearTimeout. - * @see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=2093370&group_id=47038&atid=448266"> + * @see <a href="http://sourceforge.net/p/htmlunit/bugs/693/"> * bug details</a> * @throws Exception if the test fails */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WindowTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WindowTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WindowTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -1850,8 +1850,8 @@ } /** - * Regression test for [ 1608555 ] JavaScript: window.eval does evaluate local scope. - * See https://sourceforge.net/tracker/index.php?func=detail&aid=1608555&group_id=47038&atid=448266. + * Regression test for #408 JavaScript: window.eval does evaluate local scope. + * See http://sourceforge.net/p/htmlunit/bugs/408/. * @throws Exception if the test fails */ @Test @@ -2198,7 +2198,7 @@ } /** - * Regression test for https://sf.net/tracker/index.php?func=detail&aid=1153708&group_id=47038&atid=448266 + * Regression test for http://sourceforge.net/p/htmlunit/bugs/234/ * and https://bugzilla.mozilla.org/show_bug.cgi?id=443491. * @throws Exception if the test fails */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -133,7 +133,7 @@ /** * Some style tests. There are two points in this case: * <ol> - * <li>https://sourceforge.net/tracker/index.php?func=detail&aid=1566274&group_id=82996&atid=567969</li> + * <li>http://sourceforge.net/p/cssparser/bugs/17/</li> * <li>the "pointer" value gets inherited by "myDiv2", which is parsed as a child of "style_test_1"</li> * </ol> * @throws Exception if the test fails Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentWriteTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentWriteTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentWriteTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -561,8 +561,8 @@ } /** - * Test for bug 1678826. - * https://sourceforge.net/tracker/index.php?func=detail&aid=1678826&group_id=47038&atid=448266 + * Test for bug 436. + * http://sourceforge.net/p/htmlunit/bugs/436/ * @throws Exception if the test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElement2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElement2Test.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElement2Test.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -297,7 +297,7 @@ /** * Verifies that the event object is correctly made available. - * Regression test for https://sf.net/tracker/index.php?func=detail&aid=1648014&group_id=47038&atid=448266. + * Regression test for http://sourceforge.net/p/htmlunit/bugs/425/ * @throws Exception if the test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -688,7 +688,7 @@ /** * Test that the form from the right page is returned after browsing. * Regression test for - * http://sourceforge.net/tracker/index.php?func=detail&aid=1627983&group_id=47038&atid=448266 + * http://sourceforge.net/p/htmlunit/bugs/417/ * @throws Exception if the test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFrameElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFrameElementTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFrameElementTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -48,7 +48,7 @@ public class HTMLFrameElementTest extends SimpleWebTestCase { /** - * Regression test for http://sourceforge.net/tracker/index.php?func=detail&aid=1101525&group_id=47038&atid=448266. + * Regression test for http://sourceforge.net/p/htmlunit/bugs/203/. * @throws Exception if the test fails */ @Test @@ -87,7 +87,7 @@ /** * Regression test for bug 1236048. - * See http://sourceforge.net/tracker/index.php?func=detail&aid=1236048&group_id=47038&atid=448266. + * See http://sourceforge.net/p/htmlunit/bugs/288/. * @throws Exception if the test fails */ @Alerts("2") @@ -118,8 +118,8 @@ } /** - * Regression test for bug 1289060. - * See http://sourceforge.net/tracker/index.php?func=detail&aid=1289060&group_id=47038&atid=448266. + * Regression test for bug 307. + * See http://sourceforge.net/p/htmlunit/bugs/307/. * @throws Exception if the test fails */ @Alerts("DIV") Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLOptionElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLOptionElementTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLOptionElementTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -64,8 +64,8 @@ } /** - * Regression test for bug 1323425. - * See http://sourceforge.net/tracker/index.php?func=detail&aid=1323425&group_id=47038&atid=448266. + * Regression test for bug 313. + * See http://sourceforge.net/p/htmlunit/bugs/313/. * @throws Exception if the test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSelectElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSelectElementTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSelectElementTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -462,8 +462,8 @@ } /** - * Regression test for bug 1304741. - * See https://sourceforge.net/tracker/index.php?func=detail&aid=1304741&group_id=47038&atid=448266. + * Regression test for bug 308. + * See http://sourceforge.net/p/htmlunit/bugs/308/. * @throws Exception if the test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest3Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest3Test.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest3Test.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -193,7 +193,7 @@ /** * Asynchronous callback should be called in "main" js thread and not parallel to other js execution. - * See https://sourceforge.net/tracker/index.php?func=detail&aid=1508377&group_id=47038&atid=448266. + * See http://sourceforge.net/p/htmlunit/bugs/360/. * @throws Exception if the test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequestTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequestTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequestTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -303,7 +303,7 @@ } /** - * Regression test for http://sourceforge.net/tracker/index.php?func=detail&aid=1209692&group_id=47038&atid=448266. + * Regression test for http://sourceforge.net/p/htmlunit/bugs/269/. * @throws Exception if the test fails */ @Test @@ -561,9 +561,9 @@ } /** - * Regression test for bug 1611097. - * https://sourceforge.net/tracker/index.php?func=detail&aid=1611097&group_id=47038&atid=448266 - * Caution: the problem appeared with jdk 1.4 but not with jdk 1.5 as String contains a + * Regression test for bug 410. + * http://sourceforge.net/p/htmlunit/bugs/410/ + * Caution: the problem appeared with JDK 1.4 but not with JDK 1.5 as String contains a * replace(CharSequence, CharSequence) method in this version * @throws Exception if the test fails */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/regexp/HtmlUnitRegExpProxyTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/regexp/HtmlUnitRegExpProxyTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/regexp/HtmlUnitRegExpProxyTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -74,7 +74,7 @@ + "assertArrEquals(s.match(re), [s, 'var a = 1;', ';']);\n"; /** - * Test for bug http://sf.net/tracker/index.php?func=detail&aid=1780089&group_id=47038&atid=448266. + * Test for bug http://sourceforge.net/p/htmlunit/bugs/513/. * @throws Exception if the test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/LibraryDependencyTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/LibraryDependencyTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/LibraryDependencyTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -37,7 +37,7 @@ public class LibraryDependencyTest extends WebDriverTestCase { /** - * Test for http://sourceforge.net/tracker/index.php?func=detail&aid=1997280&group_id=47038&atid=448266. + * Test for http://sourceforge.net/p/htmlunit/bugs/637/. * @throws Exception if the test fails */ @Alerts("2") Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/YuiTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/YuiTest.java 2013-12-18 21:47:23 UTC (rev 8873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/YuiTest.java 2013-12-19 10:26:18 UTC (rev 8874) @@ -111,8 +111,6 @@ public void config() throws Exception { // Test currently commented out as there are problems with the YUI test. // A bug has been filed against YUI regarding the problems with the test. - // See http://sourceforge.net/tracker/index.php?func=detail&aid=1788014&group_id=165715&atid=836476 - // for more details. fail("YUI test has a bug that causes this to fail."); //doTest("config.html"); } |
From: <rb...@us...> - 2013-12-19 16:41:54
|
Revision: 8876 http://sourceforge.net/p/htmlunit/code/8876 Author: rbri Date: 2013-12-19 16:41:51 +0000 (Thu, 19 Dec 2013) Log Message: ----------- use the same list of supported tags Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-19 16:41:11 UTC (rev 8875) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-19 16:41:51 UTC (rev 8876) @@ -19,6 +19,8 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTML5_TAGS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLBASEFONT_SUPPORTED; +import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; @@ -53,54 +55,75 @@ * For example HTMLParser2Test.childNodes_xmp * You can generate your own test cases by looking into TestSource.generateTestForHtmlElements */ - static final List<String> SUPPORTED_TAGS_ = Arrays.asList(HtmlAbbreviated.TAG_NAME, HtmlAcronym.TAG_NAME, - HtmlAnchor.TAG_NAME, HtmlAddress.TAG_NAME, HtmlApplet.TAG_NAME, HtmlArea.TAG_NAME, - HtmlArticle.TAG_NAME, HtmlAside.TAG_NAME, HtmlAudio.TAG_NAME, - HtmlBackgroundSound.TAG_NAME, HtmlBase.TAG_NAME, HtmlBaseFont.TAG_NAME, - HtmlBidirectionalOverride.TAG_NAME, HtmlBig.TAG_NAME, HtmlBlink.TAG_NAME, - HtmlBlockQuote.TAG_NAME, HtmlBody.TAG_NAME, HtmlBold.TAG_NAME, - HtmlBreak.TAG_NAME, HtmlButton.TAG_NAME, HtmlCanvas.TAG_NAME, HtmlCaption.TAG_NAME, - HtmlCenter.TAG_NAME, HtmlCitation.TAG_NAME, HtmlCode.TAG_NAME, - HtmlDataList.TAG_NAME, - HtmlDefinition.TAG_NAME, HtmlDefinitionDescription.TAG_NAME, - HtmlDeletedText.TAG_NAME, HtmlDirectory.TAG_NAME, - HtmlDivision.TAG_NAME, HtmlDefinitionList.TAG_NAME, - HtmlDefinitionTerm.TAG_NAME, HtmlEmbed.TAG_NAME, - HtmlEmphasis.TAG_NAME, - HtmlFieldSet.TAG_NAME, HtmlFigure.TAG_NAME, - HtmlFont.TAG_NAME, HtmlForm.TAG_NAME, HtmlFooter.TAG_NAME, - HtmlFrame.TAG_NAME, HtmlFrameSet.TAG_NAME, - HtmlHead.TAG_NAME, HtmlHeader.TAG_NAME, - HtmlHeading1.TAG_NAME, HtmlHeading2.TAG_NAME, HtmlHeading3.TAG_NAME, - HtmlHeading4.TAG_NAME, HtmlHeading5.TAG_NAME, HtmlHeading6.TAG_NAME, - HtmlHorizontalRule.TAG_NAME, HtmlHtml.TAG_NAME, HtmlInlineFrame.TAG_NAME, - HtmlInlineQuotation.TAG_NAME, - HtmlImage.TAG_NAME, HtmlImage.TAG_NAME2, HtmlInsertedText.TAG_NAME, HtmlIsIndex.TAG_NAME, - HtmlItalic.TAG_NAME, HtmlKeyboard.TAG_NAME, HtmlLabel.TAG_NAME, - HtmlLegend.TAG_NAME, HtmlListing.TAG_NAME, HtmlListItem.TAG_NAME, - HtmlLink.TAG_NAME, HtmlMap.TAG_NAME, HtmlMark.TAG_NAME, HtmlMarquee.TAG_NAME, - HtmlMenu.TAG_NAME, HtmlMeta.TAG_NAME, HtmlMeter.TAG_NAME, HtmlMultiColumn.TAG_NAME, - HtmlNav.TAG_NAME, - HtmlNoBreak.TAG_NAME, HtmlNoEmbed.TAG_NAME, HtmlNoFrames.TAG_NAME, - HtmlNoScript.TAG_NAME, HtmlObject.TAG_NAME, HtmlOrderedList.TAG_NAME, - HtmlOptionGroup.TAG_NAME, HtmlOption.TAG_NAME, HtmlParagraph.TAG_NAME, - HtmlParameter.TAG_NAME, HtmlPlainText.TAG_NAME, HtmlPreformattedText.TAG_NAME, - HtmlProgress.TAG_NAME, - HtmlRp.TAG_NAME, HtmlRt.TAG_NAME, HtmlRuby.TAG_NAME, - HtmlS.TAG_NAME, HtmlSample.TAG_NAME, - HtmlScript.TAG_NAME, HtmlSection.TAG_NAME, HtmlSelect.TAG_NAME, HtmlSmall.TAG_NAME, - HtmlSource.TAG_NAME, HtmlSpan.TAG_NAME, - HtmlStrike.TAG_NAME, HtmlStrong.TAG_NAME, HtmlStyle.TAG_NAME, - HtmlSubscript.TAG_NAME, HtmlSuperscript.TAG_NAME, - HtmlTable.TAG_NAME, HtmlTableColumn.TAG_NAME, HtmlTableColumnGroup.TAG_NAME, - HtmlTableBody.TAG_NAME, HtmlTableDataCell.TAG_NAME, HtmlTableHeaderCell.TAG_NAME, - HtmlTableRow.TAG_NAME, HtmlTextArea.TAG_NAME, HtmlTableFooter.TAG_NAME, - HtmlTableHeader.TAG_NAME, HtmlTeletype.TAG_NAME, HtmlTitle.TAG_NAME, - HtmlUnderlined.TAG_NAME, HtmlUnorderedList.TAG_NAME, - HtmlVariable.TAG_NAME, HtmlVideo.TAG_NAME, - HtmlWordBreak.TAG_NAME, HtmlExample.TAG_NAME - ); + @SuppressWarnings("unchecked") + static final List<Class<? extends HtmlElement>> SUPPORTED_ELEMNTS_ + = Arrays.asList(HtmlAbbreviated.class, HtmlAcronym.class, + HtmlAnchor.class, HtmlAddress.class, HtmlApplet.class, HtmlArea.class, + HtmlArticle.class, HtmlAside.class, HtmlAudio.class, + HtmlBackgroundSound.class, HtmlBase.class, HtmlBaseFont.class, + HtmlBidirectionalOverride.class, HtmlBig.class, HtmlBlink.class, + HtmlBlockQuote.class, HtmlBody.class, HtmlBold.class, + HtmlBreak.class, HtmlButton.class, HtmlCanvas.class, HtmlCaption.class, + HtmlCenter.class, HtmlCitation.class, HtmlCode.class, + HtmlDataList.class, + HtmlDefinition.class, HtmlDefinitionDescription.class, + HtmlDeletedText.class, HtmlDirectory.class, + HtmlDivision.class, HtmlDefinitionList.class, + HtmlDefinitionTerm.class, HtmlEmbed.class, + HtmlEmphasis.class, + HtmlFieldSet.class, HtmlFigure.class, + HtmlFont.class, HtmlForm.class, HtmlFooter.class, + HtmlFrame.class, HtmlFrameSet.class, + HtmlHead.class, HtmlHeader.class, + HtmlHeading1.class, HtmlHeading2.class, HtmlHeading3.class, + HtmlHeading4.class, HtmlHeading5.class, HtmlHeading6.class, + HtmlHorizontalRule.class, HtmlHtml.class, HtmlInlineFrame.class, + HtmlInlineQuotation.class, + HtmlImage.class, HtmlInsertedText.class, HtmlIsIndex.class, + HtmlItalic.class, HtmlKeyboard.class, HtmlLabel.class, + HtmlLegend.class, HtmlListing.class, HtmlListItem.class, + HtmlLink.class, HtmlMap.class, HtmlMark.class, HtmlMarquee.class, + HtmlMenu.class, HtmlMeta.class, HtmlMeter.class, HtmlMultiColumn.class, + HtmlNav.class, + HtmlNoBreak.class, HtmlNoEmbed.class, HtmlNoFrames.class, + HtmlNoScript.class, HtmlObject.class, HtmlOrderedList.class, + HtmlOptionGroup.class, HtmlOption.class, HtmlParagraph.class, + HtmlParameter.class, HtmlPlainText.class, HtmlPreformattedText.class, + HtmlProgress.class, + HtmlRp.class, HtmlRt.class, HtmlRuby.class, + HtmlS.class, HtmlSample.class, + HtmlScript.class, HtmlSection.class, HtmlSelect.class, HtmlSmall.class, + HtmlSource.class, HtmlSpan.class, + HtmlStrike.class, HtmlStrong.class, HtmlStyle.class, + HtmlSubscript.class, HtmlSuperscript.class, + HtmlTable.class, HtmlTableColumn.class, HtmlTableColumnGroup.class, + HtmlTableBody.class, HtmlTableDataCell.class, HtmlTableHeaderCell.class, + HtmlTableRow.class, HtmlTextArea.class, HtmlTableFooter.class, + HtmlTableHeader.class, HtmlTeletype.class, HtmlTitle.class, + HtmlUnderlined.class, HtmlUnorderedList.class, + HtmlVariable.class, HtmlVideo.class, + HtmlWordBreak.class, HtmlExample.class + ); + static final List<String> SUPPORTED_TAGS_; + static { + SUPPORTED_TAGS_ = new ArrayList<String>(SUPPORTED_ELEMNTS_.size()); + for (Class<? extends HtmlElement> clazz : SUPPORTED_ELEMNTS_) { + try { + final Field field = clazz.getDeclaredField("TAG_NAME"); + field.setAccessible(true); // performance + final Object tagName = field.get(null); + SUPPORTED_TAGS_.add((String) tagName); + } + catch (final Exception e) { + throw new RuntimeException(e); + } + } + + // HtmlImage supports two tags + SUPPORTED_TAGS_.add(HtmlImage.TAG_NAME2); + } + /** * @param page the owning page * @param tagName the HTML tag name Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java 2013-12-19 16:41:11 UTC (rev 8875) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java 2013-12-19 16:41:51 UTC (rev 8876) @@ -71,49 +71,8 @@ final HtmlPage page = webClient.getPage(SimpleWebTestCase.URL_FIRST); final TestSuite suite = new TestSuite(); - final String[] classesToTest = { - "HtmlAbbreviated", "HtmlAcronym", - "HtmlAddress", "HtmlAnchor", "HtmlApplet", "HtmlArea", - "HtmlAudio", "HtmlBackgroundSound", - "HtmlBase", "HtmlBaseFont", "HtmlBidirectionalOverride", - "HtmlBig", "HtmlBlink", - "HtmlBlockQuote", "HtmlBody", "HtmlBold", "HtmlBreak", "HtmlButton", - "HtmlButtonInput", "HtmlCanvas", "HtmlCaption", "HtmlCenter", - "HtmlCheckBoxInput", "HtmlCitation", "HtmlCode", - "HtmlDefinition", "HtmlDefinitionDescription", - "HtmlDefinitionList", "HtmlDefinitionTerm", - "HtmlDeletedText", "HtmlDirectory", "HtmlDivision", /*"HtmlElement", */ - "HtmlEmbed", "HtmlEmphasis", "HtmlExample", - "HtmlFieldSet", "HtmlFileInput", "HtmlFont", "HtmlForm", - "HtmlFrame", "HtmlFrameSet", "HtmlHead", "HtmlHeading1", - "HtmlHeading2", "HtmlHeading3", "HtmlHeading4", "HtmlHeading5", - "HtmlHeading6", "HtmlHiddenInput", "HtmlHorizontalRule", - "HtmlHtml", "HtmlImage", "HtmlImageInput", "HtmlInlineFrame", - "HtmlInlineQuotation", - "HtmlInsertedText", "HtmlIsIndex", "HtmlItalic", - "HtmlKeyboard", "HtmlLabel", - "HtmlLegend", "HtmlLink", "HtmlListing", "HtmlListItem", "HtmlMap", - "HtmlMarquee", - "HtmlMenu", "HtmlMeta", "HtmlMultiColumn", - "HtmlNoBreak", "HtmlNoEmbed", "HtmlNoFrames", "HtmlNoScript", - "HtmlObject", "HtmlOption", "HtmlOptionGroup", "HtmlOrderedList", - /*"HtmlPage",*/ "HtmlParagraph", "HtmlParameter", "HtmlPasswordInput", - "HtmlPlainText", - "HtmlPreformattedText", "HtmlRadioButtonInput", "HtmlResetInput", - "HtmlS", "HtmlSample", "HtmlScript", "HtmlSelect", "HtmlSmall", - "HtmlSpan", "HtmlSource", "HtmlStrike", - "HtmlStrong", "HtmlStyle", "HtmlSubmitInput", - "HtmlSubscript", "HtmlSuperscript", - "HtmlTable", "HtmlTableBody", /*"HtmlTableCell",*/ "HtmlTableColumn", - "HtmlTableColumnGroup", "HtmlTableDataCell", - "HtmlTableFooter", "HtmlTableHeader", "HtmlTableHeaderCell", - "HtmlTableRow", "HtmlTeletype", "HtmlTextArea", "HtmlTextInput", - "HtmlTitle", "HtmlUnderlined", "HtmlUnorderedList", - "HtmlVariable", "HtmlVideo", "HtmlWordBreak" - }; - for (final String testClass : classesToTest) { - final Class<?> clazz = Class.forName("com.gargoylesoftware.htmlunit.html." + testClass); + for (final Class<? extends HtmlElement> clazz : DefaultElementFactory.SUPPORTED_ELEMNTS_) { addTestsForClass(clazz, page, suite); } return suite; |
From: <rb...@us...> - 2013-12-19 19:37:32
|
Revision: 8878 http://sourceforge.net/p/htmlunit/code/8878 Author: rbri Date: 2013-12-19 19:37:27 +0000 (Thu, 19 Dec 2013) Log Message: ----------- make GAE happy (and use a copy for our tests :-( Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-19 17:24:32 UTC (rev 8877) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-19 19:37:27 UTC (rev 8878) @@ -19,8 +19,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTML5_TAGS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLBASEFONT_SUPPORTED; -import java.lang.reflect.Field; -import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; @@ -55,75 +53,54 @@ * For example HTMLParser2Test.childNodes_xmp * You can generate your own test cases by looking into TestSource.generateTestForHtmlElements */ - @SuppressWarnings("unchecked") - static final List<Class<? extends HtmlElement>> SUPPORTED_ELEMNTS_ - = Arrays.asList(HtmlAbbreviated.class, HtmlAcronym.class, - HtmlAnchor.class, HtmlAddress.class, HtmlApplet.class, HtmlArea.class, - HtmlArticle.class, HtmlAside.class, HtmlAudio.class, - HtmlBackgroundSound.class, HtmlBase.class, HtmlBaseFont.class, - HtmlBidirectionalOverride.class, HtmlBig.class, HtmlBlink.class, - HtmlBlockQuote.class, HtmlBody.class, HtmlBold.class, - HtmlBreak.class, HtmlButton.class, HtmlCanvas.class, HtmlCaption.class, - HtmlCenter.class, HtmlCitation.class, HtmlCode.class, - HtmlDataList.class, - HtmlDefinition.class, HtmlDefinitionDescription.class, - HtmlDeletedText.class, HtmlDirectory.class, - HtmlDivision.class, HtmlDefinitionList.class, - HtmlDefinitionTerm.class, HtmlEmbed.class, - HtmlEmphasis.class, - HtmlFieldSet.class, HtmlFigure.class, - HtmlFont.class, HtmlForm.class, HtmlFooter.class, - HtmlFrame.class, HtmlFrameSet.class, - HtmlHead.class, HtmlHeader.class, - HtmlHeading1.class, HtmlHeading2.class, HtmlHeading3.class, - HtmlHeading4.class, HtmlHeading5.class, HtmlHeading6.class, - HtmlHorizontalRule.class, HtmlHtml.class, HtmlInlineFrame.class, - HtmlInlineQuotation.class, - HtmlImage.class, HtmlInsertedText.class, HtmlIsIndex.class, - HtmlItalic.class, HtmlKeyboard.class, HtmlLabel.class, - HtmlLegend.class, HtmlListing.class, HtmlListItem.class, - HtmlLink.class, HtmlMap.class, HtmlMark.class, HtmlMarquee.class, - HtmlMenu.class, HtmlMeta.class, HtmlMeter.class, HtmlMultiColumn.class, - HtmlNav.class, - HtmlNoBreak.class, HtmlNoEmbed.class, HtmlNoFrames.class, - HtmlNoScript.class, HtmlObject.class, HtmlOrderedList.class, - HtmlOptionGroup.class, HtmlOption.class, HtmlParagraph.class, - HtmlParameter.class, HtmlPlainText.class, HtmlPreformattedText.class, - HtmlProgress.class, - HtmlRp.class, HtmlRt.class, HtmlRuby.class, - HtmlS.class, HtmlSample.class, - HtmlScript.class, HtmlSection.class, HtmlSelect.class, HtmlSmall.class, - HtmlSource.class, HtmlSpan.class, - HtmlStrike.class, HtmlStrong.class, HtmlStyle.class, - HtmlSubscript.class, HtmlSuperscript.class, - HtmlTable.class, HtmlTableColumn.class, HtmlTableColumnGroup.class, - HtmlTableBody.class, HtmlTableDataCell.class, HtmlTableHeaderCell.class, - HtmlTableRow.class, HtmlTextArea.class, HtmlTableFooter.class, - HtmlTableHeader.class, HtmlTeletype.class, HtmlTitle.class, - HtmlUnderlined.class, HtmlUnorderedList.class, - HtmlVariable.class, HtmlVideo.class, - HtmlWordBreak.class, HtmlExample.class - ); + static final List<String> SUPPORTED_TAGS_ = Arrays.asList(HtmlAbbreviated.TAG_NAME, HtmlAcronym.TAG_NAME, + HtmlAnchor.TAG_NAME, HtmlAddress.TAG_NAME, HtmlApplet.TAG_NAME, HtmlArea.TAG_NAME, + HtmlArticle.TAG_NAME, HtmlAside.TAG_NAME, HtmlAudio.TAG_NAME, + HtmlBackgroundSound.TAG_NAME, HtmlBase.TAG_NAME, HtmlBaseFont.TAG_NAME, + HtmlBidirectionalOverride.TAG_NAME, HtmlBig.TAG_NAME, HtmlBlink.TAG_NAME, + HtmlBlockQuote.TAG_NAME, HtmlBody.TAG_NAME, HtmlBold.TAG_NAME, + HtmlBreak.TAG_NAME, HtmlButton.TAG_NAME, HtmlCanvas.TAG_NAME, HtmlCaption.TAG_NAME, + HtmlCenter.TAG_NAME, HtmlCitation.TAG_NAME, HtmlCode.TAG_NAME, + HtmlDataList.TAG_NAME, + HtmlDefinition.TAG_NAME, HtmlDefinitionDescription.TAG_NAME, + HtmlDeletedText.TAG_NAME, HtmlDirectory.TAG_NAME, + HtmlDivision.TAG_NAME, HtmlDefinitionList.TAG_NAME, + HtmlDefinitionTerm.TAG_NAME, HtmlEmbed.TAG_NAME, + HtmlEmphasis.TAG_NAME, + HtmlFieldSet.TAG_NAME, HtmlFigure.TAG_NAME, + HtmlFont.TAG_NAME, HtmlForm.TAG_NAME, HtmlFooter.TAG_NAME, + HtmlFrame.TAG_NAME, HtmlFrameSet.TAG_NAME, + HtmlHead.TAG_NAME, HtmlHeader.TAG_NAME, + HtmlHeading1.TAG_NAME, HtmlHeading2.TAG_NAME, HtmlHeading3.TAG_NAME, + HtmlHeading4.TAG_NAME, HtmlHeading5.TAG_NAME, HtmlHeading6.TAG_NAME, + HtmlHorizontalRule.TAG_NAME, HtmlHtml.TAG_NAME, HtmlInlineFrame.TAG_NAME, + HtmlInlineQuotation.TAG_NAME, + HtmlImage.TAG_NAME, HtmlImage.TAG_NAME2, HtmlInsertedText.TAG_NAME, HtmlIsIndex.TAG_NAME, + HtmlItalic.TAG_NAME, HtmlKeyboard.TAG_NAME, HtmlLabel.TAG_NAME, + HtmlLegend.TAG_NAME, HtmlListing.TAG_NAME, HtmlListItem.TAG_NAME, + HtmlLink.TAG_NAME, HtmlMap.TAG_NAME, HtmlMark.TAG_NAME, HtmlMarquee.TAG_NAME, + HtmlMenu.TAG_NAME, HtmlMeta.TAG_NAME, HtmlMeter.TAG_NAME, HtmlMultiColumn.TAG_NAME, + HtmlNav.TAG_NAME, + HtmlNoBreak.TAG_NAME, HtmlNoEmbed.TAG_NAME, HtmlNoFrames.TAG_NAME, + HtmlNoScript.TAG_NAME, HtmlObject.TAG_NAME, HtmlOrderedList.TAG_NAME, + HtmlOptionGroup.TAG_NAME, HtmlOption.TAG_NAME, HtmlParagraph.TAG_NAME, + HtmlParameter.TAG_NAME, HtmlPlainText.TAG_NAME, HtmlPreformattedText.TAG_NAME, + HtmlProgress.TAG_NAME, + HtmlRp.TAG_NAME, HtmlRt.TAG_NAME, HtmlRuby.TAG_NAME, + HtmlS.TAG_NAME, HtmlSample.TAG_NAME, + HtmlScript.TAG_NAME, HtmlSection.TAG_NAME, HtmlSelect.TAG_NAME, HtmlSmall.TAG_NAME, + HtmlSource.TAG_NAME, HtmlSpan.TAG_NAME, + HtmlStrike.TAG_NAME, HtmlStrong.TAG_NAME, HtmlStyle.TAG_NAME, + HtmlSubscript.TAG_NAME, HtmlSuperscript.TAG_NAME, + HtmlTable.TAG_NAME, HtmlTableColumn.TAG_NAME, HtmlTableColumnGroup.TAG_NAME, + HtmlTableBody.TAG_NAME, HtmlTableDataCell.TAG_NAME, HtmlTableHeaderCell.TAG_NAME, + HtmlTableRow.TAG_NAME, HtmlTextArea.TAG_NAME, HtmlTableFooter.TAG_NAME, + HtmlTableHeader.TAG_NAME, HtmlTeletype.TAG_NAME, HtmlTitle.TAG_NAME, + HtmlUnderlined.TAG_NAME, HtmlUnorderedList.TAG_NAME, + HtmlVariable.TAG_NAME, HtmlVideo.TAG_NAME, + HtmlWordBreak.TAG_NAME, HtmlExample.TAG_NAME + ); - static final List<String> SUPPORTED_TAGS_; - static { - SUPPORTED_TAGS_ = new ArrayList<String>(SUPPORTED_ELEMNTS_.size()); - for (Class<? extends HtmlElement> clazz : SUPPORTED_ELEMNTS_) { - try { - final Field field = clazz.getDeclaredField("TAG_NAME"); - field.setAccessible(true); // performance - final Object tagName = field.get(null); - SUPPORTED_TAGS_.add((String) tagName); - } - catch (final Exception e) { - throw new RuntimeException(e); - } - } - - // HtmlImage supports two tags - SUPPORTED_TAGS_.add(HtmlImage.TAG_NAME2); - } - /** * @param page the owning page * @param tagName the HTML tag name Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java 2013-12-19 17:24:32 UTC (rev 8877) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java 2013-12-19 19:37:27 UTC (rev 8878) @@ -41,6 +41,7 @@ * @author Christian Sell * @author Marc Guillemot * @author Ahmed Ashour + * @author Ronald Brill */ public class AttributesTest extends TestCase { @@ -71,8 +72,57 @@ final HtmlPage page = webClient.getPage(SimpleWebTestCase.URL_FIRST); final TestSuite suite = new TestSuite(); + final String[] classesToTest = { + "HtmlAbbreviated", "HtmlAcronym", + "HtmlAnchor", "HtmlAddress", "HtmlApplet", "HtmlArea", + "HtmlArticle", "HtmlAside", "HtmlAudio", + "HtmlBackgroundSound", "HtmlBase", "HtmlBaseFont", + "HtmlBidirectionalOverride", "HtmlBig", "HtmlBlink", + "HtmlBlockQuote", "HtmlBody", "HtmlBold", + "HtmlBreak", "HtmlButton", "HtmlCanvas", "HtmlCaption", + "HtmlCenter", "HtmlCitation", "HtmlCode", + "HtmlDataList", + "HtmlDefinition", "HtmlDefinitionDescription", + "HtmlDeletedText", "HtmlDirectory", + "HtmlDivision", "HtmlDefinitionList", + "HtmlDefinitionTerm", "HtmlEmbed", + "HtmlEmphasis", + "HtmlFieldSet", "HtmlFigure", + "HtmlFont", "HtmlForm", "HtmlFooter", + "HtmlFrame", "HtmlFrameSet", + "HtmlHead", "HtmlHeader", + "HtmlHeading1", "HtmlHeading2", "HtmlHeading3", + "HtmlHeading4", "HtmlHeading5", "HtmlHeading6", + "HtmlHorizontalRule", "HtmlHtml", "HtmlInlineFrame", + "HtmlInlineQuotation", + "HtmlImage", "HtmlImage", "HtmlInsertedText", "HtmlIsIndex", + "HtmlItalic", "HtmlKeyboard", "HtmlLabel", + "HtmlLegend", "HtmlListing", "HtmlListItem", + "HtmlLink", "HtmlMap", "HtmlMark", "HtmlMarquee", + "HtmlMenu", "HtmlMeta", "HtmlMeter", "HtmlMultiColumn", + "HtmlNav", + "HtmlNoBreak", "HtmlNoEmbed", "HtmlNoFrames", + "HtmlNoScript", "HtmlObject", "HtmlOrderedList", + "HtmlOptionGroup", "HtmlOption", "HtmlParagraph", + "HtmlParameter", "HtmlPlainText", "HtmlPreformattedText", + "HtmlProgress", + "HtmlRp", "HtmlRt", "HtmlRuby", + "HtmlS", "HtmlSample", + "HtmlScript", "HtmlSection", "HtmlSelect", "HtmlSmall", + "HtmlSource", "HtmlSpan", + "HtmlStrike", "HtmlStrong", "HtmlStyle", + "HtmlSubscript", "HtmlSuperscript", + "HtmlTable", "HtmlTableColumn", "HtmlTableColumnGroup", + "HtmlTableBody", "HtmlTableDataCell", "HtmlTableHeaderCell", + "HtmlTableRow", "HtmlTextArea", "HtmlTableFooter", + "HtmlTableHeader", "HtmlTeletype", "HtmlTitle", + "HtmlUnderlined", "HtmlUnorderedList", + "HtmlVariable", "HtmlVideo", + "HtmlWordBreak", "HtmlExample" + }; - for (final Class<? extends HtmlElement> clazz : DefaultElementFactory.SUPPORTED_ELEMNTS_) { + for (final String testClass : classesToTest) { + final Class<?> clazz = Class.forName("com.gargoylesoftware.htmlunit.html." + testClass); addTestsForClass(clazz, page, suite); } return suite; |
From: <rb...@us...> - 2013-12-20 16:01:30
|
Revision: 8882 http://sourceforge.net/p/htmlunit/code/8882 Author: rbri Date: 2013-12-20 16:01:24 +0000 (Fri, 20 Dec 2013) Log Message: ----------- refactor the determination of the default display style (we do not need any string compares any longer); minor performance imporvements; one more test to be sure we have testcases for all supported tags; nextId tag support for IE added Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAbbreviated.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAcronym.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArea.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAudio.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBidirectionalOverride.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBig.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBlink.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBold.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBreak.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButton.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCanvas.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCaption.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCitation.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCode.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDataList.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinition.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDeletedText.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmbed.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmphasis.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlExample.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFont.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImage.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineFrame.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineQuotation.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInsertedText.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlItalic.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlKeyboard.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLegend.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListItem.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListing.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMap.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMark.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMeter.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMultiColumn.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoBreak.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoScript.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlObject.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOption.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOptionGroup.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlParameter.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPlainText.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlProgress.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRp.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRt.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRuby.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlS.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSample.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSelect.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSmall.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSource.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSpan.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlStrike.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlStrong.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSubscript.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSuperscript.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTable.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableBody.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableCell.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableColumn.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableColumnGroup.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableFooter.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableHeader.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableRow.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTeletype.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTextArea.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUnderlined.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUnknownElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlVariable.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlVideo.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlWordBreak.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.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/HTMLAnchorElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAreaElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAudioElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLBRElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLBlockElement.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/HTMLCanvasElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDataListElement.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/HTMLEmbedElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFontElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLImageElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLInlineQuotationElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLInputElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLLIElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLLabelElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLLegendElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLMapElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLMeterElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLModElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLNoShowElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLObjectElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLOptGroupElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLOptionElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLParagraphElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLParamElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLPhraseElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLProgressElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLScriptElement.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/HTMLSourceElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSpanElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableCaptionElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableCellElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableColElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableRowElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableSectionElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTextAreaElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLUnknownElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLVideoElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLWBRElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLElementsTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNextId.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLNextIdElement.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -80,7 +80,7 @@ HtmlLegend.TAG_NAME, HtmlListing.TAG_NAME, HtmlListItem.TAG_NAME, HtmlLink.TAG_NAME, HtmlMap.TAG_NAME, HtmlMark.TAG_NAME, HtmlMarquee.TAG_NAME, HtmlMenu.TAG_NAME, HtmlMeta.TAG_NAME, HtmlMeter.TAG_NAME, HtmlMultiColumn.TAG_NAME, - HtmlNav.TAG_NAME, + HtmlNav.TAG_NAME, HtmlNextId.TAG_NAME, HtmlNoBreak.TAG_NAME, HtmlNoEmbed.TAG_NAME, HtmlNoFrames.TAG_NAME, HtmlNoScript.TAG_NAME, HtmlObject.TAG_NAME, HtmlOrderedList.TAG_NAME, HtmlOptionGroup.TAG_NAME, HtmlOption.TAG_NAME, HtmlParagraph.TAG_NAME, @@ -442,6 +442,9 @@ return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes); } } + else if (tagName.equals(HtmlNextId.TAG_NAME)) { + element = new HtmlNextId(namespaceURI, qualifiedName, page, attributeMap); + } else if (tagName.equals(HtmlNoBreak.TAG_NAME)) { element = new HtmlNoBreak(namespaceURI, qualifiedName, page, attributeMap); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAbbreviated.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAbbreviated.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAbbreviated.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlAbbreviated extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAcronym.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAcronym.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAcronym.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlAcronym extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -317,4 +317,16 @@ protected boolean isEmptyXmlTagExpanded() { return true; } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArea.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArea.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArea.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -14,6 +14,8 @@ */ package com.gargoylesoftware.htmlunit.html; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_DISPLAY_DEFAULT; + import java.awt.geom.Ellipse2D; import java.awt.geom.GeneralPath; import java.awt.geom.Rectangle2D; @@ -266,4 +268,19 @@ return false; } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + if (hasFeature(CSS_DISPLAY_DEFAULT)) { + return DisplayStyle.NONE; + } + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAudio.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAudio.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAudio.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -41,4 +41,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.NONE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBidirectionalOverride.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBidirectionalOverride.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBidirectionalOverride.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -26,6 +26,7 @@ * @author David K. Taylor * @author <a href="mailto:cs...@dy...">Christian Sell</a> * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlBidirectionalOverride extends HtmlElement { @@ -45,4 +46,15 @@ super(namespaceURI, qualifiedName, page, attributes); } + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBig.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBig.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBig.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlBig extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBlink.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBlink.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBlink.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlBlink extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBold.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBold.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBold.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlBold extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBreak.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBreak.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBreak.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -26,6 +26,7 @@ * @author David K. Taylor * @author <a href="mailto:cs...@dy...">Christian Sell</a> * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlBreak extends HtmlElement { @@ -55,4 +56,16 @@ public final String getClearAttribute() { return getAttribute("clear"); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButton.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButton.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButton.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -304,4 +304,16 @@ public Collection<String> getPreviousNames() { return previousNames_; } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE_BLOCK; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCanvas.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCanvas.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCanvas.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlCanvas extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCaption.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCaption.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCaption.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -55,4 +55,16 @@ public final String getAlignAttribute() { return getAttribute("align"); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.TABLE_CAPTION; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCitation.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCitation.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCitation.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlCitation extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCode.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCode.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCode.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlCode extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDataList.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDataList.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDataList.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -41,4 +41,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.NONE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinition.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinition.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinition.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlDefinition extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDeletedText.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDeletedText.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDeletedText.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -26,6 +26,7 @@ * @author David K. Taylor * @author <a href="mailto:cs...@dy...">Christian Sell</a> * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlDeletedText extends HtmlElement { @@ -66,4 +67,16 @@ public final String getDateTimeAttribute() { return getAttribute("datetime"); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -80,6 +80,57 @@ */ public abstract class HtmlElement extends DomElement { + /** + * Enum for the different display styles. + */ + public enum DisplayStyle { + /** none. */ + NONE("none"), + /** block. */ + BLOCK("block"), + /** inline. */ + INLINE("inline"), + /** inline-block. */ + INLINE_BLOCK("inline-block"), + /** list-item. */ + LIST_ITEM("list-item"), + /** table. */ + TABLE("table"), + /** table-cell. */ + TABLE_CELL("table-cell"), + /** table-column. */ + TABLE_COLUMN("table-column"), + /** table-column-group. */ + TABLE_COLUMN_GROUP("table-column-group"), + /** table-row. */ + TABLE_ROW("table-row"), + /** table-row-group. */ + TABLE_ROW_GROUP("table-row-group"), + /** table-header-group. */ + TABLE_HEADER_GROUP("table-header-group"), + /** table-footer-group. */ + TABLE_FOOTER_GROUP("table-footer-group"), + /** table-caption. */ + TABLE_CAPTION("table-caption"), + /** ruby. */ + RUBY("ruby"), + /** ruby-text. */ + RUBY_TEXT("ruby-text"); + + private final String value_; + DisplayStyle(final String value) { + value_ = value; + } + + /** + * The string used from js. + * @return the value as string + */ + public String value() { + return value_; + } + } + private static final Log LOG = LogFactory.getLog(HtmlElement.class); /** @@ -1519,4 +1570,15 @@ public DomNode querySelector(final String selectors) { return super.querySelector(selectors); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.BLOCK; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmbed.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmbed.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmbed.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -32,6 +32,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlEmbed extends HtmlElement { @@ -68,4 +69,16 @@ IOUtils.copy(webResponse.getContentAsStream(), fos); fos.close(); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmphasis.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmphasis.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmphasis.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlEmphasis extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlExample.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlExample.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlExample.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlExample extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFont.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFont.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFont.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -86,4 +86,16 @@ protected boolean isTrimmedText() { return false; } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImage.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImage.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImage.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -512,4 +512,16 @@ } } } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineFrame.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineFrame.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineFrame.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -27,6 +27,7 @@ * @author <a href="mailto:cs...@dy...">Christian Sell</a> * @author Marc Guillemot * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlInlineFrame extends BaseFrameElement { @@ -55,4 +56,16 @@ protected boolean isEmptyXmlTagExpanded() { return true; } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineQuotation.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineQuotation.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineQuotation.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -26,6 +26,7 @@ * @author David K. Taylor * @author <a href="mailto:cs...@dy...">Christian Sell</a> * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlInlineQuotation extends HtmlElement { @@ -56,4 +57,16 @@ public final String getCiteAttribute() { return getAttribute("cite"); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -14,6 +14,7 @@ */ package com.gargoylesoftware.htmlunit.html; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_DISPLAY_DEFAULT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLINPUT_SET_DEFAULT_VALUE_UPDATES_VALUE; import java.io.IOException; @@ -589,4 +590,19 @@ Object getInternalValue() { return getValueAttribute(); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + if (hasFeature(CSS_DISPLAY_DEFAULT)) { + return DisplayStyle.INLINE; + } + return DisplayStyle.INLINE_BLOCK; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInsertedText.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInsertedText.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInsertedText.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -26,6 +26,7 @@ * @author David K. Taylor * @author <a href="mailto:cs...@dy...">Christian Sell</a> * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlInsertedText extends HtmlElement { @@ -68,4 +69,16 @@ public final String getDateTimeAttribute() { return getAttribute("datetime"); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlItalic.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlItalic.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlItalic.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlItalic extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlKeyboard.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlKeyboard.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlKeyboard.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlKeyboard extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -30,6 +30,7 @@ * @author <a href="mailto:cs...@dy...">Christian Sell</a> * @author Marc Guillemot * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlLabel extends HtmlElement { @@ -166,4 +167,16 @@ return response; } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLegend.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLegend.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLegend.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -14,6 +14,8 @@ */ package com.gargoylesoftware.htmlunit.html; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_DISPLAY_DEFAULT; + import java.util.Map; import com.gargoylesoftware.htmlunit.SgmlPage; @@ -26,6 +28,7 @@ * @author David K. Taylor * @author <a href="mailto:cs...@dy...">Christian Sell</a> * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlLegend extends HtmlElement { @@ -68,4 +71,19 @@ public final String getAlignAttribute() { return getAttribute("align"); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + if (hasFeature(CSS_DISPLAY_DEFAULT)) { + return DisplayStyle.BLOCK; + } + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListItem.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListItem.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListItem.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -68,4 +68,16 @@ public final String getValueAttribute() { return getAttribute("value"); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.LIST_ITEM; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListing.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListing.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListing.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlListing extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMap.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMap.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMap.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -26,6 +26,7 @@ * @author David K. Taylor * @author <a href="mailto:cs...@dy...">Christian Sell</a> * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlMap extends HtmlElement { @@ -56,4 +57,16 @@ public final String getNameAttribute() { return getAttribute("name"); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMark.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMark.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMark.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -41,4 +41,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMeter.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMeter.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMeter.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -14,6 +14,8 @@ */ package com.gargoylesoftware.htmlunit.html; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_DISPLAY_DEFAULT; + import java.util.Map; import com.gargoylesoftware.htmlunit.SgmlPage; @@ -24,6 +26,7 @@ * @see <a href="https://developer.mozilla.org/en-US/docs/HTML/Element/meter">MDN documentation</a> * @version $Revision$ * @author Marc Guillemot + * @author Ronald Brill */ public class HtmlMeter extends HtmlMedia { @@ -42,4 +45,19 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + if (hasFeature(CSS_DISPLAY_DEFAULT)) { + return DisplayStyle.INLINE_BLOCK; + } + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMultiColumn.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMultiColumn.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMultiColumn.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlMultiColumn extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNextId.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNextId.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNextId.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.html; + +import java.util.Map; + +import com.gargoylesoftware.htmlunit.SgmlPage; + +/** + * Wrapper for the HTML element "nextId". + * + * @version $Revision$ + * @author Ronald Brill + */ +public class HtmlNextId extends HtmlElement { + + /** The HTML tag represented by this element. */ + public static final String TAG_NAME = "nextid"; + + /** + * Creates a new instance. + * + * @param namespaceURI the URI that identifies an XML namespace + * @param qualifiedName the qualified name of the element type to instantiate + * @param page the page that contains this element + * @param attributes the initial attributes + */ + HtmlNextId(final String namespaceURI, final String qualifiedName, final SgmlPage page, + final Map<String, DomAttr> attributes) { + super(namespaceURI, qualifiedName, page, attributes); + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNextId.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoBreak.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoBreak.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoBreak.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -23,6 +23,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlNoBreak extends HtmlElement { @@ -41,4 +42,16 @@ final Map<String, DomAttr> attributes) { super(namespaceURI, qualifiedName, page, attributes); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoScript.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoScript.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoScript.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -14,6 +14,7 @@ */ package com.gargoylesoftware.htmlunit.html; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_DISPLAY_DEFAULT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.NOSCRIPT_BODY_AS_TEXT; import java.util.Map; @@ -31,6 +32,7 @@ * @author David K. Taylor * @author <a href="mailto:cs...@dy...">Christian Sell</a> * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlNoScript extends HtmlElement { @@ -59,4 +61,22 @@ } return null; } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + if (!getPage().getWebClient().getOptions().isJavaScriptEnabled()) { + return DisplayStyle.BLOCK; + } + if (hasFeature(CSS_DISPLAY_DEFAULT)) { + return DisplayStyle.NONE; + } + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlObject.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlObject.java 2013-12-20 15:54:23 UTC (rev 8881) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlObject.java 2013-12-20 16:01:24 UTC (rev 8882) @@ -27,6 +27,7 @@ * @author David K. Taylor * @author <a href="mailto:cs...@dy...">Christian Sell</a> * @author Ahmed Ashour + * @author Ronald Brill */ public class HtmlObject extends HtmlElement { @@ -255,4 +256,16 @@ public final String getVspaceAttribute() { return getAttribute("vspace"); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } } Modified: trunk/htmlunit/src/main/java/com/gargoyle... [truncated message content] |
From: <rb...@us...> - 2013-12-20 19:52:09
|
Revision: 8884 http://sourceforge.net/p/htmlunit/code/8884 Author: rbri Date: 2013-12-20 19:52:06 +0000 (Fri, 20 Dec 2013) Log Message: ----------- next step, ObjectsTest are running with FF17/24 now Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLElementsTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ObjectsTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOutput.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLOutputElement.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-20 16:02:42 UTC (rev 8883) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-20 19:52:06 UTC (rev 8884) @@ -83,7 +83,8 @@ HtmlNav.TAG_NAME, HtmlNextId.TAG_NAME, HtmlNoBreak.TAG_NAME, HtmlNoEmbed.TAG_NAME, HtmlNoFrames.TAG_NAME, HtmlNoScript.TAG_NAME, HtmlObject.TAG_NAME, HtmlOrderedList.TAG_NAME, - HtmlOptionGroup.TAG_NAME, HtmlOption.TAG_NAME, HtmlParagraph.TAG_NAME, + HtmlOptionGroup.TAG_NAME, HtmlOption.TAG_NAME, HtmlOutput.TAG_NAME, + HtmlParagraph.TAG_NAME, HtmlParameter.TAG_NAME, HtmlPlainText.TAG_NAME, HtmlPreformattedText.TAG_NAME, HtmlProgress.TAG_NAME, HtmlRp.TAG_NAME, HtmlRt.TAG_NAME, HtmlRuby.TAG_NAME, @@ -469,6 +470,14 @@ else if (tagName.equals(HtmlOrderedList.TAG_NAME)) { element = new HtmlOrderedList(namespaceURI, qualifiedName, page, attributeMap); } + else if (tagName.equals(HtmlOutput.TAG_NAME)) { + if (page.getWebClient().getBrowserVersion().hasFeature(HTML5_TAGS)) { + element = new HtmlOutput(namespaceURI, qualifiedName, page, attributeMap); + } + else { + return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes); + } + } else if (tagName.equals(HtmlParagraph.TAG_NAME)) { element = new HtmlParagraph(namespaceURI, qualifiedName, page, attributeMap); } Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOutput.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOutput.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOutput.java 2013-12-20 19:52:06 UTC (rev 8884) @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.html; + +import java.util.Map; + +import com.gargoylesoftware.htmlunit.SgmlPage; + +/** + * Wrapper for the HTML element "output". + * + * @version $Revision$ + * @author Ronald Brill + */ +public class HtmlOutput extends HtmlElement { + + /** The HTML tag represented by this element. */ + public static final String TAG_NAME = "output"; + + /** + * Creates a new instance. + * + * @param namespaceURI the URI that identifies an XML namespace + * @param qualifiedName the qualified name of the element type to instantiate + * @param page the page that contains this element + * @param attributes the initial attributes + */ + HtmlOutput(final String namespaceURI, final String qualifiedName, final SgmlPage page, + final Map<String, DomAttr> attributes) { + super(namespaceURI, qualifiedName, page, attributes); + } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOutput.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java 2013-12-20 16:02:42 UTC (rev 8883) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java 2013-12-20 19:52:06 UTC (rev 8884) @@ -170,6 +170,7 @@ import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLOptGroupElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLOptionElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLOptionsCollection; +import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLOutputElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLParagraphElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLParamElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLPhraseElement; @@ -313,7 +314,8 @@ HTMLNoShowElement.class, HTMLNextIdElement.class, HTMLOListElement.class, HTMLObjectElement.class, HTMLOptGroupElement.class, - HTMLOptionElement.class, HTMLOptionsCollection.class, HTMLParagraphElement.class, HTMLParamElement.class, + HTMLOptionElement.class, HTMLOptionsCollection.class, HTMLOutputElement.class, + HTMLParagraphElement.class, HTMLParamElement.class, HTMLPhraseElement.class, HTMLPreElement.class, HTMLProgressElement.class, HTMLScriptElement.class, HTMLSelectElement.class, HTMLSourceElement.class, HTMLSpanElement.class, Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLOutputElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLOutputElement.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLOutputElement.java 2013-12-20 19:52:06 UTC (rev 8884) @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.javascript.host.html; + +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; + +import com.gargoylesoftware.htmlunit.html.HtmlOutput; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; +import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; + +/** + * The JavaScript object "HTMLOutputElement". + * + * @version $Revision$ + * @author Ronald Brill + */ +@JsxClass(domClass = HtmlOutput.class, browsers = { @WebBrowser(value = FF, minVersion = 16), @WebBrowser(CHROME) }) +public class HTMLOutputElement extends HTMLElement { + // nothing so far +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLOutputElement.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java 2013-12-20 16:02:42 UTC (rev 8883) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java 2013-12-20 19:52:06 UTC (rev 8884) @@ -104,7 +104,8 @@ "HtmlNav", "HtmlNextId", "HtmlNoBreak", "HtmlNoEmbed", "HtmlNoFrames", "HtmlNoScript", "HtmlObject", "HtmlOrderedList", - "HtmlOptionGroup", "HtmlOption", "HtmlParagraph", + "HtmlOptionGroup", "HtmlOption", "HtmlOutput", + "HtmlParagraph", "HtmlParameter", "HtmlPlainText", "HtmlPreformattedText", "HtmlProgress", "HtmlRp", "HtmlRt", "HtmlRuby", Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLElementsTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLElementsTest.java 2013-12-20 16:02:42 UTC (rev 8883) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLElementsTest.java 2013-12-20 19:52:06 UTC (rev 8884) @@ -862,6 +862,17 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = "1", + IE8 = "0") + @NotYetImplemented(IE8) + public void elementClosesItself_output() throws Exception { + loadPageWithAlerts2(elementClosesItself("output")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts("0") public void elementClosesItself_p() throws Exception { loadPageWithAlerts2(elementClosesItself("p")); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java 2013-12-20 16:02:42 UTC (rev 8883) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java 2013-12-20 19:52:06 UTC (rev 8884) @@ -1154,6 +1154,17 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = { "3", "2", "2", "3", "2", "2" }, + IE8 = { "2", "2", "2", "4", "4", "3" }) + @NotYetImplemented(IE8) + public void childNodes_output() throws Exception { + loadPageWithAlerts2(createHtmlForChildNodes("output")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = { "1", "0", "1", "1", "0", "1" }, IE8 = { "0", "0", "0", "0", "0", "0" }) public void childNodes_p() throws Exception { Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ObjectsTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ObjectsTest.java 2013-12-20 16:02:42 UTC (rev 8883) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ObjectsTest.java 2013-12-20 19:52:06 UTC (rev 8884) @@ -99,8 +99,8 @@ // list.add(new Object[] {name, BrowserVersion.INTERNET_EXPLORER_8}); // list.add(new Object[] {name, BrowserVersion.INTERNET_EXPLORER_9}); // list.add(new Object[] {name, BrowserVersion.INTERNET_EXPLORER_11}); -// list.add(new Object[] {name, BrowserVersion.FIREFOX_17}); -// list.add(new Object[] {name, BrowserVersion.FIREFOX_24}); + list.add(new Object[] {name, BrowserVersion.FIREFOX_17}); + list.add(new Object[] {name, BrowserVersion.FIREFOX_24}); // list.add(new Object[] {name, BrowserVersion.CHROME}); } return list; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java 2013-12-20 16:02:42 UTC (rev 8883) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java 2013-12-20 19:52:06 UTC (rev 8884) @@ -3877,6 +3877,15 @@ * @throws Exception if the test fails */ @Test + @Alerts("<output></output>") + public void outerHTML_output() throws Exception { + loadPageWithAlerts2(outerHTML("output")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = "<p></p>", IE8 = "<P></P>") public void outerHTML_p() throws Exception { |
From: <rb...@us...> - 2013-12-20 20:46:51
|
Revision: 8885 http://sourceforge.net/p/htmlunit/code/8885 Author: rbri Date: 2013-12-20 20:46:46 +0000 (Fri, 20 Dec 2013) Log Message: ----------- first IE11 fixes (Frank Danek) Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoScript.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSelect.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NodeList.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/canvas/CanvasRenderingContext2D.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/StyleAttributes.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLCollection.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/HTMLStyleElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocument.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLSerializer.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLElementsTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/canvas/CanvasRenderingContext2DTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration3Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclarationTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMTokenListTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLCollection2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentWriteTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement3Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElement2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFrameElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLOptionElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLDocumentTest.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigureCaption.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -80,26 +80,32 @@ CSS_FONT_STRECH_DEFAULT_NORMAL, /** Indicates that the browser can surrounds image url's with quotes. */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) CSS_IMAGE_URL_QUOTED, - /** The default value of the display property for the 'keygen' tag is 'inline-block' - * instead of 'inline'. */ + /** The default value of the display property for the 'keygen' tag is 'inline-block' instead of the default one. */ @BrowserFeature(@WebBrowser(value = FF, minVersion = 24)) - CSS_KEYGEN_INLINE_BLOCK, + CSS_KEYGEN_DISPLAY_INLINE_BLOCK, + /** The default value of the display property for the 'noscript' tag is 'inline' instead of the default one. */ + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 8)) + CSS_NOSCRIPT_DISPLAY_INLINE, + /** Indicates that only integers are allowed for pixel value. */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) CSS_PIXEL_VALUES_INT_ONLY, + /** The default value of the display property for the 'script' tag is 'inline' instead of the default one. */ + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 8)) + CSS_SCRIPT_DISPLAY_INLINE, + /** Indicates that the :lang(..) selector is supported. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) CSS_SELECTOR_LANG, - /** The default value of the display property for the 'select' tag is 'inline' - * instead of 'inline-block'. */ + /** The default value of the display property for the 'select' tag is 'inline' instead of the default one. */ @BrowserFeature({ @WebBrowser(value = FF, maxVersion = 17), @WebBrowser(CHROME) }) - CSS_SELECT_INLINE, + CSS_SELECT_DISPLAY_INLINE, /** Throws exception on setting a CSS style value to null. */ @BrowserFeature(@WebBrowser(IE)) @@ -181,7 +187,7 @@ EVENT_ONERROR_EXTERNAL_JAVASCRIPT, /** Triggers "onload" event if external javascript successfully loaded. */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) EVENT_ONLOAD_EXTERNAL_JAVASCRIPT, /** Triggers "onload" event of the frameset before the one from the frames. */ @@ -209,7 +215,7 @@ EVENT_ONMOUSEUP_NOT_FOR_SELECT_OPTION, /** Triggers "onreadystatechange" event. */ - @BrowserFeature(@WebBrowser(IE)) + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) EVENT_ONREADY_STATE_CHANGE, /** Triggers "propertychange" event. */ @@ -334,10 +340,6 @@ /** Was originally .isIE(). */ @BrowserFeature(@WebBrowser(IE)) - GENERATED_48, - - /** Was originally .isIE(). */ - @BrowserFeature(@WebBrowser(IE)) GENERATED_49, /** Was originally .isIE(). */ @@ -464,8 +466,12 @@ @BrowserFeature({ @WebBrowser(IE), @WebBrowser(FF), @WebBrowser(CHROME) }) HTMLCOLLECTION_IDENTICAL_IDS, + /** HtmlCollection returns null instead of undefined if an element was not found. */ + @BrowserFeature(@WebBrowser(IE)) + HTMLCOLLECTION_NULL_IF_NOT_FOUND, + /** Allow detection of object type for collection elements. */ - @BrowserFeature(@WebBrowser(IE)) + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) HTMLCOLLECTION_OBJECT_DETECTION, /** @@ -564,6 +570,10 @@ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) HTMLTEXTAREA_SET_DEFAULT_VALUE_UPDATES_VALUE, + /** HTML attributes are always lower case. */ + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, maxVersion = 10) }) + HTML_ATTRIBUTE_LOWER_CASE, + /** Adds CData nodes as Comment elements to the DOM. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) HTML_CDATA_AS_COMMENT, @@ -714,7 +724,7 @@ JS_DEFERRED, /** Object prototype supports <tt>__defineGetter__</tt> and similar properties. */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) JS_DEFINE_GETTER, /** Indicates that HTMLDefinition...Elements returning 'HTMLElement' @@ -742,7 +752,7 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_DOCUMENT_APPEND_CHILD_SUPPORTED, - /** Document instead of HTMLDocument or XMLDocument. */ + /** Document instead of HTMLDocument. */ @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) JS_DOCUMENT_CLASS_NAME, @@ -783,7 +793,7 @@ JS_DOMIMPLEMENTATION_FEATURE_CORE_1, /** If document.implementation.hasFeature() supports 'CSS2 2.0'. */ - @BrowserFeature(@WebBrowser(FF)) + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) JS_DOMIMPLEMENTATION_FEATURE_CSS2_2, /** If document.implementation.hasFeature() supports 'CSS 2.0'. */ @@ -928,7 +938,7 @@ JS_GET_ATTRIBUTE_SUPPORTS_FLAGS_IN_QUIRKS_MODE, /** Javascript function getBackgroundColor of computed styles returns the color as rgb. */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) JS_GET_BACKGROUND_COLOR_FOR_COMPUTED_STYLE_AS_RGB, /** Javascript function getElementsByName returns an empty collection if called with empty string. */ @@ -1003,7 +1013,7 @@ JS_INNER_HTML_REDUCE_WHITESPACES, /** Javascript function returning a length (e.g. getWidth) without 'px' at the end. */ - @BrowserFeature(@WebBrowser(IE)) + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 10)) JS_LENGTH_WITHOUT_PX, /** @@ -1110,7 +1120,7 @@ JS_SCRIPT_SUPPORTS_FOR_AND_EVENT, /** Javascript script object supports the onreadystatechange event (IE). */ - @BrowserFeature(@WebBrowser(IE)) + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_SCRIPT_SUPPORTS_ONREADYSTATECHANGE, /** If true the content of a selection is it's default value instead of toString. */ @@ -1150,6 +1160,14 @@ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_STYLE_GET_ATTRIBUTE_SUPPORTS_FLAGS, + /** Indicates if style.removeAttribute supports a (second) flags argument. */ + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) + JS_STYLE_REMOVE_ATTRIBUTE_SUPPORTS_FLAGS, + + /** Indicates if style.setAttribute supports a (second) flags argument. */ + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) + JS_STYLE_SET_ATTRIBUTE_SUPPORTS_FLAGS, + /** IE supports accessing unsupported style elements via getter * like val = elem.style.htmlunit;. */ @@ -1270,14 +1288,18 @@ JS_XML, /** Indicates that new XMLSerializer().serializeToString(..) adds the xhtml namespace to the root element. */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) JS_XML_SERIALIZER_ADD_XHTML_NAMESPACE, /** Indicates that new XMLSerializer().serializeToString(..) always appends a CRLF at the end * of the produced string. */ - @BrowserFeature(@WebBrowser(IE)) + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_XML_SERIALIZER_APPENDS_CRLF, + /** Indicates that new XMLSerializer().serializeToString(..) inserts a blank before self-closing a tag. */ + @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) + JS_XML_SERIALIZER_BLANK_BEFORE_SELF_CLOSING, + /** Indicates that new XMLSerializer().serializeToString(..) respects the XHTML definition for non empty tags. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) JS_XML_SERIALIZER_NON_EMPTY_TAGS, @@ -1438,15 +1460,16 @@ XHR_IGNORE_SAME_ORIGIN_TO_ABOUT, /** Indicates that the onreadystatechange handler is triggered for sync requests for COMPLETED (4). */ - @BrowserFeature({ @WebBrowser(value = FF, minVersion = 10), @WebBrowser(CHROME) }) + @BrowserFeature({ @WebBrowser(value = FF, minVersion = 10), @WebBrowser(CHROME), + @WebBrowser(value = IE, minVersion = 11) }) XHR_ONREADYSTATECANGE_SYNC_REQUESTS_COMPLETED, /** Indicates that the onreadystatechange handler is not triggered for sync requests. */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) XHR_ONREADYSTATECANGE_SYNC_REQUESTS_NOT_TRIGGERED, /** Indicates that the onreadystatechange handler is triggered with an event parameter (FF). */ - @BrowserFeature(@WebBrowser(FF)) + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) XHR_ONREADYSTATECHANGE_WITH_EVENT_PARAM, /** Indicates if an empty url is allowed as url param for the open method. */ Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -67,7 +67,7 @@ HtmlDivision.TAG_NAME, HtmlDefinitionList.TAG_NAME, HtmlDefinitionTerm.TAG_NAME, HtmlEmbed.TAG_NAME, HtmlEmphasis.TAG_NAME, - HtmlFieldSet.TAG_NAME, HtmlFigure.TAG_NAME, + HtmlFieldSet.TAG_NAME, HtmlFigureCaption.TAG_NAME, HtmlFigure.TAG_NAME, HtmlFont.TAG_NAME, HtmlForm.TAG_NAME, HtmlFooter.TAG_NAME, HtmlFrame.TAG_NAME, HtmlFrameSet.TAG_NAME, HtmlHead.TAG_NAME, HtmlHeader.TAG_NAME, @@ -301,6 +301,14 @@ return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes); } } + else if (tagName.equals(HtmlFigureCaption.TAG_NAME)) { + if (page.getWebClient().getBrowserVersion().hasFeature(HTML5_TAGS)) { + element = new HtmlFigureCaption(namespaceURI, qualifiedName, page, attributeMap); + } + else { + return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes); + } + } else if (tagName.equals(HtmlFont.TAG_NAME)) { element = new HtmlFont(namespaceURI, qualifiedName, page, attributeMap); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java 2013-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -15,6 +15,7 @@ package com.gargoylesoftware.htmlunit.html; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.DOCTYPE_IS_COMMENT; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTML_ATTRIBUTE_LOWER_CASE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTML_CDATA_AS_COMMENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCONDITIONAL_COMMENTS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLIFRAME_IGNORE_SELFCLOSING; @@ -446,6 +447,9 @@ try { setFeature(FEATURE_AUGMENTATIONS, true); setProperty("http://cyberneko.org/html/properties/names/elems", "default"); + if (!webClient.getBrowserVersion().hasFeature(HTML_ATTRIBUTE_LOWER_CASE)) { + setProperty("http://cyberneko.org/html/properties/names/attrs", "no-change"); + } setFeature("http://cyberneko.org/html/features/report-errors", reportErrors); setFeature(FEATURE_PARSE_NOSCRIPT, !webClient.getOptions().isJavaScriptEnabled()); setFeature(HTMLScanner.ALLOW_SELFCLOSING_IFRAME, Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigureCaption.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigureCaption.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigureCaption.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.html; + +import java.util.Map; + +import com.gargoylesoftware.htmlunit.SgmlPage; + +/** + * Wrapper for the HTML element "figcaption". + * + * @version $Revision$ + * @author Frank Danek + */ +public class HtmlFigureCaption extends HtmlElement { + + /** The HTML tag represented by this element. */ + public static final String TAG_NAME = "figcaption"; + + /** + * Creates a new instance. + * + * @param namespaceURI the URI that identifies an XML namespace + * @param qualifiedName the qualified name of the element type to instantiate + * @param page the page that contains this element + * @param attributes the initial attributes + */ + HtmlFigureCaption(final String namespaceURI, final String qualifiedName, final SgmlPage page, + final Map<String, DomAttr> attributes) { + super(namespaceURI, qualifiedName, page, attributes); + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigureCaption.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoScript.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoScript.java 2013-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoScript.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -14,7 +14,7 @@ */ package com.gargoylesoftware.htmlunit.html; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_DISPLAY_DEFAULT; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_NOSCRIPT_DISPLAY_INLINE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.NOSCRIPT_BODY_AS_TEXT; import java.util.Map; @@ -33,6 +33,7 @@ * @author <a href="mailto:cs...@dy...">Christian Sell</a> * @author Ahmed Ashour * @author Ronald Brill + * @author Frank Danek */ public class HtmlNoScript extends HtmlElement { @@ -74,9 +75,9 @@ if (!getPage().getWebClient().getOptions().isJavaScriptEnabled()) { return DisplayStyle.BLOCK; } - if (hasFeature(CSS_DISPLAY_DEFAULT)) { - return DisplayStyle.NONE; + if (hasFeature(CSS_NOSCRIPT_DISPLAY_INLINE)) { + return DisplayStyle.INLINE; } - return DisplayStyle.INLINE; + return DisplayStyle.NONE; } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java 2013-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -14,7 +14,7 @@ */ package com.gargoylesoftware.htmlunit.html; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_DISPLAY_DEFAULT; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_SCRIPT_DISPLAY_INLINE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONERROR_EXTERNAL_JAVASCRIPT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONLOAD_EXTERNAL_JAVASCRIPT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONREADY_STATE_CHANGE; @@ -72,6 +72,7 @@ * @author Sudhan Moghe * @author Ronald Brill * @author Daniel Wagner-Hall + * @author Frank Danek * @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-81598695">DOM Level 1</a> * @see <a href="http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-81598695">DOM Level 2</a> */ @@ -619,9 +620,9 @@ */ @Override public DisplayStyle getDefaultStyleDisplay() { - if (hasFeature(CSS_DISPLAY_DEFAULT)) { - return DisplayStyle.NONE; + if (hasFeature(CSS_SCRIPT_DISPLAY_INLINE)) { + return DisplayStyle.INLINE; } - return DisplayStyle.INLINE; + return DisplayStyle.NONE; } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSelect.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSelect.java 2013-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSelect.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -14,7 +14,7 @@ */ package com.gargoylesoftware.htmlunit.html; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_DISPLAY_DEFAULT; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.CSS_SELECT_DISPLAY_INLINE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.SELECT_DESELECT_ALL_IF_SWITCHING_UNKNOWN; import java.util.ArrayList; @@ -46,6 +46,7 @@ * @author Daniel Gredler * @author Ahmed Ashour * @author Ronald Brill + * @author Frank Danek */ public class HtmlSelect extends HtmlElement implements DisabledElement, SubmittableElement, FormFieldWithNameHistory { @@ -630,7 +631,7 @@ */ @Override public DisplayStyle getDefaultStyleDisplay() { - if (hasFeature(CSS_DISPLAY_DEFAULT)) { + if (hasFeature(CSS_SELECT_DISPLAY_INLINE)) { return DisplayStyle.INLINE; } return DisplayStyle.INLINE_BLOCK; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java 2013-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -663,7 +663,7 @@ * @see <a href="http://msdn.microsoft.com/en-us/library/ms536343.aspx">MSDN documentation</a> * @see #addEventListener(String, Function, boolean) */ - @JsxFunction(@WebBrowser(IE)) + @JsxFunction(@WebBrowser(value = IE, maxVersion = 9)) public boolean attachEvent(final String type, final Function listener) { return getEventListenersContainer().addEventListener(StringUtils.substring(type, 2), listener, false); } @@ -968,7 +968,7 @@ * Represents the xml content of the node and its descendants. * @return the xml content of the node and its descendants */ - @JsxGetter(@WebBrowser(IE)) + @JsxGetter(@WebBrowser(value = IE, maxVersion = 9)) public Object getXml() { final DomNode node = getDomNodeOrDie(); if (node.getPage() instanceof XmlPage) { Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NodeList.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NodeList.java 2013-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NodeList.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -14,7 +14,7 @@ */ package com.gargoylesoftware.htmlunit.javascript.host; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_48; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCOLLECTION_NULL_IF_NOT_FOUND; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_49; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_50; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCOLLECTION_COMMENT_IS_ELEMENT; @@ -60,6 +60,7 @@ * @author Marc Guillemot * @author Chris Erskine * @author Ahmed Ashour + * @author Frank Danek */ @JsxClass public class NodeList extends SimpleScriptable implements Function, org.w3c.dom.NodeList { @@ -372,7 +373,7 @@ */ private Object nullIfNotFound(final Object object) { if (object == NOT_FOUND) { - if (getBrowserVersion().hasFeature(GENERATED_48)) { + if (getBrowserVersion().hasFeature(HTMLCOLLECTION_NULL_IF_NOT_FOUND)) { return null; } return Context.getUndefinedValue(); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/canvas/CanvasRenderingContext2D.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/canvas/CanvasRenderingContext2D.java 2013-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/canvas/CanvasRenderingContext2D.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -14,6 +14,7 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.canvas; +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import net.sourceforge.htmlunit.corejs.javascript.Context; import net.sourceforge.htmlunit.corejs.javascript.Function; import net.sourceforge.htmlunit.corejs.javascript.Scriptable; @@ -23,6 +24,7 @@ import com.gargoylesoftware.htmlunit.javascript.configuration.JsxFunction; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; +import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; /** * A JavaScript object for a CanvasRenderingContext2D. @@ -30,6 +32,7 @@ * @version $Revision$ * @author Ahmed Ashour * @author Marc Guillemot + * @author Frank Danek */ @JsxClass public class CanvasRenderingContext2D extends SimpleScriptable { @@ -44,26 +47,6 @@ } /** - * Changes the transformation matrix to apply a translation transformation with the given characteristics. - * @param x the translation distance in the horizontal direction - * @param y the translation distance in the vertical direction - */ - @JsxFunction - public void translate(final Object x, final Object y) { - // empty - } - - /** - * Changes the transformation matrix to apply a scaling transformation with the given characteristics. - * @param x the scale factor in the horizontal direction - * @param y the scale factor in the vertical direction - */ - @JsxFunction - public void scale(final Object x, final Object y) { - //empty - } - - /** * Sets the "fillStyle" property. * @param fillStyle the "fillStyle" property */ @@ -127,42 +110,35 @@ } /** - * Clears the specified rectangular area. + * Draws an arc. * @param x the x * @param y the y - * @param w the width - * @param h the height + * @param radius the radius + * @param startAngle the start angle + * @param endAngle the end angle + * @param anticlockwise is anti-clockwise */ @JsxFunction - public void clearRect(final double x, final double y, final double w, final double h) { + public void arc(final double x, final double y, final double radius, final double startAngle, + final double endAngle, final boolean anticlockwise) { //empty } /** - * Paints the specified rectangular area. - * @param x the x - * @param y the y - * @param w the width - * @param h the height + * Draws an arc. + * @param x1 the x1 + * @param y1 the y1 + * @param x2 the x2 + * @param y2 the y2 + * @param radius the radius */ @JsxFunction - public void fillRect(final double x, final double y, final double w, final double h) { + public void arcTo(final double x1, final double y1, final double x2, final double y2, + final double radius) { //empty } /** - * Strokes the specified rectangular area. - * @param x the x - * @param y the y - * @param w the width - * @param h the height - */ - @JsxFunction - public void strokeRect(final double x, final double y, final double w, final double h) { - //empty - } - - /** * Begins the subpaths. */ @JsxFunction @@ -171,46 +147,53 @@ } /** - * Closes the subpaths. + * Draws a cubic Bézier curve. + * @param cp1x the cp1x + * @param cp1y the cp1y + * @param cp2x the cp2x + * @param cp2y the cp2y + * @param x the x + * @param y the y */ @JsxFunction - public void closePath() { + public void bezierCurveTo(final double cp1x, final double cp1y, final double cp2x, final double cp2y, + final double x, final double y) { //empty } /** - * Creates a new subpath. + * Clears the specified rectangular area. * @param x the x * @param y the y + * @param w the width + * @param h the height */ @JsxFunction - public void moveTo(final double x, final double y) { + public void clearRect(final double x, final double y, final double w, final double h) { //empty } /** - * Connect the last point to the given point. - * @param x the x - * @param y the y + * Creates a new clipping region. */ @JsxFunction - public void lineTo(final double x, final double y) { + public void clip() { //empty } /** - * Pushes state on state stack. + * Closes the subpaths. */ @JsxFunction - public void save() { + public void closePath() { //empty } /** - * Pops state stack and restore state. + * Creates a new, blank ImageData object with the specified dimensions. */ @JsxFunction - public void restore() { + public void createImageData() { //empty } @@ -230,120 +213,101 @@ } /** - * Draws an arc. - * @param x the x - * @param y the y - * @param radius the radius - * @param startAngle the start angle - * @param endAngle the end angle - * @param anticlockwise is anti-clockwise + * Creates a pattern. */ @JsxFunction - public void arc(final double x, final double y, final double radius, final double startAngle, - final double endAngle, final boolean anticlockwise) { + public void createPattern() { //empty } /** - * Draws an arc. - * @param x1 the x1 - * @param y1 the y1 - * @param x2 the x2 - * @param y2 the y2 - * @param radius the radius + * Creates a gradient. */ @JsxFunction - public void arcTo(final double x1, final double y1, final double x2, final double y2, - final double radius) { + public void createRadialGradient() { //empty } /** - * Draws a cubic Bézier curve. - * @param cp1x the cp1x - * @param cp1y the cp1y - * @param cp2x the cp2x - * @param cp2y the cp2y - * @param x the x - * @param y the y + * Draws images onto the canvas. + * @param context the JavaScript context + * @param thisObj the scriptable + * @param args the arguments passed into the method + * @param function the function */ @JsxFunction - public void bezierCurveTo(final double cp1x, final double cp1y, final double cp2x, final double cp2y, - final double x, final double y) { + public static void drawImage( + final Context context, final Scriptable thisObj, final Object[] args, final Function function) { //empty } /** - * Draws a quadratic Bézier curve. - * @param controlPointX the x-coordinate of the control point - * @param controlPointY the y-coordinate of the control point - * @param endPointX the x-coordinate of the end point - * @param endPointY the y-coordinate of the end point + * Fills the shape. */ @JsxFunction - public void quadraticCurveTo(final double controlPointX, final double controlPointY, - final double endPointX, final double endPointY) { + public void fill() { //empty } /** - * Fills the shape. + * Paints the specified rectangular area. + * @param x the x + * @param y the y + * @param w the width + * @param h the height */ @JsxFunction - public void fill() { + public void fillRect(final double x, final double y, final double w, final double h) { //empty } /** - * Calculates the strokes of all the subpaths of the current path. + * Dummy placeholder. */ @JsxFunction - public void stroke() { + public void fillText() { //empty } /** - * Creates a new clipping region. + * Dummy placeholder. */ @JsxFunction - public void clip() { + public void getImageData() { //empty } /** - * Draws images onto the canvas. - * @param context the JavaScript context - * @param thisObj the scriptable - * @param args the arguments passed into the method - * @param function the function + * Dummy placeholder. */ - @JsxFunction - public static void drawImage( - final Context context, final Scriptable thisObj, final Object[] args, final Function function) { + @JsxFunction(@WebBrowser(IE)) + public void getLineDash() { //empty } /** - * Creates a new, blank ImageData object with the specified dimensions. + * Dummy placeholder. */ @JsxFunction - public void createImageData() { + public void getLineData() { //empty } /** - * Creates a pattern. + * Dummy placeholder. */ @JsxFunction - public void createPattern() { + public void isPointInPath() { //empty } /** - * Creates a gradient. + * Connect the last point to the given point. + * @param x the x + * @param y the y */ @JsxFunction - public void createRadialGradient() { + public void lineTo(final double x, final double y) { //empty } @@ -351,15 +315,17 @@ * Dummy placeholder. */ @JsxFunction - public void fillText() { + public void measureText() { //empty } /** - * Dummy placeholder. + * Creates a new subpath. + * @param x the x + * @param y the y */ @JsxFunction - public void getImageData() { + public void moveTo(final double x, final double y) { //empty } @@ -367,15 +333,20 @@ * Dummy placeholder. */ @JsxFunction - public void getLineData() { + public void putImageData() { //empty } /** - * Dummy placeholder. + * Draws a quadratic Bézier curve. + * @param controlPointX the x-coordinate of the control point + * @param controlPointY the y-coordinate of the control point + * @param endPointX the x-coordinate of the end point + * @param endPointY the y-coordinate of the end point */ @JsxFunction - public void isPointInPath() { + public void quadraticCurveTo(final double controlPointX, final double controlPointY, + final double endPointX, final double endPointY) { //empty } @@ -383,15 +354,15 @@ * Dummy placeholder. */ @JsxFunction - public void measureText() { + public void rect() { //empty } /** - * Dummy placeholder. + * Pops state stack and restore state. */ @JsxFunction - public void putImageData() { + public void restore() { //empty } @@ -399,27 +370,65 @@ * Dummy placeholder. */ @JsxFunction - public void rect() { + public void rotate() { //empty } /** - * Dummy placeholder. + * Pushes state on state stack. */ @JsxFunction - public void rotate() { + public void save() { //empty } /** + * Changes the transformation matrix to apply a scaling transformation with the given characteristics. + * @param x the scale factor in the horizontal direction + * @param y the scale factor in the vertical direction + */ + @JsxFunction + public void scale(final Object x, final Object y) { + //empty + } + + /** * Dummy placeholder. */ + @JsxFunction(@WebBrowser(IE)) + public void setLineDash() { + //empty + } + + /** + * Dummy placeholder. + */ @JsxFunction public void setTransform() { //empty } /** + * Calculates the strokes of all the subpaths of the current path. + */ + @JsxFunction + public void stroke() { + //empty + } + + /** + * Strokes the specified rectangular area. + * @param x the x + * @param y the y + * @param w the width + * @param h the height + */ + @JsxFunction + public void strokeRect(final double x, final double y, final double w, final double h) { + //empty + } + + /** * Dummy placeholder. */ @JsxFunction @@ -434,4 +443,14 @@ public void transform() { //empty } + + /** + * Changes the transformation matrix to apply a translation transformation with the given characteristics. + * @param x the translation distance in the horizontal direction + * @param y the translation distance in the vertical direction + */ + @JsxFunction + public void translate(final Object x, final Object y) { + // empty + } } 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-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -24,6 +24,8 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_GET_BACKGROUND_COLOR_FOR_COMPUTED_STYLE_AS_RGB; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_OPACITY_ACCEPTS_ARBITRARY_VALUES; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_STYLE_GET_ATTRIBUTE_SUPPORTS_FLAGS; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_STYLE_REMOVE_ATTRIBUTE_SUPPORTS_FLAGS; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_STYLE_SET_ATTRIBUTE_SUPPORTS_FLAGS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_STYLE_UNSUPPORTED_PROPERTY_GETTER; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; @@ -942,7 +944,7 @@ * Gets the object's behavior (IE only). * @return the object's behavior */ - @JsxGetter(@WebBrowser(IE)) + @JsxGetter(@WebBrowser(value = IE, maxVersion = 10)) public String getBehavior() { return getStyleAttribute(BEHAVIOR); } @@ -951,7 +953,7 @@ * Sets the object's behavior (IE only). * @param behavior the new behavior */ - @JsxSetter(@WebBrowser(IE)) + @JsxSetter(@WebBrowser(value = IE, maxVersion = 10)) public void setBehavior(final String behavior) { setStyleAttribute(BEHAVIOR, behavior); @@ -2896,6 +2898,24 @@ } /** + * Gets the "pixelHeight" style attribute. + * @return the style attribute + */ + @JsxGetter(@WebBrowser(value = IE, minVersion = 11)) + public int getPixelHeight() { + return pixelValue(getHeight()); + } + + /** + * Sets the "pixelHeight" style attribute. + * @param pixelHeight the new attribute + */ + @JsxSetter(@WebBrowser(value = IE, minVersion = 11)) + public void setPixelHeight(final int pixelHeight) { + setHeight(pixelHeight + "px"); + } + + /** * Gets the "pixelLeft" style attribute. * @return the style attribute */ @@ -2950,6 +2970,24 @@ } /** + * Gets the "pixelWidth" style attribute. + * @return the style attribute + */ + @JsxGetter(@WebBrowser(value = IE, minVersion = 11)) + public int getPixelWidth() { + return pixelValue(getWidth()); + } + + /** + * Sets the "pixelWidth" style attribute. + * @param pixelWidth the new attribute + */ + @JsxSetter(@WebBrowser(value = IE, minVersion = 11)) + public void setPixelWidth(final int pixelWidth) { + setWidth(pixelWidth + "px"); + } + + /** * Gets the "posBottom" style attribute. * @return the style attribute */ @@ -4071,13 +4109,15 @@ */ @JsxFunction(@WebBrowser(IE)) public void setAttribute(final String name, final String value, final Object flag) { - int flagInt; - if (flag == Undefined.instance) { - flagInt = 1; + int flagInt = 0; + if (getBrowserVersion().hasFeature(JS_STYLE_SET_ATTRIBUTE_SUPPORTS_FLAGS)) { + if (flag == Undefined.instance) { + flagInt = 1; + } + else { + flagInt = (int) Context.toNumber(flag); + } } - else { - flagInt = (int) Context.toNumber(flag); - } if (flagInt == 0) { // Case-insensitive. final StyleElement style = getStyleElementCaseInSensitive(name); @@ -4103,13 +4143,15 @@ */ @JsxFunction(@WebBrowser(IE)) public boolean removeAttribute(final String name, final Object flag) { - int flagInt; - if (flag == Undefined.instance) { - flagInt = 1; + int flagInt = 0; + if (getBrowserVersion().hasFeature(JS_STYLE_REMOVE_ATTRIBUTE_SUPPORTS_FLAGS)) { + if (flag == Undefined.instance) { + flagInt = 1; + } + else { + flagInt = (int) Context.toNumber(flag); + } } - else { - flagInt = (int) Context.toNumber(flag); - } if (flagInt == 0) { // Case-insensitive. final StyleElement style = getStyleElementCaseInSensitive(name); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/StyleAttributes.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/StyleAttributes.java 2013-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/StyleAttributes.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -16,6 +16,7 @@ import static com.gargoylesoftware.htmlunit.javascript.host.css.BrowserConfiguration.ff; import static com.gargoylesoftware.htmlunit.javascript.host.css.BrowserConfiguration.ff17up; +import static com.gargoylesoftware.htmlunit.javascript.host.css.BrowserConfiguration.ff24up; import static com.gargoylesoftware.htmlunit.javascript.host.css.BrowserConfiguration.ffBelow17; import static com.gargoylesoftware.htmlunit.javascript.host.css.BrowserConfiguration.ie11up; import static com.gargoylesoftware.htmlunit.javascript.host.css.BrowserConfiguration.ie8up; @@ -249,6 +250,9 @@ /** The style property -moz-column-count. */ MOZ_COLUMN_COUNT("MozColumnCount", "-moz-column-count", ff("auto")), + /** The style property -moz-column-fill. */ + MOZ_COLUMN_FILL("MozColumnFill", "-moz-column-fill", ff24up("balance")), + /** The style property -moz-column-gap. */ MOZ_COLUMN_GAP("MozColumnGap", "-moz-column-gap", ff("16px")), @@ -304,7 +308,7 @@ MOZ_OPACITY("MozOpacity", "-moz-opacity", ffBelow17("1")), /** The style property -moz-orient. */ - MOZ_ORIENT("MozOrient", "-moz-orient", ff17up("horizontal")), + MOZ_ORIENT("MozOrient", "-moz-orient", ff24up("auto"), ff17up("horizontal")), /** The style property -moz-outline. */ MOZ_OUTLINE("MozOutline", "-moz-outline", ffBelow17("")), @@ -511,7 +515,7 @@ "-ms-content-zooming", ie11up("none")), /** The style property -ms-flex. */ - MS_FLEX("msFlex", "-ms-flex", ie11up("0 0 auto")), + MS_FLEX("msFlex", "-ms-flex", ie11up("0 1 auto")), /** The style property -ms-flex-align. */ MS_FLEX_ALIGN("msFlexAlign", "-ms-flex-align", ie11up("stretch")), @@ -529,7 +533,7 @@ MS_FLEX_LINE_PACK("msFlexLinePack", "-ms-flex-line-pack", ie11up("stretch")), /** The style property -ms-flex-negative. */ - MS_FLEX_NEGATIVE("msFlexNegative", "-ms-flex-negative", ie11up("0")), + MS_FLEX_NEGATIVE("msFlexNegative", "-ms-flex-negative", ie11up("1")), /** The style property -ms-flex-order. */ MS_FLEX_ORDER("msFlexOrder", "-ms-flex-order", ie11up("0")), @@ -595,6 +599,9 @@ /** The style property -ms-hyphens. */ MS_HYPHENS("msHyphens", "-ms-hyphens", ie11up("manual")), + /** The style property -ms-ime-align. */ + MS_IME_ALIGN("msImeAlign", "-ms-ime-align", ie11up("")), + /** The style property -ms-interpolation-mode. */ MS_INTERPOLATION_MODE("msInterpolationMode", "-ms-interpolation-mode", ie11up("undefined")), @@ -647,6 +654,9 @@ /** The style property -ms-scroll-translation. */ MS_SCROLL_TRANSLATION("msScrollTranslation", "-ms-scroll-translation", ie11up("none")), + /** The style property -ms-text-combine-horizontal. */ + MS_TEXT_COMBINE_HORIZONTAL("msTextCombineHorizontal", "-ms-text-combine-horizontal", ie11up("none")), + /** The style property -ms-touch-action. */ MS_TOUCH_ACTION("msTouchAction", "-ms-touch-action", ie11up("auto")), @@ -696,6 +706,15 @@ /** The style property -ms-wrap-through. */ MS_WRAP_THROUGH("msWrapThrough", "-ms-wrap-through", ie11up("wrap")), + /** The style property alignment-content. */ + ALIGN_CONTENT("alignContent", "align-content", ie11up("stretch")), + + /** The style property alignment-items. */ + ALIGN_ITEMS("alignItems", "align-items", ff24up("stretch"), ie11up("stretch")), + + /** The style property alignment-self. */ + ALIGN_SELF("alignSelf", "align-self", ff24up("stretch"), ie11up("auto")), + /** The style property alignment-baseline. */ ALIGNMENT_BASELINE("alignmentBaseline", "alignment-baseline", ie11up("auto")), @@ -765,7 +784,7 @@ BASELINE_SHIFT("baselineShift", "baseline-shift", ie11up("baseline")), /** The style property behavior. */ - BEHAVIOR("behavior", "behavior", ie11up("undefined")), + BEHAVIOR("behavior", "behavior"), /** The style property border-bottom-left-radius. */ BORDER_BOTTOM_LEFT_RADIUS("borderBottomLeftRadius", @@ -776,27 +795,27 @@ "border-bottom-right-radius", ff17up("0px"), ie11up("0px")), /** The style property border-image. */ - BORDER_IMAGE("borderImage", "border-image", ff17up("")), + BORDER_IMAGE("borderImage", "border-image", ff17up(""), ie11up("")), /** The style property border-image-outset. */ BORDER_IMAGE_OUTSET("borderImageOutset", "border-image-outset", - ff17up("0 0 0 0")), + ff17up("0 0 0 0"), ie11up("0")), /** The style property border-image-repeat. */ BORDER_IMAGE_REPEAT("borderImageRepeat", "border-image-repeat", - ff17up("stretch stretch")), + ff17up("stretch stretch"), ie11up("stretch")), /** The style property border-image-slice. */ BORDER_IMAGE_SLICE("borderImageSlice", "border-image-slice", - ff17up("100% 100% 100% 100%")), + ff17up("100% 100% 100% 100%"), ie11up("100%")), /** The style property border-image-source. */ BORDER_IMAGE_SOURCE("borderImageSource", "border-image-source", - ff17up("none")), + ff17up("none"), ie11up("none")), /** The style property border-image-width. */ BORDER_IMAGE_WIDTH("borderImageWidth", "border-image-width", - ff17up("1 1 1 1")), + ff17up("1 1 1 1"), ie11up("1")), /** The style property border-radius. */ BORDER_RADIUS("borderRadius", "border-radius", ff17up(""), ie11up("")), @@ -905,6 +924,27 @@ /** The style property filter. */ FILTER("filter", "filter", ff17up("none"), ieBelow11(""), ie11up("none")), + /** The style property flex. */ + FLEX("flex", "flex", ff24up(""), ie11up("0 1 auto")), + + /** The style property flex-basis. */ + FLEX_BASIS("flexBasis", "flex-basis", ff24up("auto"), ie11up("auto")), + + /** The style property flex-direction. */ + FLEX_DIRECTION("flexDirection", "flex-direction", ff24up("row"), ie11up("row")), + + /** The style property flex-flow. */ + FLEX_FLOW("flexFlow", "flex-flow", ie11up("row nowrap")), + + /** The style property flex-grow. */ + FLEX_GROW("flexGrow", "flex-grow", ff24up("0"), ie11up("0")), + + /** The style property flex-shrink. */ + FLEX_SHRINK("flexShrink", "flex-shrink", ff24up("1"), ie11up("1")), + + /** The style property flex-wrap. */ + FLEX_WRAP("flexWrap", "flex-wrap", ie11up("nowrap")), + /** The style property flood-color. */ FLOOD_COLOR("floodColor", "flood-color", ff17up("rgb(0, 0, 0)"), ie11up("")), @@ -929,6 +969,9 @@ /** The style property ime-mode. */ IME_MODE("imeMode", "ime-mode", ie11up("undefined")), + /** The style property ime-mode. */ + JUSTIFY_CONTENT("justifyContent", "justify-content", ff24up("flex-start"), ie11up("flex-start")), + /** The style property kerning. */ KERNING("kerning", "kerning", ie11up("auto")), @@ -976,6 +1019,9 @@ /** The style property mask. */ MASK("mask", "mask", ff17up("none"), ie11up("none")), + /** The style property order. */ + ORDER("order", "order", ff24up("0"), ie11up("0")), + /** The style property page-break-inside. */ ORPHANS("orphans", "orphans", ie11up("2")), @@ -983,7 +1029,7 @@ OUTLINE_COLOR("outlineColor", "outline-color", ie11up("transparent")), /** The style property page-break-inside. */ - PAGE_BREAK_INSIDE("pageBreakInside", "page-break-inside", ie11up("auto")), + PAGE_BREAK_INSIDE("pageBreakInside", "page-break-inside", ff24up("auto"), ie11up("auto")), /** The style property pause. */ PAUSE("pause", "pause", ffBelow17("")), @@ -1021,7 +1067,7 @@ RICHNESS("richness", "richness", ffBelow17("")), /** The style property ruby-align. */ - RUBY_ALIGN("rubyAlign", "ruby-align", ie11up("auto")), + RUBY_ALIGN("rubyAlign", "ruby-align"), /** The style property ruby-overhang. */ RUBY_OVERHANG("rubyOverhang", "ruby-overhang", ie11up("auto")), @@ -1142,6 +1188,9 @@ /** The style property text-underline-position. */ TEXT_UNDERLINE_POSITION("textUnderlinePosition", "text-underline-position", ie11up("auto")), + /** The style property touch-action. */ + TOUCH_ACTION("touchAction", "touch-action", ie11up("auto")), + /** The style property transform. */ TRANSFORM("transform", "transform", ff17up("none"), ie11up("none")), Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLCollection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLCollection.java 2013-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLCollection.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -14,7 +14,7 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.html; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_48; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCOLLECTION_NULL_IF_NOT_FOUND; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_50; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCOLLECTION_COMMENT_IS_ELEMENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCOLLECTION_IDENTICAL_IDS; @@ -54,6 +54,7 @@ * @author Marc Guillemot * @author Chris Erskine * @author Ahmed Ashour + * @author Frank Danek */ @JsxClass public class HTMLCollection extends NodeList { @@ -254,7 +255,7 @@ */ private Object nullIfNotFound(final Object object) { if (object == NOT_FOUND) { - if (getBrowserVersion().hasFeature(GENERATED_48)) { + if (getBrowserVersion().hasFeature(HTMLCOLLECTION_NULL_IF_NOT_FOUND)) { return null; } return Context.getUndefinedValue(); 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-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -1274,7 +1274,7 @@ * @param index where to insert the sheet in the collection * @return the newly created stylesheet */ - @JsxFunction(@WebBrowser(IE)) + @JsxFunction(@WebBrowser(value = IE, maxVersion = 9)) public CSSStyleSheet createStyleSheet(final String url, final Object index) { final HTMLLinkElement link = (HTMLLinkElement) createElement("link"); link.setHref(url); 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-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -96,6 +96,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlDivision; import com.gargoylesoftware.htmlunit.html.HtmlElement; import com.gargoylesoftware.htmlunit.html.HtmlFigure; +import com.gargoylesoftware.htmlunit.html.HtmlFigureCaption; import com.gargoylesoftware.htmlunit.html.HtmlFooter; import com.gargoylesoftware.htmlunit.html.HtmlFrameSet; import com.gargoylesoftware.htmlunit.html.HtmlHeader; @@ -164,6 +165,7 @@ @JsxClass(domClass = HtmlAside.class), @JsxClass(domClass = HtmlElement.class), @JsxClass(domClass = HtmlFigure.class), + @JsxClass(domClass = HtmlFigureCaption.class), @JsxClass(domClass = HtmlFooter.class), @JsxClass(domClass = HtmlHeader.class), @JsxClass(domClass = HtmlMark.class), @@ -407,7 +409,7 @@ * Returns the value of the "all" property. * @return the value of the "all" property */ - @JsxGetter(@WebBrowser(IE)) + @JsxGetter(@WebBrowser(value = IE, maxVersion = 9)) public HTMLCollection getAll() { if (all_ == null) { all_ = new HTMLCollection(getDomNodeOrDie(), false, "HTMLElement.all") { @@ -508,7 +510,7 @@ * Returns the document. * @return the document */ - @JsxGetter(@WebBrowser(IE)) + @JsxGetter(@WebBrowser(value = IE, maxVersion = 9)) public DocumentProxy getDocument() { return getWindow().getDocument_js(); } @@ -1303,7 +1305,7 @@ * @param behavior the URL of the behavior to add, or a default behavior name * @return an identifier that can be user later to detach the behavior from the element */ - @JsxFunction(@WebBrowser(IE)) + @JsxFunction(@WebBrowser(value = IE, maxVersion = 9)) public int addBehavior(final String behavior) { // if behavior already defined, then nothing to do if (behaviors_.contains(behavior)) { @@ -2226,7 +2228,7 @@ * Simulates a click on a scrollbar component (IE only). * @param scrollAction the type of scroll action to simulate */ - @JsxFunction(@WebBrowser(IE)) + @JsxFunction(@WebBrowser(value = IE, maxVersion = 9)) public void doScroll(final String scrollAction) { if (((HtmlPage) getDomNodeOrDie().getPage()).isBeingParsed()) { throw Context.reportRuntimeError("The data necessary to complete this operation is not yet available."); @@ -2849,7 +2851,8 @@ * Returns the "dataset" attribute. * @return the "dataset" attribute */ - @JsxGetter({ @WebBrowser(value = FF, minVersion = 10), @WebBrowser(CHROME) }) + @JsxGetter({ @WebBrowser(value = FF, minVersion = 10), @WebBrowser(CHROME), + @WebBrowser(value = IE, minVersion = 11) }) public DOMStringMap getDataset() { return new DOMStringMap(this); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java 2013-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -77,7 +77,7 @@ * Gets the associated sheet (IE). * @return the sheet */ - @JsxGetter(@WebBrowser(IE)) + @JsxGetter(@WebBrowser(value = IE, maxVersion = 9)) public CSSStyleSheet getStyleSheet() { return getSheet(); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableElement.java 2013-12-20 19:52:06 UTC (rev 8884) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableElement.java 2013-12-20 20:46:46 UTC (rev 8885) @@ -250,7 +250,7 @@ * @see <a href="http://msdn2.microsoft.com/en-us/library/ms536687.aspx"> * MSDN Documentation</a> */ - @JsxFunction(@WebBrowser(IE)) + @JsxFunction(@W... [truncated message content] |
From: <rb...@us...> - 2013-12-22 12:33:25
|
Revision: 8895 http://sourceforge.net/p/htmlunit/code/8895 Author: rbri Date: 2013-12-22 12:33:19 +0000 (Sun, 22 Dec 2013) Log Message: ----------- more javascript object fixes Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLPhraseElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSpanElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLElementsTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlKeygen.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTime.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLKeygenElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTimeElement.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-22 12:27:35 UTC (rev 8894) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java 2013-12-22 12:33:19 UTC (rev 8895) @@ -76,7 +76,9 @@ HtmlHorizontalRule.TAG_NAME, HtmlHtml.TAG_NAME, HtmlInlineFrame.TAG_NAME, HtmlInlineQuotation.TAG_NAME, HtmlImage.TAG_NAME, HtmlImage.TAG_NAME2, HtmlInsertedText.TAG_NAME, HtmlIsIndex.TAG_NAME, - HtmlItalic.TAG_NAME, HtmlKeyboard.TAG_NAME, HtmlLabel.TAG_NAME, + HtmlItalic.TAG_NAME, + HtmlKeyboard.TAG_NAME, HtmlKeygen.TAG_NAME, + HtmlLabel.TAG_NAME, HtmlLegend.TAG_NAME, HtmlListing.TAG_NAME, HtmlListItem.TAG_NAME, HtmlLink.TAG_NAME, HtmlMap.TAG_NAME, HtmlMark.TAG_NAME, HtmlMarquee.TAG_NAME, HtmlMenu.TAG_NAME, HtmlMeta.TAG_NAME, HtmlMeter.TAG_NAME, HtmlMultiColumn.TAG_NAME, @@ -96,7 +98,7 @@ HtmlTable.TAG_NAME, HtmlTableColumn.TAG_NAME, HtmlTableColumnGroup.TAG_NAME, HtmlTableBody.TAG_NAME, HtmlTableDataCell.TAG_NAME, HtmlTableHeaderCell.TAG_NAME, HtmlTableRow.TAG_NAME, HtmlTextArea.TAG_NAME, HtmlTableFooter.TAG_NAME, - HtmlTableHeader.TAG_NAME, HtmlTeletype.TAG_NAME, HtmlTitle.TAG_NAME, + HtmlTableHeader.TAG_NAME, HtmlTeletype.TAG_NAME, HtmlTime.TAG_NAME, HtmlTitle.TAG_NAME, HtmlUnderlined.TAG_NAME, HtmlUnorderedList.TAG_NAME, HtmlVariable.TAG_NAME, HtmlVideo.TAG_NAME, HtmlWordBreak.TAG_NAME, HtmlExample.TAG_NAME @@ -281,6 +283,9 @@ else if (tagName.equals(HtmlDeletedText.TAG_NAME)) { element = new HtmlDeletedText(namespaceURI, qualifiedName, page, attributeMap); } + else if (tagName.equals(HtmlDirectory.TAG_NAME)) { + element = new HtmlDirectory(namespaceURI, qualifiedName, page, attributeMap); + } else if (tagName.equals(HtmlDivision.TAG_NAME)) { element = new HtmlDivision(namespaceURI, qualifiedName, page, attributeMap); } @@ -397,6 +402,14 @@ else if (tagName.equals(HtmlKeyboard.TAG_NAME)) { element = new HtmlKeyboard(namespaceURI, qualifiedName, page, attributeMap); } + else if (tagName.equals(HtmlKeygen.TAG_NAME)) { + if (page.getWebClient().getBrowserVersion().hasFeature(HTML5_TAGS)) { + element = new HtmlKeygen(namespaceURI, qualifiedName, page, attributeMap); + } + else { + return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes); + } + } else if (tagName.equals(HtmlLabel.TAG_NAME)) { element = new HtmlLabel(namespaceURI, qualifiedName, page, attributeMap); } @@ -607,12 +620,17 @@ else if (tagName.equals(HtmlTextArea.TAG_NAME)) { element = new HtmlTextArea(namespaceURI, qualifiedName, page, attributeMap); } - else if (tagName.equals(HtmlDirectory.TAG_NAME)) { - element = new HtmlDirectory(namespaceURI, qualifiedName, page, attributeMap); - } else if (tagName.equals(HtmlTitle.TAG_NAME)) { element = new HtmlTitle(namespaceURI, qualifiedName, page, attributeMap); } + else if (tagName.equals(HtmlTime.TAG_NAME)) { + if (page.getWebClient().getBrowserVersion().hasFeature(HTML5_TAGS)) { + element = new HtmlTime(namespaceURI, qualifiedName, page, attributeMap); + } + else { + return UnknownElementFactory.instance.createElementNS(page, namespaceURI, qualifiedName, attributes); + } + } else if (tagName.equals(HtmlUnderlined.TAG_NAME)) { element = new HtmlUnderlined(namespaceURI, qualifiedName, page, attributeMap); } Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlKeygen.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlKeygen.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlKeygen.java 2013-12-22 12:33:19 UTC (rev 8895) @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.html; + +import java.util.Map; + +import com.gargoylesoftware.htmlunit.SgmlPage; + +/** + * Wrapper for the HTML element "keygen". + * + * @version $Revision: 8882 $ + * @author Ronald Brill + */ +public class HtmlKeygen extends HtmlElement { + + /** The HTML tag represented by this element. */ + public static final String TAG_NAME = "keygen"; + + /** + * Creates a new instance. + * + * @param namespaceURI the URI that identifies an XML namespace + * @param qualifiedName the qualified name of the element type to instantiate + * @param page the page that contains this element + * @param attributes the initial attributes + */ + HtmlKeygen(final String namespaceURI, final String qualifiedName, final SgmlPage page, + final Map<String, DomAttr> attributes) { + super(namespaceURI, qualifiedName, page, attributes); + } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } +} Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTime.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTime.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTime.java 2013-12-22 12:33:19 UTC (rev 8895) @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.html; + +import java.util.Map; + +import com.gargoylesoftware.htmlunit.SgmlPage; + +/** + * Wrapper for the HTML element "time". + * + * @version $Revision: 8871 $ + * @author Ronald Brill + */ +public class HtmlTime extends HtmlElement { + + /** The HTML tag represented by this element. */ + public static final String TAG_NAME = "time"; + + /** + * Creates a new instance. + * + * @param namespaceURI the URI that identifies an XML namespace + * @param qualifiedName the qualified name of the element type to instantiate + * @param page the page that contains this element + * @param attributes the initial attributes + */ + HtmlTime(final String namespaceURI, final String qualifiedName, final SgmlPage page, + final Map<String, DomAttr> attributes) { + super(namespaceURI, qualifiedName, page, attributes); + } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br/> + * + * Returns the default display style. + * + * @return the default display style. + */ + @Override + public DisplayStyle getDefaultStyleDisplay() { + return DisplayStyle.INLINE; + } +} Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java 2013-12-22 12:27:35 UTC (rev 8894) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java 2013-12-22 12:33:19 UTC (rev 8895) @@ -151,6 +151,7 @@ import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLInlineQuotationElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLInputElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLIsIndexElement; +import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLKeygenElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLLIElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLLabelElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLLegendElement; @@ -190,6 +191,7 @@ import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLTableSectionElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLTextAreaElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLTextElement; +import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLTimeElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLTitleElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLUListElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLUnknownElement; @@ -294,7 +296,8 @@ FormChild.class, FormField.class, Geolocation.class, HashChangeEvent.class, History.class, HTMLAnchorElement.class, HTMLAppletElement.class, HTMLAreaElement.class, HTMLAudioElement.class, - HTMLBRElement.class, HTMLBaseElement.class, HTMLBaseFontElement.class, HTMLBGSoundElement.class, + HTMLBGSoundElement.class, + HTMLBRElement.class, HTMLBaseElement.class, HTMLBaseFontElement.class, HTMLBlockElement.class, HTMLBlockQuoteElement.class, HTMLBodyElement.class, HTMLButtonElement.class, HTMLCanvasElement.class, HTMLCollection.class, HTMLCollectionTags.class, @@ -306,7 +309,9 @@ HTMLFontElement.class, HTMLFormElement.class, HTMLFrameElement.class, HTMLFrameSetElement.class, HTMLHRElement.class, HTMLHeadElement.class, HTMLHeadingElement.class, HTMLHtmlElement.class, HTMLIFrameElement.class, HTMLImageElement.class, HTMLInlineQuotationElement.class, HTMLInputElement.class, - HTMLIsIndexElement.class, HTMLLIElement.class, HTMLLabelElement.class, + HTMLIsIndexElement.class, + HTMLKeygenElement.class, + HTMLLIElement.class, HTMLLabelElement.class, HTMLLegendElement.class, HTMLLinkElement.class, HTMLListElement.class, HTMLMapElement.class, HTMLMarqueeElement.class, HTMLMediaElement.class, HTMLMenuElement.class, HTMLMetaElement.class, HTMLMeterElement.class, @@ -321,7 +326,7 @@ HTMLSelectElement.class, HTMLSourceElement.class, HTMLSpanElement.class, HTMLStyleElement.class, HTMLTableCaptionElement.class, HTMLTableCellElement.class, HTMLTableColElement.class, HTMLTableComponent.class, HTMLTableElement.class, HTMLTableRowElement.class, HTMLTableSectionElement.class, - HTMLTextElement.class, HTMLTextAreaElement.class, HTMLTitleElement.class, + HTMLTextElement.class, HTMLTextAreaElement.class, HTMLTimeElement.class, HTMLTitleElement.class, HTMLUListElement.class, HTMLUnknownElement.class, HTMLWBRElement.class, HTMLVideoElement.class, Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLKeygenElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLKeygenElement.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLKeygenElement.java 2013-12-22 12:33:19 UTC (rev 8895) @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.javascript.host.html; + +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; + +import com.gargoylesoftware.htmlunit.html.HtmlKeygen; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; +import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; + +/** + * The JavaScript object "HTMLSpanElement". + * + * @version $Revision: 8882 $ + * @author Ahmed Ashour + * @author Daniel Gredler + * @author Ronald Brill + */ +@JsxClass(domClass = HtmlKeygen.class, browsers = { @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) +public class HTMLKeygenElement extends HTMLElement { + + /** + * {@inheritDoc} + */ + @Override + public String getClassName() { + return "HTMLSpanElement"; + } + + /** + * Returns whether the end tag is forbidden or not. + * @see <a href="http://www.w3.org/TR/html4/index/elements.html">HTML 4 specs</a> + * @return whether the end tag is forbidden or not + */ + protected boolean isEndTagForbidden() { + return true; + } +} Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLPhraseElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLPhraseElement.java 2013-12-22 12:27:35 UTC (rev 8894) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLPhraseElement.java 2013-12-22 12:33:19 UTC (rev 8895) @@ -17,6 +17,7 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLABBREVIATED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_PHRASE_COMMON_CLASS_NAME; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML_SUPPORT_VIA_ACTIVEXOBJECT; +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import com.gargoylesoftware.htmlunit.html.DomNode; @@ -67,7 +68,7 @@ @JsxClass(domClass = HtmlAcronym.class), @JsxClass(domClass = HtmlBidirectionalOverride.class), @JsxClass(domClass = HtmlBig.class), - @JsxClass(domClass = HtmlBlink.class), + @JsxClass(domClass = HtmlBlink.class, browsers = { @WebBrowser(IE), @WebBrowser(value = FF, maxVersion = 17) }), @JsxClass(domClass = HtmlBold.class), @JsxClass(domClass = HtmlCitation.class), @JsxClass(domClass = HtmlCode.class), Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSpanElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSpanElement.java 2013-12-22 12:27:35 UTC (rev 8894) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSpanElement.java 2013-12-22 12:33:19 UTC (rev 8895) @@ -35,7 +35,8 @@ * @author Ronald Brill */ @JsxClasses({ - @JsxClass(domClass = HtmlMultiColumn.class, browsers = { @WebBrowser(FF), @WebBrowser(CHROME) }), + @JsxClass(domClass = HtmlMultiColumn.class, + browsers = { @WebBrowser(value = FF, maxVersion = 17), @WebBrowser(CHROME) }), @JsxClass(domClass = HtmlSpan.class) }) public class HTMLSpanElement extends HTMLElement { Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTimeElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTimeElement.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTimeElement.java 2013-12-22 12:33:19 UTC (rev 8895) @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.javascript.host.html; + +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; + +import com.gargoylesoftware.htmlunit.html.DomNode; +import com.gargoylesoftware.htmlunit.html.DomText; +import com.gargoylesoftware.htmlunit.html.HtmlTime; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; +import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; + +/** + * The JavaScript object "HTMLTimeElement". + * + * @version $Revision: 8672 $ + * @author Ronald Brill + */ +@JsxClass(domClass = HtmlTime.class, browsers = @WebBrowser(value = FF, minVersion = 24)) +public class HTMLTimeElement extends HTMLElement { + + /** + * Returns the <tt>text</tt> attribute. + * @return the <tt>text</tt> attribute + */ + @Override + @JsxGetter + public String getText() { + final DomNode firstChild = getDomNodeOrDie().getFirstChild(); + if (firstChild != null) { + return firstChild.getNodeValue(); + } + return ""; + } + + /** + * Sets the <tt>text</tt> attribute. + * @param text the <tt>text</tt> attribute + */ + @JsxSetter + public void setText(final String text) { + final DomNode htmlElement = getDomNodeOrDie(); + DomNode firstChild = htmlElement.getFirstChild(); + if (firstChild == null) { + firstChild = new DomText(htmlElement.getPage(), text); + htmlElement.appendChild(firstChild); + } + else { + firstChild.setNodeValue(text); + } + } +} Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java 2013-12-22 12:27:35 UTC (rev 8894) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/AttributesTest.java 2013-12-22 12:33:19 UTC (rev 8895) @@ -100,7 +100,9 @@ "HtmlImage", "HtmlImage", "HtmlInsertedText", "HtmlIsIndex", "HtmlItalic", "HtmlKeyboard", "HtmlLabel", "HtmlLegend", "HtmlListing", "HtmlListItem", - "HtmlLink", "HtmlMap", "HtmlMark", "HtmlMarquee", + "HtmlLink", + "HtmlKeygen", + "HtmlMap", "HtmlMark", "HtmlMarquee", "HtmlMenu", "HtmlMeta", "HtmlMeter", "HtmlMultiColumn", "HtmlNav", "HtmlNextId", "HtmlNoBreak", "HtmlNoEmbed", "HtmlNoFrames", @@ -118,7 +120,8 @@ "HtmlTable", "HtmlTableColumn", "HtmlTableColumnGroup", "HtmlTableBody", "HtmlTableDataCell", "HtmlTableHeaderCell", "HtmlTableRow", "HtmlTextArea", "HtmlTableFooter", - "HtmlTableHeader", "HtmlTeletype", "HtmlTitle", + "HtmlTableHeader", "HtmlTeletype", + "HtmlTime", "HtmlTitle", "HtmlUnderlined", "HtmlUnorderedList", "HtmlVariable", "HtmlVideo", "HtmlWordBreak", "HtmlExample" Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLElementsTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLElementsTest.java 2013-12-22 12:27:35 UTC (rev 8894) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLElementsTest.java 2013-12-22 12:33:19 UTC (rev 8895) @@ -652,6 +652,17 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = "1", + IE8 = "0") + @NotYetImplemented(IE8) + public void elementClosesItself_keygen() throws Exception { + loadPageWithAlerts2(elementClosesItself("keygen")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts("1") public void elementClosesItself_label() throws Exception { loadPageWithAlerts2(elementClosesItself("label")); @@ -1218,6 +1229,17 @@ @Test @Alerts(DEFAULT = "1", IE8 = "0") + @NotYetImplemented(IE8) + public void elementClosesItself_time() throws Exception { + loadPageWithAlerts2(elementClosesItself("time")); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = "1", + IE8 = "0") @NotYetImplemented(FF) public void elementClosesItself_title() throws Exception { loadPageWithAlerts2(elementClosesItself("title")); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java 2013-12-22 12:27:35 UTC (rev 8894) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java 2013-12-22 12:33:19 UTC (rev 8895) @@ -935,6 +935,17 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = { "3", "2", "2", "3", "2", "3" }, + IE8 = { "2", "2", "2", "4", "4", "3" }) + @NotYetImplemented + public void childNodes_keygen() throws Exception { + loadPageWithAlerts2(createHtmlForChildNodes("keygen")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = { "3", "2", "2", "3", "2", "2" }, IE8 = { "1", "1", "1", "2", "2", "1" }) public void childNodes_label() throws Exception { @@ -1538,6 +1549,17 @@ */ @Test @Alerts(DEFAULT = { "3", "2", "2", "3", "2", "2" }, + IE8 = { "2", "2", "2", "4", "4", "3" }) + @NotYetImplemented(IE8) + public void childNodes_time() throws Exception { + loadPageWithAlerts2(createHtmlForChildNodes("time")); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = { "3", "2", "2", "3", "2", "2" }, IE8 = { "0", "0", "0", "0", "0", "0" }) @NotYetImplemented(FF) public void childNodes_title() throws Exception { Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java 2013-12-22 12:27:35 UTC (rev 8894) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java 2013-12-22 12:33:19 UTC (rev 8895) @@ -3669,6 +3669,16 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = "<keygen>", + IE8 = "<keygen></keygen>") + public void outerHTML_keygen() throws Exception { + loadPageWithAlerts2(outerHTML("keygen")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = "<label></label>", IE8 = "<LABEL></LABEL>") public void outerHTML_label() throws Exception { @@ -4176,6 +4186,15 @@ * @throws Exception if the test fails */ @Test + @Alerts("<time></time>") + public void outerHTML_time() throws Exception { + loadPageWithAlerts2(outerHTML("time")); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = "<title></title>", IE8 = "<TITLE></TITLE>") public void outerHTML_title() throws Exception { |
From: <rb...@us...> - 2013-12-23 15:24:05
|
Revision: 8904 http://sourceforge.net/p/htmlunit/code/8904 Author: rbri Date: 2013-12-23 15:24:01 +0000 (Mon, 23 Dec 2013) Log Message: ----------- namespaceURI returns the correct value for html elements (Frank Danek) Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-12-23 15:23:37 UTC (rev 8903) +++ trunk/htmlunit/src/changes/changes.xml 2013-12-23 15:24:01 UTC (rev 8904) @@ -8,6 +8,9 @@ <body> <release version="2.14" date="???" description="Bugfixes"> + <action type="fix" dev="rbri" due-to="Frank Danek"> + JavaScript: namespaceURI returns the correct value for html elements. + </action> <action type="fix" dev="asashour" issue="1563"> JavaScript: fix parseInt() when the value has a leading 0. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-23 15:23:37 UTC (rev 8903) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-23 15:24:01 UTC (rev 8904) @@ -54,10 +54,6 @@ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) CAN_INHERIT_CSS_PROPERTY_VALUES, - /** The status/value update of a control is processed before the click event. */ - @BrowserFeature(@WebBrowser(IE)) - CONTROL_UPDATE_DONE_BEFORE_CLICK_EVENT_FIRED, - /** Indicates that the default value for height of elements is 15 instead of 20. */ @BrowserFeature(@WebBrowser(IE)) CSS_DEFAULT_ELEMENT_HEIGHT_15, @@ -174,13 +170,17 @@ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) EVENT_INPUT, + /** Triggers "onchange" event handler after "onclick" event handler. */ + @BrowserFeature(@WebBrowser(FF)) + EVENT_ONCHANGE_AFTER_ONCLICK, + /** Triggers "onchange" event handler on losing focus. */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) EVENT_ONCHANGE_LOSING_FOCUS, - /** Triggers "onclick" event handler also for the select option. */ - @BrowserFeature({ @WebBrowser(value = IE, minVersion = 8), @WebBrowser(FF), @WebBrowser(CHROME) }) - EVENT_ONCLICK_FOR_SELECT_OPTION_ALSO, + /** Triggers "onclick" event handler for the select only, not for the clicked option. */ + @BrowserFeature(@WebBrowser(IE)) + EVENT_ONCLICK_FOR_SELECT_ONLY, /** Triggers "onerror" if external loading of an external javascript failed. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) @@ -223,7 +223,7 @@ EVENT_PROPERTY_CHANGE, /** Supports vendor specific event type 'Events'. */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11), @WebBrowser(CHROME) }) EVENT_TYPE_EVENTS, /** Supports vendor specific event type 'KeyEvents'. */ @@ -231,7 +231,7 @@ EVENT_TYPE_KEY_EVENTS, /** Indicates that document.execCommand() should throw an exception when called with an illegal command. */ - @BrowserFeature(@WebBrowser(IE)) + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) EXECCOMMAND_THROWS_ON_WRONG_COMMAND, /** */ @@ -259,7 +259,7 @@ GENERATED_104, /** Was originally .isIE(). */ - @BrowserFeature(@WebBrowser(IE)) + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) GENERATED_112, /** Was originally .isIE(). */ @@ -295,15 +295,7 @@ GENERATED_158, /** Was originally .isFirefox(). */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) - GENERATED_160, - - /** Was originally .isFirefox(). */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) - GENERATED_161, - - /** Was originally .isFirefox(). */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) GENERATED_164, /** Was originally .isFirefox(). */ @@ -360,18 +352,10 @@ /** Was originally .isIE(). */ @BrowserFeature(@WebBrowser(IE)) - GENERATED_60, - - /** Was originally .isIE(). */ - @BrowserFeature(@WebBrowser(IE)) GENERATED_63, /** Was originally .isIE(). */ @BrowserFeature(@WebBrowser(IE)) - GENERATED_65, - - /** Was originally .isIE(). */ - @BrowserFeature(@WebBrowser(IE)) GENERATED_72, /** Was originally .isIE(). */ @@ -485,6 +469,25 @@ @BrowserFeature(@WebBrowser(IE)) HTMLDOCUMENT_COLOR, + /** Calls to <code>document.XYZ</code> also looks at frames. */ + @BrowserFeature(@WebBrowser(IE)) + HTMLDOCUMENT_GET_ALSO_FRAMES, + + /** Calls to <code>document.XYZ</code> looks at children with the specified ID and/or name. */ + @BrowserFeature(@WebBrowser(IE)) + HTMLDOCUMENT_GET_FOR_ID_AND_OR_NAME, + + /** Calls to <code>document.XYZ</code> looks at children with the specified name. */ + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) + HTMLDOCUMENT_GET_FOR_NAME, + + /** + * Calls to <code>document.XYZ</code> should first look at standard functions before looking at elements + * named <code>XYZ</code>. + */ + @BrowserFeature(@WebBrowser(value = IE, minVersion = 11)) + HTMLDOCUMENT_GET_PREFERS_STANDARD_FUNCTIONS, + /** Allows invalid 'align' values. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) HTMLELEMENT_ALIGN_INVALID, @@ -604,14 +607,14 @@ HTTP_HEADER_HOST_FIRST, /** Indicates that the browser should ignore contents of inner head elements. */ - @BrowserFeature(@WebBrowser(IE)) + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) IGNORE_CONTENTS_OF_INNER_HEAD, /** * The function addEventListener or attachEvent(IE) accepts null as listener * instead of throwing an exception. */ - @BrowserFeature({ @WebBrowser(IE), @WebBrowser(value = FF, minVersion = 17) }) + @BrowserFeature({ @WebBrowser(IE), @WebBrowser(value = FF, minVersion = 17), @WebBrowser(CHROME) }) JS_ADD_EVENT_LISTENER_ACCEPTS_NULL_LISTENER, /** Setting the property align to arbitrary values is allowed. */ @@ -772,10 +775,18 @@ @WebBrowser(value = IE, minVersion = 11) }) JS_DOCUMENT_CREATE_ELEMENT_STRICT, + /** Design mode constants start with a capital letter. */ + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 8)) + JS_DOCUMENT_DESIGN_MODE_CAPITAL_FIRST, + /** The browser supports the design mode 'Inherit' (IE). */ @BrowserFeature(@WebBrowser(IE)) JS_DOCUMENT_DESIGN_MODE_INHERIT, + /** The browser supports the design mode only for frames. */ + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 8)) + JS_DOCUMENT_DESIGN_MODE_ONLY_FOR_FRAMES, + /** Javascript document.doctype returns null (IE). */ @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_DOCUMENT_DOCTYPE_NULL, @@ -1033,7 +1044,7 @@ JS_INNER_HTML_CREATES_DOC_FRAGMENT_AS_PARENT, /** Indicates that innerHTML is readonly for some tags. */ - @BrowserFeature(@WebBrowser(IE)) + @BrowserFeature(@WebBrowser(value = IE, maxVersion = 9)) JS_INNER_HTML_READONLY_FOR_SOME_TAGS, /** Indicates if multiple spaces are replaced by a single one when accessing innerHTML. */ Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java 2013-12-23 15:23:37 UTC (rev 8903) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java 2013-12-23 15:24:01 UTC (rev 8904) @@ -85,6 +85,7 @@ * @author Ahmed Ashour * @author Amit Manjhi * @author Ronald Brill + * @author Frank Danek * @see <a href="http://groups-beta.google.com/group/netscape.public.mozilla.jseng/browse_thread/thread/b4edac57329cf49f/069e9307ec89111f"> * Rhino and Java Browser</a> */ @@ -231,7 +232,7 @@ if (obj.getClass() == Element.class) { final Page page = webWindow.getEnclosedPage(); if (page != null && page.isHtmlPage()) { - final DomNode domNode = new HtmlDivision(null, "", (HtmlPage) page, null); + final DomNode domNode = new HtmlDivision("", (HtmlPage) page, null); obj.setDomNode(domNode); } } |
From: <rb...@us...> - 2013-12-23 15:28:42
|
Revision: 8905 http://sourceforge.net/p/htmlunit/code/8905 Author: rbri Date: 2013-12-23 15:28:37 +0000 (Mon, 23 Dec 2013) Log Message: ----------- more IE11/FF24/Chrome fixes (Frank Danek) Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Document.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Event.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/EventListenersContainer.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/EventNode.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEvent.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMParser.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/test/java/com/gargoylesoftware/htmlunit/html/ClickableElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomNodeListTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAttrTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlInput2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlPageTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/MalformedHtmlTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/NamedAttrNodeMapImplTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Event2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/EventNodeTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/EventTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WindowConcurrencyTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLOptionElement2Test.java Added Paths: ----------- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser4Test.java 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-12-23 15:24:01 UTC (rev 8904) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Document.java 2013-12-23 15:28:37 UTC (rev 8905) @@ -15,7 +15,9 @@ package com.gargoylesoftware.htmlunit.javascript.host; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_CREATE_ELEMENT_EXTENDED_SYNTAX; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_DESIGN_MODE_CAPITAL_FIRST; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_DESIGN_MODE_INHERIT; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_DESIGN_MODE_ONLY_FOR_FRAMES; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_GET_ELEMENTS_BY_TAG_NAME_NOT_SUPPORTS_NAMESPACES; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; @@ -28,6 +30,7 @@ import net.sourceforge.htmlunit.corejs.javascript.Context; import net.sourceforge.htmlunit.corejs.javascript.NativeFunction; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.xml.utils.PrefixResolver; @@ -167,16 +170,14 @@ public String getDesignMode() { if (designMode_ == null) { if (getBrowserVersion().hasFeature(JS_DOCUMENT_DESIGN_MODE_INHERIT)) { - if (getWindow().getWebWindow() instanceof FrameWindow) { - designMode_ = "Inherit"; - } - else { - designMode_ = "Off"; - } + designMode_ = "inherit"; } else { designMode_ = "off"; } + if (getBrowserVersion().hasFeature(JS_DOCUMENT_DESIGN_MODE_CAPITAL_FIRST)) { + designMode_ = StringUtils.capitalize(designMode_); + } } return designMode_; } @@ -192,20 +193,24 @@ if (!"on".equalsIgnoreCase(mode) && !"off".equalsIgnoreCase(mode) && !"inherit".equalsIgnoreCase(mode)) { throw Context.reportRuntimeError("Invalid document.designMode value '" + mode + "'."); } - if (!(getWindow().getWebWindow() instanceof FrameWindow)) { - // IE ignores designMode changes for documents that aren't in frames. - return; + if (!(getWindow().getWebWindow() instanceof FrameWindow) + && getBrowserVersion().hasFeature(JS_DOCUMENT_DESIGN_MODE_ONLY_FOR_FRAMES)) { + // IE evaluates all designMode changes for documents that aren't in frames as Off + designMode_ = "off"; } - - if ("on".equalsIgnoreCase(mode)) { - designMode_ = "On"; + else if ("on".equalsIgnoreCase(mode)) { + designMode_ = "on"; } else if ("off".equalsIgnoreCase(mode)) { - designMode_ = "Off"; + designMode_ = "off"; } else if ("inherit".equalsIgnoreCase(mode)) { - designMode_ = "Inherit"; + designMode_ = "inherit"; } + + if (getBrowserVersion().hasFeature(JS_DOCUMENT_DESIGN_MODE_CAPITAL_FIRST)) { + designMode_ = StringUtils.capitalize(designMode_); + } } else { if ("on".equalsIgnoreCase(mode)) { @@ -236,7 +241,7 @@ * Gets the window in which this document is contained. * @return the window */ - @JsxGetter(@WebBrowser(FF)) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public Object getDefaultView() { return getWindow(); } @@ -315,7 +320,7 @@ * @param type the type of events to capture * @see Window#captureEvents(String) */ - @JsxFunction(@WebBrowser(FF)) + @JsxFunction({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public void captureEvents(final String type) { // Empty. } 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-12-23 15:24:01 UTC (rev 8904) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java 2013-12-23 15:28:37 UTC (rev 8905) @@ -127,7 +127,7 @@ * Returns the Base URI as a string. * @return the Base URI as a string */ - @JsxGetter(@WebBrowser(FF)) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF) }) public String getBaseURI() { return getDomNodeOrDie().getPage().getUrl().toExternalForm(); } @@ -303,7 +303,7 @@ * which matches all elements. * @return a live NodeList of found elements in the order they appear in the tree */ - @JsxFunction({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxFunction({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public Object getElementsByTagNameNS(final Object namespaceURI, final String localName) { final String description = "Element.getElementsByTagNameNS('" + namespaceURI + "', '" + localName + "')"; @@ -324,7 +324,7 @@ * @param name the name of the attribute to look for * @return true if an attribute with the given name is specified on this element or has a default value */ - @JsxFunction({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxFunction({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public boolean hasAttribute(final String name) { return getDomNodeOrDie().hasAttribute(name); } @@ -364,7 +364,7 @@ * Returns the current number of child elements. * @return the child element count */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public int getChildElementCount() { return getDomNodeOrDie().getChildElementCount(); } @@ -373,7 +373,7 @@ * Returns the first element child. * @return the first element child */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public Element getFirstElementChild() { final DomElement child = getDomNodeOrDie().getFirstElementChild(); if (child != null) { @@ -386,7 +386,7 @@ * Returns the last element child. * @return the last element child */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public Element getLastElementChild() { final DomElement child = getDomNodeOrDie().getLastElementChild(); if (child != null) { @@ -399,7 +399,7 @@ * Returns the next element sibling. * @return the next element sibling */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public Element getNextElementSibling() { final DomElement child = getDomNodeOrDie().getNextElementSibling(); if (child != null) { @@ -412,7 +412,7 @@ * Returns the previous element sibling. * @return the previous element sibling */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public Element getPreviousElementSibling() { final DomElement child = getDomNodeOrDie().getPreviousElementSibling(); if (child != null) { @@ -452,7 +452,7 @@ * @see <a href="http://msdn.microsoft.com/en-us/library/ms537446.aspx">MSDN documentation</a> * @return the child at the given position */ - @JsxGetter(@WebBrowser(FF)) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF) }) public HTMLCollection getChildren() { final DomElement node = getDomNodeOrDie(); final HTMLCollection collection = new HTMLCollection(node, false, "Element.children") { @@ -468,7 +468,7 @@ * Gets the token list of class attribute. * @return the token list of class attribute */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF) }) public DOMTokenList getClassList() { return null; } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Event.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Event.java 2013-12-23 15:24:01 UTC (rev 8904) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Event.java 2013-12-23 15:28:37 UTC (rev 8905) @@ -394,7 +394,7 @@ * Returns the object that fired the event. This is an IE-only property. * @return the object that fired the event */ - @JsxGetter(@WebBrowser(IE)) + @JsxGetter({ @WebBrowser(IE), @WebBrowser(CHROME) }) public Object getSrcElement() { return srcElement_; } @@ -412,7 +412,7 @@ * Returns the event target to which the event was originally dispatched. * @return the event target to which the event was originally dispatched */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11), @WebBrowser(CHROME) }) public Object getTarget() { return target_; } @@ -430,7 +430,7 @@ * is useful during event capturing and event bubbling. * @return the current event target */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11), @WebBrowser(CHROME) }) public Object getCurrentTarget() { return currentTarget_; } @@ -473,7 +473,7 @@ * Returns the time at which this event was created. * @return the time at which this event was created */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11), @WebBrowser(CHROME) }) public long getTimeStamp() { return timeStamp_; } @@ -660,7 +660,7 @@ * @param bubbles whether or not the event should bubble * @param cancelable whether or not the event the event should be cancelable */ - @JsxFunction({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxFunction({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11), @WebBrowser(CHROME) }) public void initEvent(final String type, final boolean bubbles, final boolean cancelable) { type_ = type; bubbles_ = bubbles; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/EventListenersContainer.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/EventListenersContainer.java 2013-12-23 15:24:01 UTC (rev 8904) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/EventListenersContainer.java 2013-12-23 15:28:37 UTC (rev 8905) @@ -42,6 +42,7 @@ * @author Marc Guillemot * @author Daniel Gredler * @author Ahmed Ashour + * @author Frank Danek */ public class EventListenersContainer implements Serializable { @@ -88,7 +89,7 @@ if (accept) { return true; } - throw new EvaluatorException("Could not convert JavaScript argument (Listner was null)."); + throw new EvaluatorException("Could not convert JavaScript argument (Listener was null)."); } final List<Function> listeners = getHandlersOrCreateIt(type).getHandlers(useCapture); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/EventNode.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/EventNode.java 2013-12-23 15:24:01 UTC (rev 8904) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/EventNode.java 2013-12-23 15:28:37 UTC (rev 8905) @@ -34,6 +34,7 @@ * @version $Revision$ * @author Daniel Gredler * @author Ahmed Ashour + * @author Frank Danek */ @JsxClass public class EventNode extends Node { @@ -370,7 +371,7 @@ * @param event specifies the event object from which to obtain event object properties. * @return <tt>true</tt> if the event fired successfully, <tt>false</tt> if it was canceled */ - @JsxFunction(@WebBrowser(IE)) + @JsxFunction(@WebBrowser(value = IE, maxVersion = 9)) public boolean fireEvent(final String type, Event event) { if (event == null) { event = new MouseEvent(); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEvent.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEvent.java 2013-12-23 15:24:01 UTC (rev 8904) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MouseEvent.java 2013-12-23 15:28:37 UTC (rev 8905) @@ -275,7 +275,7 @@ * @see <a href="http://unixpapa.com/js/mouse.html">Javascript Madness: Mouse Events</a> * @return the button code */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11), @WebBrowser(CHROME) }) public int getWhich() { return button_ + 1; } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java 2013-12-23 15:24:01 UTC (rev 8904) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java 2013-12-23 15:28:37 UTC (rev 8905) @@ -897,7 +897,7 @@ * Returns the namespace prefix. * @return the namespace prefix */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public String getPrefix() { final DomNode domNode = getDomNodeOrDie(); final String prefix = domNode.getPrefix(); @@ -912,7 +912,7 @@ * Returns the local name of this element. * @return the local name of this element */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public String getLocalName() { return getDomNodeOrDie().getLocalName(); } @@ -921,7 +921,7 @@ * Returns The URI that identifies an XML namespace. * @return the URI that identifies an XML namespace */ - @JsxGetter({ @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public String getNamespaceURI() { final String namespaceURI = getDomNodeOrDie().getNamespaceURI(); return namespaceURI; @@ -931,7 +931,7 @@ * Returns the base name of this element. * @return the base name of this element */ - @JsxGetter(@WebBrowser(IE)) + @JsxGetter(@WebBrowser(value = IE, maxVersion = 9)) public Object getBaseName() { final DomElement domElem = getDomNodeOrDie(); final boolean isXmlPage = domElem.getOwnerDocument() instanceof XmlPage; 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-12-23 15:24:01 UTC (rev 8904) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2013-12-23 15:28:37 UTC (rev 8905) @@ -307,7 +307,7 @@ * Returns the current event (used by JavaScript only when emulating IE). * @return the current event, or <tt>null</tt> if no event is currently available */ - @JsxGetter(@WebBrowser(IE)) + @JsxGetter({ @WebBrowser(IE), @WebBrowser(CHROME) }) public Object getEvent() { return currentEvent_; } @@ -1140,7 +1140,7 @@ * @see <a href="http://msdn.microsoft.com/en-us/library/ms536343.aspx">MSDN documentation</a> * @return <code>true</code> if the listener has been added */ - @JsxFunction(@WebBrowser(IE)) + @JsxFunction(@WebBrowser(value = IE, maxVersion = 9)) public boolean attachEvent(final String type, final Function listener) { return getEventListenersContainer().addEventListener(StringUtils.substring(type, 2), listener, false); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMParser.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMParser.java 2013-12-23 15:24:01 UTC (rev 8904) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMParser.java 2013-12-23 15:28:37 UTC (rev 8905) @@ -14,6 +14,7 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.dom; +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 net.sourceforge.htmlunit.corejs.javascript.Context; @@ -35,7 +36,7 @@ * * @see <a href="http://www.xulplanet.com/references/objref/DOMParser.html">XUL Planet</a> */ -@JsxClass(browsers = { @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) +@JsxClass(browsers = { @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public class DOMParser extends SimpleScriptable { /** 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-12-23 15:24:01 UTC (rev 8904) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java 2013-12-23 15:28:37 UTC (rev 8905) @@ -20,16 +20,17 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_EVENTS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_KEY_EVENTS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EXECCOMMAND_THROWS_ON_WRONG_COMMAND; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_160; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_161; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_164; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_51; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_53; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_55; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_60; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLCOLLECTION_OBJECT_DETECTION; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_CHARSET_LOWERCASE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_COLOR; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_GET_ALSO_FRAMES; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_GET_FOR_ID_AND_OR_NAME; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_GET_FOR_NAME; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_GET_PREFERS_STANDARD_FUNCTIONS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ANCHORS_REQUIRES_NAME_OR_ID; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_APPEND_CHILD_SUPPORTED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_CLASS_NAME; @@ -1418,7 +1419,7 @@ @Override protected Object getWithPreemption(final String name) { final HtmlPage page = (HtmlPage) getDomNodeOrNull(); - if (page == null || getBrowserVersion().hasFeature(GENERATED_160)) { + if (page == null || getBrowserVersion().hasFeature(HTMLDOCUMENT_GET_PREFERS_STANDARD_FUNCTIONS)) { return NOT_FOUND; } return getIt(name); @@ -1427,12 +1428,13 @@ private Object getIt(final String name) { final HtmlPage page = (HtmlPage) getDomNodeOrNull(); - final boolean isIE = getBrowserVersion().hasFeature(GENERATED_60); + final boolean forIDAndOrName = getBrowserVersion().hasFeature(HTMLDOCUMENT_GET_FOR_ID_AND_OR_NAME); + final boolean alsoFrames = getBrowserVersion().hasFeature(HTMLDOCUMENT_GET_ALSO_FRAMES); final HTMLCollection collection = new HTMLCollection(page, true, "HTMLDocument." + name) { @Override protected List<Object> computeElements() { final List<DomElement> elements; - if (isIE) { + if (forIDAndOrName) { elements = page.getElementsByIdAndOrName(name); } else { @@ -1441,7 +1443,7 @@ final List<Object> matchingElements = new ArrayList<Object>(); for (final DomElement elt : elements) { if (elt instanceof HtmlForm || elt instanceof HtmlImage || elt instanceof HtmlApplet - || (isIE && elt instanceof BaseFrameElement)) { + || (alsoFrames && elt instanceof BaseFrameElement)) { matchingElements.add(elt); } } @@ -1454,7 +1456,7 @@ if ("name".equals(attributeName)) { return EffectOnCache.RESET; } - else if (isIE && "id".equals(attributeName)) { + else if (forIDAndOrName && "id".equals(attributeName)) { return EffectOnCache.RESET; } @@ -1463,7 +1465,7 @@ @Override protected SimpleScriptable getScriptableFor(final Object object) { - if (isIE && object instanceof BaseFrameElement) { + if (alsoFrames && object instanceof BaseFrameElement) { return (SimpleScriptable) ((BaseFrameElement) object).getEnclosedWindow().getScriptObject(); } return super.getScriptableFor(object); @@ -1486,7 +1488,8 @@ * {@inheritDoc} */ public Object getWithFallback(final String name) { - if (getBrowserVersion().hasFeature(GENERATED_161)) { + if (getBrowserVersion().hasFeature(HTMLDOCUMENT_GET_FOR_NAME) + || getBrowserVersion().hasFeature(HTMLDOCUMENT_GET_FOR_ID_AND_OR_NAME)) { return getIt(name); } return NOT_FOUND; @@ -1673,7 +1676,7 @@ * @see DomNode#READY_STATE_INTERACTIVE * @see DomNode#READY_STATE_COMPLETE */ - @JsxGetter({ @WebBrowser(IE), @WebBrowser(FF) }) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(IE), @WebBrowser(FF) }) public String getReadyState() { final DomNode node = getDomNodeOrDie(); return node.getReadyState(); @@ -1777,7 +1780,7 @@ * Returns the value of the JavaScript attribute <tt>scripts</tt>. * @return the value of the JavaScript attribute <tt>scripts</tt> */ - @JsxGetter({ @WebBrowser(IE), @WebBrowser(value = FF, minVersion = 10) }) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(IE), @WebBrowser(value = FF, minVersion = 10) }) public Object getScripts() { if (scripts_ == null) { scripts_ = new HTMLCollection(getDomNodeOrDie(), false, "HTMLDocument.scripts") { @@ -1880,7 +1883,7 @@ * @see <a href="http://msdn2.microsoft.com/en-us/library/ms536390.aspx">MSDN Documentation</a> * @return an uninitialized event object */ - @JsxFunction(@WebBrowser(IE)) + @JsxFunction(@WebBrowser(value = IE, maxVersion = 9)) public Event createEventObject() { final Event event = new MouseEvent(); event.setParentScope(getWindow()); @@ -2047,7 +2050,7 @@ * @see <a href="http://msdn.microsoft.com/en-us/library/ms533065.aspx">MSDN documentation</a> * @return the value of the "activeElement" property */ - @JsxGetter({ @WebBrowser(IE), @WebBrowser(FF) }) + @JsxGetter public Object getActiveElement() { if (activeElement_ == null) { final HtmlElement body = getHtmlPage().getBody(); 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-12-23 15:24:01 UTC (rev 8904) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-12-23 15:28:37 UTC (rev 8905) @@ -14,7 +14,6 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.html; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_65; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_72; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLELEMENT_ATTRIBUTE_FIX_IN_QUIRKS_MODE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLELEMENT_OUTER_HTML_UPPER_CASE; @@ -534,33 +533,18 @@ * {@inheritDoc} */ @Override - public String getNamespaceURI() { - final HtmlElement domNode = getDomNodeOrDie(); - if (getBrowserVersion().hasFeature(GENERATED_65)) { - return domNode.getNamespaceURI(); - } - if (domNode.getHtmlPageOrNull() != null) { - return null; - } - return domNode.getNamespaceURI(); - } - - /** - * {@inheritDoc} - */ - @Override public String getLocalName() { final DomNode domNode = getDomNodeOrDie(); if (domNode.getHtmlPageOrNull() != null) { final String prefix = domNode.getPrefix(); if (prefix != null) { // create string builder only if needed (performance) - final StringBuilder localName = new StringBuilder(prefix.toUpperCase(Locale.ENGLISH)); + final StringBuilder localName = new StringBuilder(prefix.toLowerCase(Locale.ENGLISH)); localName.append(':'); - localName.append(domNode.getLocalName().toUpperCase(Locale.ENGLISH)); + localName.append(domNode.getLocalName().toLowerCase(Locale.ENGLISH)); return localName.toString(); } - return domNode.getLocalName().toUpperCase(Locale.ENGLISH); + return domNode.getLocalName().toLowerCase(Locale.ENGLISH); } return domNode.getLocalName(); } @@ -1136,7 +1120,7 @@ * @param append append or no */ public ProxyDomNode(final SgmlPage page, final DomNode target, final boolean append) { - super(null, HtmlDivision.TAG_NAME, page, null); + super(HtmlDivision.TAG_NAME, page, null); target_ = target; append_ = append; } @@ -1851,6 +1835,9 @@ @JsxGetter(@WebBrowser(value = IE, maxVersion = 9)) public String getTagUrn() { final String urn = getDomNodeOrDie().getNamespaceURI(); + if (HTMLParser.XHTML_NAMESPACE.equals(urn)) { + return ""; + } return urn != null ? urn : ""; } @@ -2797,7 +2784,7 @@ * Gets the token list of class attribute. * @return the token list of class attribute */ - @Override + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }) public DOMTokenList getClassList() { return new DOMTokenList(this, "class"); } @@ -2833,7 +2820,7 @@ * {@inheritDoc} Overridden to modify browser configurations. */ @Override - @JsxGetter(@WebBrowser(IE)) + @JsxGetter({ @WebBrowser(CHROME), @WebBrowser(IE) }) public HTMLCollection getChildren() { return super.getChildren(); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/ClickableElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/ClickableElementTest.java 2013-12-23 15:24:01 UTC (rev 8904) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/ClickableElementTest.java 2013-12-23 15:28:37 UTC (rev 8905) @@ -14,6 +14,8 @@ */ package com.gargoylesoftware.htmlunit.html; +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.CHROME; + import java.util.ArrayList; import java.util.List; @@ -22,6 +24,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.BrowserRunner.BuggyWebDriver; import com.gargoylesoftware.htmlunit.CollectingAlertHandler; import com.gargoylesoftware.htmlunit.MockWebConnection; import com.gargoylesoftware.htmlunit.SimpleWebTestCase; @@ -35,6 +38,7 @@ * @author Chris Erskine * @author Marc Guillemot * @author Ahmed Ashour + * @author Frank Danek */ @RunWith(BrowserRunner.class) public class ClickableElementTest extends SimpleWebTestCase { @@ -636,10 +640,13 @@ * @throws Exception if the test fails */ @Test - @Alerts(FF = { "foo", "foo" }, IE8 = { "foo", "foo" }, IE = "foo") + @Alerts(DEFAULT = "foo", + IE = "") + @BuggyWebDriver(CHROME) + // ChromeDriver does not generate a "foo" but it occurs manually public void option_onClick() throws Exception { final String htmlContent = "<html><head><title>foo</title></head>\n" - + "<body><form><select><option id='clickId' onClick='alert(\"foo\")'>\n" + + "<body><form><select size='2'><option id='clickId' onClick='alert(\"foo\")'>\n" + "Option</option></select></form></body>\n" + "</html>"; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomNodeListTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomNodeListTest.java 2013-12-23 15:24:01 UTC (rev 8904) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomNodeListTest.java 2013-12-23 15:28:37 UTC (rev 8905) @@ -28,6 +28,7 @@ * * @version $Revision$ * @author <a href="mailto:tom...@un...">Tom Anderson</a> + * @author Frank Danek */ @RunWith(BrowserRunner.class) public class DomNodeListTest extends SimpleWebTestCase { @@ -51,7 +52,7 @@ assertEquals(3, divs.getLength()); validateDomNodeList(divs); - final HtmlDivision newDiv = new HtmlDivision(null, HtmlDivision.TAG_NAME, page, null); + final HtmlDivision newDiv = new HtmlDivision(HtmlDivision.TAG_NAME, page, null); page.getBody().appendChild(newDiv); assertEquals(4, divs.getLength()); validateDomNodeList(divs); Added: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser4Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser4Test.java (rev 0) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser4Test.java 2013-12-23 15:28:37 UTC (rev 8905) @@ -0,0 +1,441 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * 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 com.gargoylesoftware.htmlunit.html; + +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.CHROME; +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.FF; +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE11; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import com.gargoylesoftware.htmlunit.BrowserRunner; +import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.BrowserRunner.BuggyWebDriver; +import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; +import com.gargoylesoftware.htmlunit.WebDriverTestCase; + +/** + * Test class for {@link HTMLParser}. + * + * @version $Revision$ + * @author <a href="mailto:cs...@dy...">Christian Sell</a> + * @author Marc Guillemot + * @author Ahmed Ashour + * @author Sudhan Moghe + * @author Frank Danek + */ +@RunWith(BrowserRunner.class) +public class HTMLParser4Test extends WebDriverTestCase { + + /** + * Tests that inserted TBODY and TFOOT don't conflict. + * @throws Exception failure + */ + @Test + @Alerts("TABLE") + public void table_tfoot() throws Exception { + final String html = "<html><body>" + + "<table><tr><td>hello</td></tr>\n" + + "<tfoot id='tf'><tr><td>foot</td></tr></tfoot>" + + "</table>\n" + + "<script>\n" + + "alert(document.getElementById('tf').parentNode.nodeName)\n" + + "</script>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * Test for the condition when there is a <tt><form></tt> inside of a <tt><table></tt> and before + * a <tt><tr></tt>. + * @throws Exception failure + */ + @Test + @Alerts("myForm") + public void badlyFormedHTML() throws Exception { + final String html + = "<html><head><title>first</title>\n" + + " <script>\n" + + " function test(){\n" + + " alert(document.getElementById('myInput').form.id);\n" + + " }\n" + + " </script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + " <table>\n" + + " <form name='myForm' action='foo' id='myForm'>\n" + + " <tr><td>\n" + + " <input type='text' name='myInput' id='myInput'/>\n" + + " </td></tr>\n" + + " </form>\n" + + " </table>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * Test when an illegal tag is found in head as some websites do. + * @throws Exception failure + */ + @Test + @Alerts("first") + public void unknownTagInHead() throws Exception { + // Note: the <meta> tag in this test is quite important because + // I could adapt the TagBalancer to make it work except with this <meta http-equiv... + // (it worked with <meta name=...) + final String html + = "<html><head><mainA3>\n" + + " <meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>\n" + + " <title>first</title>\n" + + " <script>\n" + + " function test(){\n" + + " alert(document.title);\n" + + " }\n" + + " </script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception failure + */ + @Test + @Alerts({"false", "true" }) + public void duplicatedAttribute() throws Exception { + final String html + = "<html><head>\n" + + "</head>\n" + + " <script>\n" + + " function test() {\n" + + " alert(document.getElementById('foo') == null);\n" + + " alert(document.getElementById('bla') == null);\n" + + " }\n" + + " </script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + " <span id='foo' id='bla'></span>" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception failure + */ + @Test + @Alerts(DEFAULT = { "1", "3", "[object HTMLScriptElement]", + "[object HTMLUnknownElement]", "[object HTMLUnknownElement]", "[object HTMLFormElement]" }, + IE8 = { "1", "3", "[object HTMLScriptElement]", + "[object HTMLGenericElement]", "[object HTMLGenericElement]", "[object HTMLFormElement]" }) + public void namespace() throws Exception { + final String html + = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n" + + "<html xmlns='http://www.w3.org/1999/xhtml' xmlns:app='http://www.appcelerator.org'>\n" + + "<head>\n" + + "<script>\n" + + " function test() {\n" + + " alert(document.getElementById('script1'));\n" + + " alert(document.getElementById('script2'));\n" + + " alert(document.getElementById('message1'));\n" + + " alert(document.getElementById('form1'));\n" + + " }\n" + + "</script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + "<script id='script1'>alert(1)</script>\n" + + "<app:script id='script2'>alert(2)</app:script>\n" + + "<script>alert(3)</script>\n" + + "<app:message name='r:tasks.request' id='message1'>hello</app:message>\n" + + "<form id='form1' xmlns='http://org.pentaho'/>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception failure + */ + @Test + @Alerts(DEFAULT = { "1", + "[object Element]", "app:script,app:script,http://www.appcelerator.org,app,script", + "[object HTMLScriptElement]", "SCRIPT,SCRIPT,http://www.w3.org/1999/xhtml,null,script", + "[object HTMLUnknownElement]", "APP:SCRIPT,APP:SCRIPT,http://www.w3.org/1999/xhtml,null,app:script" }, + IE8 = { "1", + "createElementNS() is not defined", + "[object]", "SCRIPT,SCRIPT,undefined,undefined,undefined", + "[object]", "script,script,undefined,undefined,undefined" }) + public void namespace2() throws Exception { + final String html + = "<html xmlns='http://www.w3.org/1999/xhtml' xmlns:app='http://www.appcelerator.org'>\n" + + "<head>\n" + + "<script>\n" + + " function test() {\n" + + " try {\n" + + " div = document.createElementNS('http://www.appcelerator.org', 'app:script');\n" + + " debug(div);\n" + + " } catch (e) {alert('createElementNS() is not defined')}\n" + + " debug(document.getElementById('script1'));\n" + + " debug(document.getElementById('script2'));\n" + + " }\n" + + " function debug(e) {\n" + + " alert(e);\n" + + " alert(e.nodeName + ',' + e.tagName + ',' + e.namespaceURI + ',' + e.prefix + ',' + e.localName);\n" + + " }\n" + + "</script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + "<script id='script1'>alert(1)</script>\n" + + "<app:script id='script2'>alert(2)</app:script>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * Test for a case where complete HTML page is present inside DIV tag. + * IE8 ignores the HTML tag, BODY tag and complete HEAD along with content inside HEAD. + * Others ignores only HTML, HEAD and BODY tags. Contents of HEAD and BODY are added to + * the current node (DIV tag in test case). + * + * @throws Exception failure + */ + @Test + @Alerts(DEFAULT = { "titles", "HEAD", "Outer Html", "DIV", "Inner Html", + "bodyTitles", "DIV", "Inner Html", + "innerDiv", "outerDiv" }, + IE8 = { "titles", "HEAD", "Outer Html", + "bodyTitles", + "innerDiv", "outerDiv" }) + @BuggyWebDriver(IE11) + // The correct values for IE11 are: + // IE11 = { "titles", "HEAD", "Outer Html", "DIV", "", + // "bodyTitles", "DIV", "", + // "innerDiv", "outerDiv" }) + // This is pretty mysterious because the second title HAS the text 'Inner Html' inside. + // Currently I do not know why it behaves this way so I take the default behavior. + public void completeHtmlInsideDiv() throws Exception { + final String html + = "<html><head>\n" + + " <title>Outer Html</title>\n" + + " <script>\n" + + " function test() {\n" + + " alert('titles');\n" + + " var titles = document.getElementsByTagName('title');\n" + + " for(var i=0; i < titles.length; ++i) {\n" + + " alert(titles[i].parentNode.nodeName);\n" + + " alert(titles[i].text);\n" + + " }\n" + + " alert('bodyTitles');\n" + + " var bodyTitles = document.body.getElementsByTagName('title');\n" + + " for(var i=0; i < bodyTitles.length; ++i) {\n" + + " alert(bodyTitles[i].parentNode.nodeName);\n" + + " alert(bodyTitles[i].text);\n" + + " }\n" + + " alert('innerDiv');\n" + + " var innerDiv = document.getElementById('innerDiv');\n" + + " alert(innerDiv.parentNode.id);\n" + + " }\n" + + " </script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + " <DIV id=outerDiv>\n" + + " Outer DIV\n" + + " <html>\n" + + " <head><title>Inner Html</title></head>\n" + + " <body>\n" + + " <DIV id=innerDiv>Inner DIV</DIV>\n" + + " </body>\n" + + " </html>\n" + + " </DIV>\n" + + "</body>\n" + + "</html>\n"; + + loadPageWithAlerts2(html); + } + + /** + * Test for a case where complete HTML page is added using document.write() inside DIV tag. + * IE8 ignores the HTML tag, BODY tag and complete HEAD along with content inside HEAD. + * Others ignores only HTML, HEAD and BODY tags. Contents of HEAD and BODY are added to + * the current node (DIV tag in test case). + * + * @throws Exception failure + */ + @Test + @Alerts(DEFAULT = { "titles", "HEAD", "Outer Html", "DIV", "Inner Html", + "bodyTitles", "DIV", "Inner Html", + "innerDiv", "outerDiv" }, + IE8 = { "titles", "HEAD", "Outer Html", + "bodyTitles", + "innerDiv", "outerDiv" }) + @BuggyWebDriver(IE11) + // The correct values for IE11 are: + // IE11 = { "titles", "HEAD", "Outer Html", "DIV", "", + // "bodyTitles", "DIV", "", + // "innerDiv", "outerDiv" }) + // This is pretty mysterious because the second title HAS the text 'Inner Html' inside. + // Currently I do not know why it behaves this way so I take the default behavior. + public void writeCompleteHtmlInsideDIV() throws Exception { + final String html + = "<html><head>\n" + + " <title>Outer Html</title>\n" + + " <script>\n" + + " function test() {\n" + + " alert('titles');\n" + + " var titles = document.getElementsByTagName('title');\n" + + " for(var i=0; i < titles.length; ++i) {\n" + + " alert(titles[i].parentNode.nodeName);\n" + + " alert(titles[i].text);\n" + + " }\n" + + " alert('bodyTitles');\n" + + " var bodyTitles = document.body.getElementsByTagName('title');\n" + + " for(var i=0; i < bodyTitles.length; ++i) {\n" + + " alert(bodyTitles[i].parentNode.nodeName);\n" + + " alert(bodyTitles[i].text);\n" + + " }\n" + + " alert('innerDiv');\n" + + " var innerDiv = document.getElementById('innerDiv');\n" + + " alert(innerDiv.parentNode.id);\n" + + " }\n" + + " </script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + " <DIV id=outerDiv>\n" + + " Outer DIV\n" + + " <script>\n" + + " document.write('<html><head><title>Inner Html</title></head>" + + " <body><DIV id=innerDiv>Inner DIV</DIV></body></html>');\n" + + " </script>\n" + + " </DIV>\n" + + "</body>\n" + + "</html>\n"; + + loadPageWithAlerts2(html); + } + + /** + * Test for a case where complete HTML page is set in innerHTML of DIV tag. + * Behavior is same for any TAG inside body including BODY tag. + * IE8 ignores the HTML tag, BODY tag and complete HEAD along with content inside HEAD. + * Others ignores only HTML, HEAD and BODY tags. Contents of HEAD and BODY are added to + * the current node (DIV tag in test case). + * + * @throws Exception failure + */ + @Test + @Alerts(DEFAULT = { "titles", "HEAD", "Outer Html", "DIV", "Inner Html", + "bodyTitles", "DIV", "Inner Html", + "innerDiv", "outerDiv" }, + IE8 = { "titles", "HEAD", "Outer Html", + "bodyTitles", + "innerDiv", "outerDiv" }) + public void setCompleteHtmlToDIV_innerHTML() throws Exception { + final String html + = "<html><head>\n" + + " <title>Outer Html</title>\n" + + " <script>\n" + + " function test() {\n" + + " alert('titles');\n" + + " var titles = document.getElementsByTagName('title');\n" + + " for(var i=0; i < titles.length; ++i) {\n" + + " alert(titles[i].parentNode.nodeName);\n" + + " alert(titles[i].text);\n" + + " }\n" + + " alert('bodyTitles');\n" + + " var bodyTitles = document.body.getElementsByTagName('title');\n" + + " for(var i=0; i < bodyTitles.length; ++i) {\n" + + " alert(bodyTitles[i].parentNode.nodeName);\n" + + " alert(bodyTitles[i].text);\n" + + " }\n" + + " alert('innerDiv');\n" + + " var innerDiv = document.getElementById('innerDiv');\n" + + " alert(innerDiv.parentNode.id);\n" + + " }\n" + + " </script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + " <DIV id=outerDiv>\n" + + " Outer DIV\n" + + " </DIV>\n" + + " <script>\n" + + " document.getElementById('outerDiv').innerHTML =" + + " '<html><head><title>Inner Html</title></head>" + + " <body><DIV id=innerDiv>Inner DIV</DIV></body></html>';\n" + + " </script>\n" + + "</body>\n" + + "</html>\n"; + + loadPageWithAlerts2(html); + } + + /** + * Test for a case where complete HTML page is set in innerHTML of HTML tag. + * IE8 throws JavaScript error as innerHTML of HTML is read only. + * Others replace the current content of the HTML node by the new one. + * + * @throws Exception failure + */ + @Test + @Alerts(DEFAULT = { "titles", "HEAD", "Inner Html", + "misc", "true", "BODY" }, + IE8 = { "exception", + "titles", "HEAD", "Outer Html", + "misc", "true" }) + @NotYetImplemented({ CHROME, FF, IE11 }) + // currently the content of HEAD and BODY are added directly to HTML + public void setCompleteHtmlToHTML_innerHTML() throws Exception { + final String html + = "<html><head>\n" + + " <title>Outer Html</title>\n" + + " <script>\n" + + " function test() {\n" + + " alert('titles');\n" + + " var titles = document.getElementsByTagName('title');\n" + + " for(var i=0; i < titles.length; ++i) {\n" + + " alert(titles[i].parentNode.nodeName);\n" + + " alert(titles[i].text);\n" + + " }\n" + + " alert('misc');\n" + + " alert(document.body != null);\n" + + " var innerDiv = document.getElementById('innerDiv');\n" + + " if (innerDiv != null) {\n" + + " alert(innerDiv.parentNode.nodeName);\n" + + " }\n" + + " }\n" + + " </script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + " <DIV id=outerDiv>\n" + + " Outer DIV\n" + + " </DIV>\n" + + "<script>\n" + + " try {\n" + + " document.getElementsByTagName('html')[0].innerHTML =" + + " '<html><head><title>Inner Html</title></head>" + + " <body><DIV id=innerDiv>Inner DIV</DIV></body></html>';\n" + + " } catch(e) { alert('exception') }\n" + + "</script>\n" + + "</body>\n" + + "</html>\n"; + + loadPageWithAlerts2(html); + } +} Property changes on: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser4Test.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserTest.java 2013-12-23 15:24:01 UTC (rev 8904) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserTest.java 2013-12-23 15:28:37 UTC (rev 8905) @@ -14,7 +14,6 @@ */ package com.gargoylesoftware.htmlunit.html; -import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE; import static org.junit.Assert.assertNotNull; import java.net.URL; @@ -23,8 +22,6 @@ import org.junit.runner.RunWith; import com.gargoylesoftware.htmlunit.BrowserRunner; -import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; -import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; import com.gargoylesoftware.htmlunit.SimpleWebTestCase; import com.gargoylesoftware.htmlunit.StringWebResponse; import com.gargoylesoftware.htmlunit.WebClient; @@ -38,6 +35,7 @@ * @author Marc Guillemot * @author Ahmed Ashour * @author Sudhan Moghe + * @author Frank Danek */ @RunWith(BrowserRunner.class) public class HTMLParserTest extends SimpleWebTestCase { @@ -62,80 +60,6 @@ } /** - * Tests that inserted TBODY and TFOOT don't conflict. - * @throws Exception failure - */ - @Test - @Alerts("TABLE") - public void table_tfoot() throws Exception { - final String html = "<html><body>" - + "<table><tr><td>hello</td></tr>\n" - + "<tfoot id='tf'><tr><td>foot</td></tr></tfoot>" - + "</table>\n" - + "<script>\n" - + "alert(document.getElementById('tf').parentNode.nodeName)\n" - + "</script>\n" - + "</body></html>"; - - loadPageWithAlerts(html); - } - - /** - * Test for the condition when there is a <tt><form></tt> inside of a <tt><table></tt> and before - * a <tt><tr></tt>. - * @throws Exception failure - */ - @Test - @Alerts("myForm") - public void badlyFormedHTML() throws Exception { - final String html - = "<html><head><title>first</title>\n" - + " <script>\n" - + " function test(){\n" - + " alert(document.getElementById('myInput').form.id);\n" - + " }\n" - + " </script>\n" - + "</head>\n" - + "<body onload='test()'>\n" - + " <table>\n" - + " <form name='myForm' action='foo' id='myForm'>\n" - + " <tr><td>\n" - + " <input type='text' name='myInput' id='myInput'/>\n" - + " </td></tr>\n" - + " </form>\n" - + " </table>\n" - + "</body></html>"; - - loadPageWithAlerts(html); - } - - /** - * Test when an illegal tag is found in head as some websites do. - * @throws Exception failure - */ - @Test - @Alerts("first") - public void unknownTagInHead() throws Exception { - // Note: the <meta> tag in this test is quite important because - // I could adapt the TagBalancer to make it work except with this <meta http-equiv... - // (it worked with <meta name=...) - final String html - = "<html><head><mainA3>\n" - + " <meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>\n" - + " <title>first</title>\n" - + " <script>\n" - + " function test(){\n" - + " alert(document.title);\n" - + " }\n" - + " </script>\n" - + "</head>\n" - + "<body onload='test()'>\n" - + "</body></html>"; - - loadPageWithAlerts(html); - } - - /** * Works since NekoHtml 0.9.5. * @exception Exception If the test fails */ @@ -149,290 +73,6 @@ } /** - * @throws Exception failure - */ - @Test - @Alerts({"false", "true" }) - public void duplicatedAttribute() throws Exception { - final String html - = "<html><head>\n" - + "</head>\n" - + " <script>\n" - + " function test() {\n" - + " alert(document.getElementById('foo') == null);\n" - + " alert(document.getElementById('bla') == null);\n" - + " }\n" - + " </script>\n" - + "</head>\n" - + "<body onload='test()'>\n" - + " <span id='foo' id='bla'></span>" - + "</body></html>"; - - loadPageWithAlerts(html); - } - - /** - * @throws Exception failure - */ - @Test - @Alerts(IE = {"1", "3", "[object HTMLScriptElement]", - "[object HTMLGenericElement]", "[object HTMLGenericElement]", "[object HTM... [truncated message content] |
From: <rb...@us...> - 2013-12-23 18:52:33
|
Revision: 8907 http://sourceforge.net/p/htmlunit/code/8907 Author: rbri Date: 2013-12-23 18:52:30 +0000 (Mon, 23 Dec 2013) Log Message: ----------- use inheritance instead of string compare Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFrameSetElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLHeadElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLHtmlElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableColElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableRowElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableSectionElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTitleElement.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-12-23 15:30:15 UTC (rev 8906) +++ trunk/htmlunit/src/changes/changes.xml 2013-12-23 18:52:30 UTC (rev 8907) @@ -9,6 +9,15 @@ <body> <release version="2.14" date="???" description="Bugfixes"> <action type="fix" dev="rbri" due-to="Frank Danek"> + Some more tests converted into WebDriverTestCase. + </action> + <action type="fix" dev="rbri" due-to="Frank Danek"> + Improved HTML parsing to be more compatible with real browsers. + </action> + <action type="fix" dev="rbri" due-to="Frank Danek"> + JavaScript: Processing of events for checkbox, radiobutton and select fixed. + </action> + <action type="fix" dev="rbri" due-to="Frank Danek"> JavaScript: namespaceURI returns the correct value for html elements. </action> <action type="fix" dev="asashour" issue="1563"> 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-12-23 15:30:15 UTC (rev 8906) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-12-23 18:52:30 UTC (rev 8907) @@ -31,7 +31,6 @@ 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; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_CREATES_DOC_FRAGMENT_AS_PARENT; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_READONLY_FOR_SOME_TAGS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_REDUCE_WHITESPACES; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_NATIVE_FUNCTION_TOSTRING_NEW_LINE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_OFFSET_PARENT_THROWS_NOT_ATTACHED; @@ -381,14 +380,6 @@ private String chOff_ = ""; /** - * The tag names of the objects for which innerHTML is read only in IE - */ - private static final List<String> INNER_HTML_READONLY_IN_IE = - Arrays.asList(new String[] { - "col", "colgroup", "frameset", "head", "html", "style", "table", - "tbody", "tfoot", "thead", "title", "tr"}); - - /** * The tag names of the objects for which innerText is read only */ private static final List<String> INNER_TEXT_READONLY = @@ -975,12 +966,7 @@ @JsxSetter public void setInnerHTML(final Object value) { final DomNode domNode = getDomNodeOrDie(); - final boolean readonly = getBrowserVersion().hasFeature(JS_INNER_HTML_READONLY_FOR_SOME_TAGS); - if (readonly && INNER_HTML_READONLY_IN_IE.contains(domNode.getNodeName())) { - throw Context.reportRuntimeError("innerHTML is read-only for tag " + domNode.getNodeName()); - } - domNode.removeAllChildren(); // null && IE -> add child Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFrameSetElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFrameSetElement.java 2013-12-23 15:30:15 UTC (rev 8906) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFrameSetElement.java 2013-12-23 18:52:30 UTC (rev 8907) @@ -14,7 +14,9 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.html; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_READONLY_FOR_SOME_TAGS; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; +import net.sourceforge.htmlunit.corejs.javascript.Context; import com.gargoylesoftware.htmlunit.html.HtmlFrameSet; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; @@ -28,6 +30,7 @@ * @version $Revision$ * @author Bruce Chapman * @author Ahmed Ashour + * @author Ronald Brill */ @JsxClass(domClass = HtmlFrameSet.class) public class HTMLFrameSetElement extends HTMLElement { @@ -99,4 +102,17 @@ public void setBorder(final String border) { getDomNodeOrDie().setAttribute("border", border); } + + /** + * Overwritten to throw an exception in IE8/9. + * @param value the new value for the contents of this node + */ + @JsxSetter + @Override + public void setInnerHTML(final Object value) { + if (getBrowserVersion().hasFeature(JS_INNER_HTML_READONLY_FOR_SOME_TAGS)) { + throw Context.reportRuntimeError("innerHTML is read-only for tag 'frameset'"); + } + super.setInnerHTML(value); + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLHeadElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLHeadElement.java 2013-12-23 15:30:15 UTC (rev 8906) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLHeadElement.java 2013-12-23 18:52:30 UTC (rev 8907) @@ -14,16 +14,33 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.html; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_READONLY_FOR_SOME_TAGS; +import net.sourceforge.htmlunit.corejs.javascript.Context; + import com.gargoylesoftware.htmlunit.html.HtmlHead; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; /** * The JavaScript object "HTMLHeadElement". * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ @JsxClass(domClass = HtmlHead.class) public class HTMLHeadElement extends HTMLElement { + /** + * Overwritten to throw an exception in IE8/9. + * @param value the new value for the contents of this node + */ + @JsxSetter + @Override + public void setInnerHTML(final Object value) { + if (getBrowserVersion().hasFeature(JS_INNER_HTML_READONLY_FOR_SOME_TAGS)) { + throw Context.reportRuntimeError("innerHTML is read-only for tag 'head'"); + } + super.setInnerHTML(value); + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLHtmlElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLHtmlElement.java 2013-12-23 15:30:15 UTC (rev 8906) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLHtmlElement.java 2013-12-23 18:52:30 UTC (rev 8907) @@ -15,9 +15,12 @@ package com.gargoylesoftware.htmlunit.javascript.host.html; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_BOUNDING_CLIENT_RECT_OFFSET_TWO; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_READONLY_FOR_SOME_TAGS; +import net.sourceforge.htmlunit.corejs.javascript.Context; import com.gargoylesoftware.htmlunit.html.HtmlHtml; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; /** * The JavaScript object "HTMLHtmlElement". @@ -25,6 +28,7 @@ * @version $Revision$ * @author Ahmed Ashour * @author Marc Guillemot + * @author Ronald Brill */ @JsxClass(domClass = HtmlHtml.class) public class HTMLHtmlElement extends HTMLElement { @@ -70,5 +74,18 @@ } return super.getClientTop(); } + + /** + * Overwritten to throw an exception in IE8/9. + * @param value the new value for the contents of this node + */ + @JsxSetter + @Override + public void setInnerHTML(final Object value) { + if (getBrowserVersion().hasFeature(JS_INNER_HTML_READONLY_FOR_SOME_TAGS)) { + throw Context.reportRuntimeError("innerHTML is read-only for tag 'html'"); + } + super.setInnerHTML(value); + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java 2013-12-23 15:30:15 UTC (rev 8906) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java 2013-12-23 18:52:30 UTC (rev 8907) @@ -14,11 +14,14 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.html; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_READONLY_FOR_SOME_TAGS; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import java.io.StringReader; +import net.sourceforge.htmlunit.corejs.javascript.Context; + import org.w3c.css.sac.InputSource; import com.gargoylesoftware.htmlunit.Cache; @@ -111,4 +114,17 @@ final HtmlStyle style = (HtmlStyle) getDomNodeOrDie(); return style.getAttribute("media"); } + + /** + * Overwritten to throw an exception in IE8/9. + * @param value the new value for the contents of this node + */ + @JsxSetter + @Override + public void setInnerHTML(final Object value) { + if (getBrowserVersion().hasFeature(JS_INNER_HTML_READONLY_FOR_SOME_TAGS)) { + throw Context.reportRuntimeError("innerHTML is read-only for tag 'style'"); + } + super.setInnerHTML(value); + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableColElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableColElement.java 2013-12-23 15:30:15 UTC (rev 8906) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableColElement.java 2013-12-23 18:52:30 UTC (rev 8907) @@ -14,6 +14,7 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.html; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_READONLY_FOR_SOME_TAGS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures. JS_TABLE_COLUMN_SPAN_THROWS_EXCEPTION_IF_LESS_THAN_ONE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures. @@ -107,4 +108,18 @@ protected boolean isEndTagForbidden() { return getDomNodeOrDie() instanceof HtmlTableColumn; } + + /** + * Overwritten to throw an exception in IE8/9. + * @param value the new value for the contents of this node + */ + @JsxSetter + @Override + public void setInnerHTML(final Object value) { + if (getBrowserVersion().hasFeature(JS_INNER_HTML_READONLY_FOR_SOME_TAGS)) { + throw Context.reportRuntimeError("innerHTML is read-only for tag '" + + getDomNodeOrDie().getNodeName() + "'"); + } + super.setInnerHTML(value); + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableElement.java 2013-12-23 15:30:15 UTC (rev 8906) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableElement.java 2013-12-23 18:52:30 UTC (rev 8907) @@ -14,6 +14,7 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.html; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_READONLY_FOR_SOME_TAGS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures. JS_TABLE_SET_CAPTION_ALTHOUGH_ALREADY_SET_THROWS_ERROR; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_TABLE_SET_TFOOT_ALTHOUGH_ALREADY_SET_THROWS_ERROR; @@ -374,4 +375,17 @@ public void setBgColor(final String bgColor) { setColorAttribute("bgColor", bgColor); } + + /** + * Overwritten to throw an exception in IE8/9. + * @param value the new value for the contents of this node + */ + @JsxSetter + @Override + public void setInnerHTML(final Object value) { + if (getBrowserVersion().hasFeature(JS_INNER_HTML_READONLY_FOR_SOME_TAGS)) { + throw Context.reportRuntimeError("innerHTML is read-only for tag 'table'"); + } + super.setInnerHTML(value); + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableRowElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableRowElement.java 2013-12-23 15:30:15 UTC (rev 8906) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableRowElement.java 2013-12-23 18:52:30 UTC (rev 8907) @@ -15,6 +15,7 @@ package com.gargoylesoftware.htmlunit.javascript.host.html; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_172; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_READONLY_FOR_SOME_TAGS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_TABLE_ROW_SECTION_INDEX_BIG_INT_IF_UNATTACHED; import java.util.ArrayList; @@ -190,4 +191,17 @@ htmlRow.getCell(position).remove(); } + + /** + * Overwritten to throw an exception in IE8/9. + * @param value the new value for the contents of this node + */ + @JsxSetter + @Override + public void setInnerHTML(final Object value) { + if (getBrowserVersion().hasFeature(JS_INNER_HTML_READONLY_FOR_SOME_TAGS)) { + throw Context.reportRuntimeError("innerHTML is read-only for tag 'tr'"); + } + super.setInnerHTML(value); + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableSectionElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableSectionElement.java 2013-12-23 15:30:15 UTC (rev 8906) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableSectionElement.java 2013-12-23 18:52:30 UTC (rev 8907) @@ -14,7 +14,9 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.html; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_READONLY_FOR_SOME_TAGS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_TABLE_VALIGN_SUPPORTS_IE_VALUES; +import net.sourceforge.htmlunit.corejs.javascript.Context; import com.gargoylesoftware.htmlunit.html.HtmlTableBody; import com.gargoylesoftware.htmlunit.html.HtmlTableFooter; @@ -119,4 +121,18 @@ public void setChOff(final String chOff) { super.setChOff(chOff); } + + /** + * Overwritten to throw an exception in IE8/9. + * @param value the new value for the contents of this node + */ + @JsxSetter + @Override + public void setInnerHTML(final Object value) { + if (getBrowserVersion().hasFeature(JS_INNER_HTML_READONLY_FOR_SOME_TAGS)) { + throw Context.reportRuntimeError("innerHTML is read-only for tag '" + + getDomNodeOrDie().getNodeName() + "'"); + } + super.setInnerHTML(value); + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTitleElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTitleElement.java 2013-12-23 15:30:15 UTC (rev 8906) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTitleElement.java 2013-12-23 18:52:30 UTC (rev 8907) @@ -14,6 +14,9 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.html; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_READONLY_FOR_SOME_TAGS; +import net.sourceforge.htmlunit.corejs.javascript.Context; + import com.gargoylesoftware.htmlunit.html.DomNode; import com.gargoylesoftware.htmlunit.html.DomText; import com.gargoylesoftware.htmlunit.html.HtmlTitle; @@ -27,6 +30,7 @@ * @version $Revision$ * @author Ahmed Ashour * @author Sudhan Moghe + * @author Ronald Brill */ @JsxClass(domClass = HtmlTitle.class) public class HTMLTitleElement extends HTMLElement { @@ -61,4 +65,17 @@ firstChild.setNodeValue(text); } } + + /** + * Overwritten to throw an exception in IE8/9. + * @param value the new value for the contents of this node + */ + @JsxSetter + @Override + public void setInnerHTML(final Object value) { + if (getBrowserVersion().hasFeature(JS_INNER_HTML_READONLY_FOR_SOME_TAGS)) { + throw Context.reportRuntimeError("innerHTML is read-only for tag 'title'"); + } + super.setInnerHTML(value); + } } |
From: <rb...@us...> - 2013-12-30 11:56:56
|
Revision: 8919 http://sourceforge.net/p/htmlunit/code/8919 Author: rbri Date: 2013-12-30 11:56:52 +0000 (Mon, 30 Dec 2013) Log Message: ----------- Return value fixed for element.height and element.width when element is not attached to the page. Element.currentStyle returns null for elements not attached to the page. This fixes also some jQuery tests Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.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/test/java/com/gargoylesoftware/htmlunit/javascript/host/ElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/JQuery182Test.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-12-29 18:52:56 UTC (rev 8918) +++ trunk/htmlunit/src/changes/changes.xml 2013-12-30 11:56:52 UTC (rev 8919) @@ -8,6 +8,12 @@ <body> <release version="2.14" date="???" description="Bugfixes"> + <action type="fix" dev="rbri"> + Return value fixed for element.height and element.width when element is not attached to the page. + </action> + <action type="fix" dev="rbri"> + Element.currentStyle returns null for elements not attached to the page. + </action> <action type="update" dev="rbri"> Upgrade commons-codec to 1.9. </action> 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-12-29 18:52:56 UTC (rev 8918) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java 2013-12-30 11:56:52 UTC (rev 8919) @@ -543,6 +543,9 @@ */ @JsxGetter(@WebBrowser(IE)) public ComputedCSSStyleDeclaration getCurrentStyle() { + if (!getDomNodeOrDie().isDirectlyAttachedToPage()) { + return null; + } return getWindow().getComputedStyle(this, null); } 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-12-29 18:52:56 UTC (rev 8918) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2013-12-30 11:56:52 UTC (rev 8919) @@ -4466,7 +4466,7 @@ * @return the CSS attribute value for the specified element */ public final String get(final Element element) { - final ComputedCSSStyleDeclaration style = element.getCurrentStyle(); + final ComputedCSSStyleDeclaration style = element.getWindow().getComputedStyle(element, null); final String value = get(style); return value; } 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-12-29 18:52:56 UTC (rev 8918) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java 2013-12-30 11:56:52 UTC (rev 8919) @@ -602,7 +602,8 @@ if (value.isEmpty()) { final Element parent = getElement().getParentElement(); if (parent != null) { - value = parent.getCurrentStyle().getFontSize(); + final ComputedCSSStyleDeclaration style = parent.getWindow().getComputedStyle(parent, null); + value = style.getFontSize(); } } if (value.isEmpty()) { @@ -660,7 +661,12 @@ */ @Override public String getHeight() { - return pixelString(getElement(), new CssValue(getElement().getWindow().getWebWindow().getInnerHeight()) { + final Element elem = getElement(); + if (!elem.getDomNodeOrDie().isDirectlyAttachedToPage()) { + return "auto"; + } + final int windowHeight = elem.getWindow().getWebWindow().getInnerHeight(); + return pixelString(elem, new CssValue(windowHeight) { @Override public String get(final ComputedCSSStyleDeclaration style) { return defaultIfEmpty(style.getStyleAttribute("height"), "362px"); } @@ -1026,29 +1032,32 @@ if ("none".equals(getDisplay())) { return "auto"; } - final int windowWidth = getElement().getWindow().getWebWindow().getInnerWidth(); - final String defaultWidth; - if (getBrowserVersion().hasFeature(CSS_DEFAULT_WIDTH_AUTO)) { - defaultWidth = "auto"; + + final Element elem = getElement(); + if (!elem.getDomNodeOrDie().isDirectlyAttachedToPage()) { + return "auto"; } - else { - defaultWidth = windowWidth + "px"; - } - return pixelString(getElement(), new CssValue(windowWidth) { - @Override public String get(final ComputedCSSStyleDeclaration style) { + + final int windowWidth = elem.getWindow().getWebWindow().getInnerWidth(); + return pixelString(elem, new CssValue(windowWidth) { + @Override + public String get(final ComputedCSSStyleDeclaration style) { final String value = style.getStyleAttribute(WIDTH); if (StringUtils.isEmpty(value)) { - if (!getBrowserVersion().hasFeature(CSS_DEFAULT_WIDTH_AUTO) - && "absolute".equals(getStyleAttribute("position"))) { - final DomNode domNode = getDomNodeOrDie(); - final String content = domNode.getTextContent(); + if (getBrowserVersion().hasFeature(CSS_DEFAULT_WIDTH_AUTO)) { + return "auto"; + } + + if ("absolute".equals(getStyleAttribute("position"))) { + final String content = getDomNodeOrDie().getTextContent(); // do this only for small content // at least for empty div's this is more correct if (null != content && (content.length() < 13)) { return (content.length() * 7) + "px"; } } - return defaultWidth; + + return getWindowDefaultValue() + "px"; } return value; } @@ -1176,7 +1185,8 @@ for (final DomNode child : childs) { if (child.getScriptObject() instanceof HTMLElement) { final HTMLElement e = (HTMLElement) child.getScriptObject(); - final int w = e.getCurrentStyle().getCalculatedWidth(true, true); + final ComputedCSSStyleDeclaration style = e.getWindow().getComputedStyle(e, null); + final int w = style.getCalculatedWidth(true, true); width += w; } else if (child.getScriptObject() instanceof Text) { @@ -1332,7 +1342,7 @@ final ScriptableObject scriptObj = child.getScriptObject(); if (scriptObj instanceof HTMLElement) { final HTMLElement e = (HTMLElement) scriptObj; - final ComputedCSSStyleDeclaration style = e.getCurrentStyle(); + final ComputedCSSStyleDeclaration style = e.getWindow().getComputedStyle(e, null); final String pos = style.getPositionWithInheritance(); if ("static".equals(pos) || "relative".equals(pos)) { lastFlowing = style; @@ -1426,7 +1436,7 @@ } if (prev != null) { final HTMLElement e = (HTMLElement) ((HtmlElement) prev).getScriptObject(); - final ComputedCSSStyleDeclaration style = e.getCurrentStyle(); + final ComputedCSSStyleDeclaration style = e.getWindow().getComputedStyle(e, null); top = style.getTop(true, false, false) + style.getCalculatedHeight(true, true); } // If the position is relative, we also need to add the specified "top" displacement. @@ -1483,13 +1493,15 @@ else if ("absolute".equals(p) && !"auto".equals(r)) { // Need to calculate the horizontal displacement caused by *all* siblings. final HTMLElement parent = (HTMLElement) getElement().getParentElement(); - final int parentWidth = parent.getCurrentStyle().getCalculatedWidth(false, false); + final ComputedCSSStyleDeclaration style = parent.getWindow().getComputedStyle(parent, null); + final int parentWidth = style.getCalculatedWidth(false, false); left = parentWidth - pixelValue(r); } else if ("fixed".equals(p) && "auto".equals(l)) { // Fixed to the location at which the browser puts it via normal element flowing. final HTMLElement parent = (HTMLElement) getElement().getParentElement(); - left = pixelValue(parent.getCurrentStyle().getLeftWithInheritance()); + final ComputedCSSStyleDeclaration style = parent.getWindow().getComputedStyle(parent, null); + left = pixelValue(style.getLeftWithInheritance()); } else if ("static".equals(p)) { // We need to calculate the horizontal displacement caused by *previous* siblings. @@ -1497,7 +1509,7 @@ for (DomNode n = getDomNodeOrDie(); n != null; n = n.getPreviousSibling()) { if (n.getScriptObject() instanceof HTMLElement) { final HTMLElement e = (HTMLElement) n.getScriptObject(); - final ComputedCSSStyleDeclaration style = e.getCurrentStyle(); + final ComputedCSSStyleDeclaration style = e.getWindow().getComputedStyle(e, null); final String d = style.getDisplay(); if ("block".equals(d)) { break; @@ -1546,7 +1558,13 @@ if ("inherit".equals(p)) { if (getBrowserVersion().hasFeature(CAN_INHERIT_CSS_PROPERTY_VALUES)) { final HTMLElement parent = (HTMLElement) getElement().getParentElement(); - p = (parent != null ? parent.getCurrentStyle().getPositionWithInheritance() : "static"); + if (parent == null) { + p = "static"; + } + else { + final ComputedCSSStyleDeclaration style = parent.getWindow().getComputedStyle(parent, null); + p = style.getPositionWithInheritance(); + } } else { p = "static"; @@ -1564,7 +1582,13 @@ if ("inherit".equals(left)) { if (getBrowserVersion().hasFeature(CAN_INHERIT_CSS_PROPERTY_VALUES)) { final HTMLElement parent = (HTMLElement) getElement().getParentElement(); - left = (parent != null ? parent.getCurrentStyle().getLeftWithInheritance() : "auto"); + if (parent == null) { + left = "auto"; + } + else { + final ComputedCSSStyleDeclaration style = parent.getWindow().getComputedStyle(parent, null); + left = style.getLeftWithInheritance(); + } } else { left = "auto"; @@ -1582,7 +1606,13 @@ if ("inherit".equals(right)) { if (getBrowserVersion().hasFeature(CAN_INHERIT_CSS_PROPERTY_VALUES)) { final HTMLElement parent = (HTMLElement) getElement().getParentElement(); - right = (parent != null ? parent.getCurrentStyle().getRightWithInheritance() : "auto"); + if (parent == null) { + right = "auto"; + } + else { + final ComputedCSSStyleDeclaration style = parent.getWindow().getComputedStyle(parent, null); + right = style.getRightWithInheritance(); + } } else { right = "auto"; @@ -1600,7 +1630,13 @@ if ("inherit".equals(top)) { if (getBrowserVersion().hasFeature(CAN_INHERIT_CSS_PROPERTY_VALUES)) { final HTMLElement parent = (HTMLElement) getElement().getParentElement(); - top = (parent != null ? parent.getCurrentStyle().getTopWithInheritance() : "auto"); + if (parent == null) { + top = "auto"; + } + else { + final ComputedCSSStyleDeclaration style = parent.getWindow().getComputedStyle(parent, null); + top = style.getTopWithInheritance(); + } } else { top = "auto"; @@ -1618,7 +1654,13 @@ if ("inherit".equals(bottom)) { if (getBrowserVersion().hasFeature(CAN_INHERIT_CSS_PROPERTY_VALUES)) { final HTMLElement parent = (HTMLElement) getElement().getParentElement(); - bottom = (parent != null ? parent.getCurrentStyle().getBottomWithInheritance() : "auto"); + if (parent == null) { + bottom = "auto"; + } + else { + final ComputedCSSStyleDeclaration style = parent.getWindow().getComputedStyle(parent, null); + bottom = style.getBottomWithInheritance(); + } } else { bottom = "auto"; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ElementTest.java 2013-12-29 18:52:56 UTC (rev 8918) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ElementTest.java 2013-12-30 11:56:52 UTC (rev 8919) @@ -1109,4 +1109,26 @@ loadPageWithAlerts2(html); } + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = { "undefined", "undefined" }, IE = { "available", "null" }) + public void currentStyle() throws Exception { + final String html = "<html>\n" + + "<head>\n" + + " <script>\n" + + " function test() {\n" + + " var e = document.getElementById('tester');\n" + + " alert(e.currentStyle ? 'available' : e.currentStyle);\n" + + " e = document.createElement('div');\n" + + " alert(e.currentStyle ? 'available' : e.currentStyle);\n" + + " }\n" + + " </script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + " <div id='tester'></div>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java 2013-12-29 18:52:56 UTC (rev 8918) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java 2013-12-30 11:56:52 UTC (rev 8919) @@ -1219,6 +1219,28 @@ } /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = { "auto", "auto" }, IE8 = { "-", "-" }) + public void widthAndHeightDisconnected() throws Exception { + final String html = "<html>\n" + + "<head>\n" + + " <script>\n" + + " function test() {\n" + + " var e = document.createElement('div');\n" + + " var style = window.getComputedStyle ? window.getComputedStyle(e, null) : e.currentStyle;\n" + + " alert(style ? style.width : '-');\n" + + " alert(style ? style.height : '-');\n" + + " }\n" + + " </script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** * @throws Exception if the test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/JQuery182Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/JQuery182Test.java 2013-12-29 18:52:56 UTC (rev 8918) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/JQuery182Test.java 2013-12-30 11:56:52 UTC (rev 8919) @@ -6523,7 +6523,6 @@ */ @Test @Alerts("0, 6, 6") - @NotYetImplemented(FF) public void dimensions__innerWidth__() throws Exception { runTest("dimensions: innerWidth()"); } @@ -6534,7 +6533,6 @@ */ @Test @Alerts("0, 6, 6") - @NotYetImplemented public void dimensions__innerHeight__() throws Exception { runTest("dimensions: innerHeight()"); } @@ -6545,7 +6543,6 @@ */ @Test @Alerts("0, 11, 11") - @NotYetImplemented(FF) public void dimensions__outerWidth__() throws Exception { runTest("dimensions: outerWidth()"); } @@ -6596,7 +6593,6 @@ */ @Test @Alerts("0, 11, 11") - @NotYetImplemented public void dimensions__outerHeight__() throws Exception { runTest("dimensions: outerHeight()"); } |
From: <rb...@us...> - 2013-12-31 14:18:19
|
Revision: 8923 http://sourceforge.net/p/htmlunit/code/8923 Author: rbri Date: 2013-12-31 14:18:16 +0000 (Tue, 31 Dec 2013) Log Message: ----------- String.contains() added for FF18 and later Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/StringCustom.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeStringTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-12-31 09:07:37 UTC (rev 8922) +++ trunk/htmlunit/src/changes/changes.xml 2013-12-31 14:18:16 UTC (rev 8923) @@ -8,6 +8,9 @@ <body> <release version="2.14" date="???" description="Bugfixes"> + <action type="add" dev="rbri"> + JavaScript: String.contains() added for FF18 and later. + </action> <action type="fix" dev="rbri"> Return value fixed for element.height and element.width when element is not attached to the page. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-31 09:07:37 UTC (rev 8922) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-31 14:18:16 UTC (rev 8923) @@ -1410,6 +1410,10 @@ @BrowserFeature(@WebBrowser(FF)) SET_READONLY_PROPERTIES, + /** Indicates that string.contains() is supported. */ + @BrowserFeature(@WebBrowser(value = FF, minVersion = 18)) + STRING_CONTAINS, + /** Indicates that string.trim() is supported. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 11) }) STRING_TRIM, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java 2013-12-31 09:07:37 UTC (rev 8922) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java 2013-12-31 14:18:16 UTC (rev 8923) @@ -24,6 +24,7 @@ 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; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.STRING_CONTAINS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.STRING_TRIM; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.STRING_TRIM_LEFT_RIGHT; @@ -296,6 +297,12 @@ stringPrototype.defineFunctionProperties(new String[] {"trimLeft", "trimRight"}, StringCustom.class, ScriptableObject.EMPTY); } + if (browserVersion.hasFeature(STRING_CONTAINS)) { + final ScriptableObject stringPrototype = + (ScriptableObject) ScriptableObject.getClassPrototype(window, "String"); + stringPrototype.defineFunctionProperties(new String[] {"contains"}, + StringCustom.class, ScriptableObject.EMPTY); + } if (!browserVersion.hasFeature(JS_FUNCTION_BIND)) { removePrototypeProperties(window, "Function", "bind"); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/StringCustom.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/StringCustom.java 2013-12-31 09:07:37 UTC (rev 8922) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/StringCustom.java 2013-12-31 14:18:16 UTC (rev 8923) @@ -24,6 +24,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Ronald Brill */ public final class StringCustom { @@ -72,4 +73,29 @@ } return string.substring(0, end); } + + /** + * Determines whether one string may be found within another string, + * returning true or false as appropriate. + * @param context the JavaScript context + * @param thisObj the scriptable + * @param args the arguments passed into the method + * @param function the function + * @return true or false + */ + public static boolean contains( + final Context context, final Scriptable thisObj, final Object[] args, final Function function) { + if (args.length < 1) { + return false; + } + final String string = Context.toString(thisObj); + final String search = Context.toString(args[0]); + + if (args.length < 2) { + return string.contains(search); + } + + final int start = (int) Math.max(0, Context.toNumber(args[1])); + return string.indexOf(search, start) > -1; + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeStringTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeStringTest.java 2013-12-31 09:07:37 UTC (rev 8922) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeStringTest.java 2013-12-31 14:18:16 UTC (rev 8923) @@ -155,4 +155,43 @@ loadPageWithAlerts2(html); } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = "contains not supported", + FF24 = { "true", "false", "true", "true", "true", "false", "true", "true", "true", "false", + "true", "true", "false", "false" }) + public void contains() throws Exception { + final String html + = "<!DOCTYPE html>\n" + + "<html><head><title>foo</title><script>\n" + + "function doTest() {\n" + + " if ('contains' in String.prototype) {" + + " var str = 'To be, or not to be, that is the question.';\n" + + " alert(str.contains('To be'));\n" + + " alert(str.contains('TO'));\n" + + " alert(str.contains(''));\n" + + " alert(str.contains(' '));\n" + + " alert(str.contains('To be', 0));\n" + + " alert(str.contains('TO', 0));\n" + + " alert(str.contains(' ', 0));\n" + + " alert(str.contains('', 0));\n" + + " alert(str.contains('or', 7));\n" + + " alert(str.contains('or', 8));\n" + + + " alert(str.contains('or', -3));\n" + + " alert(str.contains('or', 7.9));\n" + + " alert(str.contains('or', 8.1));\n" + + " alert(str.contains());\n" + + " } else {\n" + + " alert('contains not supported');\n" + + " }\n" + + "}\n" + + "</script></head><body onload='doTest()'>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } } |
From: <rb...@us...> - 2013-12-31 15:38:52
|
Revision: 8924 http://sourceforge.net/p/htmlunit/code/8924 Author: rbri Date: 2013-12-31 15:38:50 +0000 (Tue, 31 Dec 2013) Log Message: ----------- XMLHttpRequest event processing fixed for FF24 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-12-31 14:18:16 UTC (rev 8923) +++ trunk/htmlunit/src/changes/changes.xml 2013-12-31 15:38:50 UTC (rev 8924) @@ -7,7 +7,13 @@ </properties> <body> - <release version="2.14" date="???" description="Bugfixes"> + <release version="2.14" date="???" description="Bugfixes, initial work on FF24 and IE11"> + <action type="fix" dev="rbri"> + JavaScript: XMLHttpRequest event processing fixed for FF24. + </action> + <action type="fix" dev="rbri"> + Return value fixed for element.height and element.width when element is not attached to the page. + </action> <action type="add" dev="rbri"> JavaScript: String.contains() added for FF18 and later. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-31 14:18:16 UTC (rev 8923) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-31 15:38:50 UTC (rev 8924) @@ -1494,6 +1494,12 @@ @BrowserFeature(@WebBrowser(IE)) XHR_ERRORHANDLER_NOT_SUPPORTED, + /** XMLHttpRequest triggers the opened event at the beginning of the send + * method again. + */ + @BrowserFeature({ @WebBrowser(IE), @WebBrowser(value = FF, maxVersion = 17) }) + XHR_FIRE_STATE_OPENED_AGAIN_IN_ASYNC_MODE, + /** Indicates if a same origin check should be skipped. */ @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME), @WebBrowser(value = IE, minVersion = 8) }) XHR_IGNORE_SAME_ORIGIN, 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-12-31 14:18:16 UTC (rev 8923) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java 2013-12-31 15:38:50 UTC (rev 8924) @@ -15,6 +15,7 @@ package com.gargoylesoftware.htmlunit.javascript.host.xml; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_ERRORHANDLER_NOT_SUPPORTED; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.XHR_FIRE_STATE_OPENED_AGAIN_IN_ASYNC_MODE; 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; @@ -586,9 +587,11 @@ doSend(Context.getCurrentContext()); } else { - // quite strange but IE and FF seem both to fire state loading twice - // in async mode (at least with HTML of the unit tests) - setState(STATE_OPENED, Context.getCurrentContext()); + if (getBrowserVersion().hasFeature(XHR_FIRE_STATE_OPENED_AGAIN_IN_ASYNC_MODE)) { + // quite strange but IE and FF seem both to fire state loading twice + // in async mode (at least with HTML of the unit tests) + setState(STATE_OPENED, Context.getCurrentContext()); + } // Create and start a thread in which to execute the request. final Scriptable startingScope = getWindow(); |
From: <rb...@us...> - 2013-12-31 15:47:41
|
Revision: 8925 http://sourceforge.net/p/htmlunit/code/8925 Author: rbri Date: 2013-12-31 15:47:37 +0000 (Tue, 31 Dec 2013) Log Message: ----------- Node.attributes is no longer supported (since FF22). Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-12-31 15:38:50 UTC (rev 8924) +++ trunk/htmlunit/src/changes/changes.xml 2013-12-31 15:47:37 UTC (rev 8925) @@ -9,6 +9,9 @@ <body> <release version="2.14" date="???" description="Bugfixes, initial work on FF24 and IE11"> <action type="fix" dev="rbri"> + JavaScript: Node.attributes is no longer supported (since FF22). + </action> + <action type="fix" dev="rbri"> JavaScript: XMLHttpRequest event processing fixed for FF24. </action> <action type="fix" dev="rbri"> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java 2013-12-31 15:38:50 UTC (rev 8924) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java 2013-12-31 15:47:37 UTC (rev 8925) @@ -1024,7 +1024,7 @@ * @see <a href="https://developer.mozilla.org/en-US/docs/DOM/Node.attributes">Gecko DOM Reference</a> * @return the attributes of this XML element */ - @JsxGetter + @JsxGetter({ @WebBrowser(IE), @WebBrowser(value = FF, maxVersion = 21) }) public Object getAttributes() { return null; } |
From: <rb...@us...> - 2013-12-31 16:04:32
|
Revision: 8927 http://sourceforge.net/p/htmlunit/code/8927 Author: rbri Date: 2013-12-31 16:04:29 +0000 (Tue, 31 Dec 2013) Log Message: ----------- Window.opener is setable from javascript (FF24) Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-12-31 15:57:43 UTC (rev 8926) +++ trunk/htmlunit/src/changes/changes.xml 2013-12-31 16:04:29 UTC (rev 8927) @@ -9,6 +9,9 @@ <body> <release version="2.14" date="???" description="Bugfixes, initial work on FF24 and IE11"> <action type="fix" dev="rbri"> + JavaScript: Window.opener is setable from javascript (FF24). + </action> + <action type="fix" dev="rbri"> JavaScript: Node.attributes is no longer supported (since FF22). </action> <action type="fix" dev="rbri"> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-31 15:57:43 UTC (rev 8926) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-12-31 16:04:29 UTC (rev 8927) @@ -1297,7 +1297,7 @@ /** Changing the opener of an window to something not null * is not valid (in FF). */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) + @BrowserFeature({ @WebBrowser(value = FF, maxVersion = 17), @WebBrowser(CHROME) }) JS_WINDOW_CHANGE_OPENER_NOT_ALLOWED, /** Support for accessing the frame of a window by id additionally |
From: <asa...@us...> - 2014-01-01 06:42:36
|
Revision: 8932 http://sourceforge.net/p/htmlunit/code/8932 Author: asashour Date: 2014-01-01 06:42:33 +0000 (Wed, 01 Jan 2014) Log Message: ----------- spelling Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequestCORSTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2014-01-01 06:29:37 UTC (rev 8931) +++ trunk/htmlunit/src/changes/changes.xml 2014-01-01 06:42:33 UTC (rev 8932) @@ -9,7 +9,7 @@ <body> <release version="2.14" date="???" description="Bugfixes, initial work on FF24 and IE11"> <action type="fix" dev="rbri"> - JavaScript: Window.opener is setable from javascript (FF24). + JavaScript: Window.opener is settable from javascript (FF24). </action> <action type="fix" dev="rbri"> JavaScript: Node.attributes is no longer supported (since FF22). Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequestCORSTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequestCORSTest.java 2014-01-01 06:29:37 UTC (rev 8931) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequestCORSTest.java 2014-01-01 06:42:33 UTC (rev 8932) @@ -399,7 +399,7 @@ FF17 = { "false", "false", "false", "false" }, IE8 = { "undefined", "undefined", "true", "false" }, IE11 = { "false", "false", "true", "false" }) - public void withCredentials_notSetableInSyncMode() throws Exception { + public void withCredentials_notSettableInSyncMode() throws Exception { final String html = "<html><head>\n" + "<script>\n" + "var xhr = " + XHRInstantiation_ + ";\n" |