From: <asa...@us...> - 2012-11-29 07:18:56
|
Revision: 7804 http://sourceforge.net/p/htmlunit/code/7804 Author: asashour Date: 2012-11-29 07:18:51 +0000 (Thu, 29 Nov 2012) Log Message: ----------- JavaScript: initial support for HTMLBGSoundElement (IE). 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/configuration/JavaScriptConfiguration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSpanElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/JQuery182Test.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLBGSoundElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlBackgroundSoundTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2012-11-29 06:24:12 UTC (rev 7803) +++ trunk/htmlunit/src/changes/changes.xml 2012-11-29 07:18:51 UTC (rev 7804) @@ -8,7 +8,10 @@ <body> <release version="2.12" date="???" description="Bugfixes"> - <action type="fix" dev="rbri"> + <action type="add" dev="asashour"> + JavaScript: initial support for HTMLBGSoundElement (IE). + </action> + <action type="fix" dev="asashour"> JavaScript: HTMLElement.outerHTML to have lower cases for unknown elements (IE). </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 2012-11-29 06:24:12 UTC (rev 7803) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2012-11-29 07:18:51 UTC (rev 7804) @@ -544,6 +544,10 @@ @BrowserFeature(@WebBrowser(value = IE, minVersion = 7)) HTMLABBREVIATED, + /** [object HTMLBGSoundElement]. */ + @BrowserFeature(@WebBrowser(IE)) + HTMLBGSOUND, + /** Indicates that comment nodes should be treated similar to elements, e.g. getElementsByTagName(). */ @BrowserFeature(@WebBrowser(IE)) HTMLCOLLECTION_COMMENT_IS_ELEMENT, 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 2012-11-29 06:24:12 UTC (rev 7803) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java 2012-11-29 07:18:51 UTC (rev 7804) @@ -125,6 +125,7 @@ import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLAppletElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLAreaElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLAudioElement; +import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLBGSoundElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLBRElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLBaseElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLBaseFontElement; @@ -288,7 +289,7 @@ Float32Array.class, Float64Array.class, FormChild.class, FormField.class, Geolocation.class, History.class, HTMLAnchorElement.class, HTMLAppletElement.class, HTMLAreaElement.class, HTMLAudioElement.class, - HTMLBRElement.class, HTMLBaseElement.class, HTMLBaseFontElement.class, + HTMLBRElement.class, HTMLBaseElement.class, HTMLBaseFontElement.class, HTMLBGSoundElement.class, HTMLBodyElement.class, HTMLButtonElement.class, HTMLCanvasElement.class, HTMLCollection.class, HTMLCollectionTags.class, HTMLDListElement.class, HTMLDelElement.class, HTMLDirectoryElement.class, HTMLDivElement.class, HTMLDocument.class, HTMLElement.class, HTMLEmbedElement.class, HTMLFieldSetElement.class, Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLBGSoundElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLBGSoundElement.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLBGSoundElement.java 2012-11-29 07:18:51 UTC (rev 7804) @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2002-2012 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.BrowserVersionFeatures.HTMLBGSOUND; + +import com.gargoylesoftware.htmlunit.html.HtmlBackgroundSound; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; + +/** + * The JavaScript object "HTMLBGSoundElement". + * + * @version $Revision$ + * @author Ahmed Ashour + */ +@JsxClass(domClasses = HtmlBackgroundSound.class) +public class HTMLBGSoundElement extends HTMLElement { + + /** + * {@inheritDoc} + */ + @Override + public String getClassName() { + if (getWindow().getWebWindow() != null && !getBrowserVersion().hasFeature(HTMLBGSOUND)) { + return "HTMLSpanElement"; + } + return super.getClassName(); + } + + /** + * {@inheritDoc} + */ + protected boolean isEndTagForbidden() { + return true; + } + +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLBGSoundElement.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native 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 2012-11-29 06:24:12 UTC (rev 7803) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLSpanElement.java 2012-11-29 07:18:51 UTC (rev 7804) @@ -22,7 +22,6 @@ import com.gargoylesoftware.htmlunit.html.HtmlAbbreviated; import com.gargoylesoftware.htmlunit.html.HtmlAcronym; import com.gargoylesoftware.htmlunit.html.HtmlAddress; -import com.gargoylesoftware.htmlunit.html.HtmlBackgroundSound; import com.gargoylesoftware.htmlunit.html.HtmlBidirectionalOverride; import com.gargoylesoftware.htmlunit.html.HtmlBig; import com.gargoylesoftware.htmlunit.html.HtmlBlink; @@ -62,7 +61,7 @@ * @author Ahmed Ashour * @author Daniel Gredler */ -@JsxClass(domClasses = { HtmlAbbreviated.class, HtmlAcronym.class, HtmlAddress.class, HtmlBackgroundSound.class, +@JsxClass(domClasses = { HtmlAbbreviated.class, HtmlAcronym.class, HtmlAddress.class, HtmlBidirectionalOverride.class, HtmlBig.class, HtmlBold.class, HtmlBlink.class, HtmlCenter.class, HtmlCitation.class, HtmlCode.class, HtmlDefinition.class, HtmlDefinitionDescription.class, HtmlDefinitionTerm.class, HtmlEmphasis.class, HtmlItalic.class, HtmlKeyboard.class, HtmlListing.class, Added: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlBackgroundSoundTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlBackgroundSoundTest.java (rev 0) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlBackgroundSoundTest.java 2012-11-29 07:18:51 UTC (rev 7804) @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2002-2012 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 org.junit.Test; +import org.junit.runner.RunWith; + +import com.gargoylesoftware.htmlunit.BrowserRunner; +import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.SimpleWebTestCase; + +/** + * Tests for {@link HtmlBackgroundSound}. + * + * @version $Revision$ + * @author Ahmed Ashour + */ +@RunWith(BrowserRunner.class) +public class HtmlBackgroundSoundTest extends SimpleWebTestCase { + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(IE = "[object HTMLBGSoundElement]", FF = "[object HTMLSpanElement]", CHROME = "[object HTMLElement]") + public void simpleScriptable() throws Exception { + final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + "<html><head>\n" + + "<script>\n" + + " function test() {\n" + + " alert(document.getElementById('myId'));\n" + + " }\n" + + "</script>\n" + + "</head><body onload='test()'>\n" + + " <bgsound id='myId'/>\n" + + "</body></html>"; + + final HtmlPage page = loadPageWithAlerts(html); + assertTrue(HtmlBackgroundSound.class.isInstance(page.getHtmlElementById("myId"))); + } +} Property changes on: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlBackgroundSoundTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native 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 2012-11-29 06:24:12 UTC (rev 7803) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java 2012-11-29 07:18:51 UTC (rev 7804) @@ -2770,7 +2770,6 @@ */ @Test @Alerts(DEFAULT = "<bgsound>", IE = "<BGSOUND>", FF3_6 = "undefined", FF10 = "undefined") - @NotYetImplemented(IE) public void outerHTML_bgsound() throws Exception { loadPageWithAlerts2(outerHTML("bgsound")); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/JQuery182Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/JQuery182Test.java 2012-11-29 06:24:12 UTC (rev 7803) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/JQuery182Test.java 2012-11-29 07:18:51 UTC (rev 7804) @@ -3911,7 +3911,6 @@ @Test @Alerts(FF3_6 = "manipulation: detach() (0, 9, 9)", FF10 = "manipulation: empty() (0, 3, 3)", CHROME = "manipulation: detach() (0, 9, 9)", IE = "manipulation: detach() (0, 9, 9)") - @NotYetImplemented(IE) public void test_355() throws Exception { runTest(355); } |