From: <asa...@us...> - 2014-01-15 11:16:50
|
Revision: 8975 http://sourceforge.net/p/htmlunit/code/8975 Author: asashour Date: 2014-01-15 11:16:47 +0000 (Wed, 15 Jan 2014) Log Message: ----------- CSSStyleDeclaration: fix serialization of StyleElement. Issue 1569 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/SelectorSpecificity.java Added Paths: ----------- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration4Test.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2014-01-14 20:40:23 UTC (rev 8974) +++ trunk/htmlunit/src/changes/changes.xml 2014-01-15 11:16:47 UTC (rev 8975) @@ -8,6 +8,9 @@ <body> <release version="2.14" date="???" description="FF24, Bugfixes, initial work on IE11"> + <action type="fix" dev="asashour" issue="1569"> + CSSStyleDeclaration: fix serialization of StyleElement. + </action> <action type="fix" dev="asashour"> JavaScript: enumerating ordered numbers first (Chrome, FF and IE11). </action> 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 2014-01-14 20:40:23 UTC (rev 8974) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2014-01-15 11:16:47 UTC (rev 8975) @@ -34,6 +34,7 @@ import java.awt.Color; import java.io.IOException; +import java.io.Serializable; import java.io.StringReader; import java.text.MessageFormat; import java.text.ParseException; @@ -4494,7 +4495,7 @@ * Contains information about a single style element, including its name, its value, and an index which * can be compared against other indices in order to determine precedence. */ - public static class StyleElement implements Comparable<StyleElement> { + public static class StyleElement implements Comparable<StyleElement>, Serializable { private final String name_; private final String value_; private final String priority_; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/SelectorSpecificity.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/SelectorSpecificity.java 2014-01-14 20:40:23 UTC (rev 8974) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/SelectorSpecificity.java 2014-01-15 11:16:47 UTC (rev 8975) @@ -14,6 +14,8 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.css; +import java.io.Serializable; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.css.sac.AttributeCondition; @@ -31,7 +33,7 @@ * @version $Revision$ * @author Marc Guillemot */ -class SelectorSpecificity implements Comparable<SelectorSpecificity> { +class SelectorSpecificity implements Comparable<SelectorSpecificity>, Serializable { private static final Log LOG = LogFactory.getLog(SelectorSpecificity.class); /** * The specificity for declarations made in the style attributes of an element. Added: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration4Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration4Test.java (rev 0) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration4Test.java 2014-01-15 11:16:47 UTC (rev 8975) @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2002-2014 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.css; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import com.gargoylesoftware.htmlunit.BrowserRunner; +import com.gargoylesoftware.htmlunit.SimpleWebTestCase; +import com.gargoylesoftware.htmlunit.html.HtmlPage; + +/** + * Unit tests for {@link CSSStyleDeclaration}. + * + * @version $Revision$ + * @author Ahmed Ashour + */ +@RunWith(BrowserRunner.class) +public class CSSStyleDeclaration4Test extends SimpleWebTestCase { + + /** + * @throws Exception if the test fails + */ + @Test + public void serialize() throws Exception { + final String html + = "<html><head><title>First</title><script>\n" + + "function doTest() {\n" + + " var node = document.getElementById('div1');\n" + + " var style = node.style;\n" + + " alert(style.color);\n" + + " style.color = 'pink';\n" + + " alert(style.color);\n" + + " alert(node.getAttribute('style'));\n" + + "}\n</script></head>\n" + + "<body onload='doTest()'><div id='div1' style='color: black'>foo</div></body></html>"; + + final HtmlPage page = loadPage(html); + clone(page.getWebClient()); + } +} Property changes on: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration4Test.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property 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 |