[prev in list] [next in list] [prev in thread] [next in thread]
List: htmlunit-develop
Subject: [HtmlUnit] SVN: [8450] trunk/htmlunit/src
From: rbri () users ! sourceforge ! net
Date: 2013-08-25 15:42:36
Message-ID: E1VDcSd-0001Ys-Ub () sfs-ml-2 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]
Revision: 8450
http://sourceforge.net/p/htmlunit/code/8450
Author: rbri
Date: 2013-08-25 15:42:34 +0000 (Sun, 25 Aug 2013)
Log Message:
-----------
support for the 'media' property of style elements added
Modified Paths:
--------------
trunk/htmlunit/src/changes/changes.xml
trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java
trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElementTest.java
Modified: trunk/htmlunit/src/changes/changes.xml
===================================================================
--- trunk/htmlunit/src/changes/changes.xml 2013-08-25 13:55:14 UTC (rev 8449)
+++ trunk/htmlunit/src/changes/changes.xml 2013-08-25 15:42:34 UTC (rev 8450)
@@ -9,7 +9,7 @@
<body>
<release version="2.13" date="???" description="Bugfixes">
<action type="add" dev="rbri">
- JavaScript: support for the type property of style elements added.
+ JavaScript: support for the 'type' and 'media' property of style \
elements added. </action>
<action type="fix" dev="rbri" issue="1534">
WebClient.getTopLevelWindows() returns a snapshot of the list of \
open top level windows.
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-08-25 \
13:55:14 UTC (rev 8449)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java 2013-08-25 \
15:42:34 UTC (rev 8450) @@ -34,6 +34,7 @@
* @version $Revision$
* @author Ahmed Ashour
* @author Marc Guillemot
+ * @author Ronald Brill
*/
@JsxClass(domClasses = HtmlStyle.class)
public class HTMLStyleElement extends HTMLElement {
@@ -88,4 +89,14 @@
final HtmlStyle style = (HtmlStyle) getDomNodeOrDie();
return style.getTypeAttribute();
}
+
+ /**
+ * Returns the media of this style.
+ * @return the media
+ */
+ @JsxGetter()
+ public String getMedia() {
+ final HtmlStyle style = (HtmlStyle) getDomNodeOrDie();
+ return style.getAttribute("media");
+ }
}
Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElementTest.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElementTest.java 2013-08-25 \
13:55:14 UTC (rev 8449)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElementTest.java 2013-08-25 \
15:42:34 UTC (rev 8450) @@ -89,9 +89,9 @@
final String html
= "<html><head><title>foo</title>\n"
- + "<style id='style_none'>my { }</style>\n"
- + "<style type='text/test' id='style_text'>my { }</style>\n"
- + "<style type='text/html' id='style_html'>my { }</style>\n"
+ + "<style id='style_none'>.a > .t { }</style>\n"
+ + "<style type='text/test' id='style_text'>.b > .t { }</style>\n"
+ + "<style type='text/html' id='style_html'>.c > .t { }</style>\n"
+ "<script>\n"
+ "function doTest() {\n"
@@ -118,9 +118,9 @@
final String html
= "<html><head><title>foo</title>\n"
- + "<style id='style_none'>.a > .t { }</style>\n"
- + "<style type='text/test' id='style_text'>.b > .t { }</style>\n"
- + "<style type='text/css' id='style_css'>.c > .t { }</style>\n"
+ + "<style id='style_none'>my { }</style>\n"
+ + "<style type='text/test' id='style_text'>my { }</style>\n"
+ + "<style type='text/css' id='style_css'>my { }</style>\n"
+ "<script>\n"
+ "function doTest() {\n"
@@ -137,4 +137,33 @@
loadPageWithAlerts2(html);
}
+
+ /**
+ * @throws Exception if the test fails
+ */
+ @Test
+ @Alerts({ "", "all", "screen, print,test" })
+ public void media() throws Exception {
+ final String html
+ = "<html><head><title>foo</title>\n"
+
+ + "<style id='style_none'>my { }</style>\n"
+ + "<style media='all' id='style_all'>my { }</style>\n"
+ + "<style media='screen, print,test' id='style_some'>my { }</style>\n"
+
+ + "<script>\n"
+ + "function doTest() {\n"
+ + " style = document.getElementById('style_none');\n"
+ + " alert(style.media);\n"
+ + " style = document.getElementById('style_all');\n"
+ + " alert(style.media);\n"
+ + " style = document.getElementById('style_some');\n"
+ + " alert(style.media);\n"
+ + "}\n"
+ + "</script>\n"
+ + "</head><body onload='doTest()'>\n"
+ + "</body></html>";
+
+ loadPageWithAlerts2(html);
+ }
}
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic