[HtmlUnit] SVN: [15532] trunk/htmlunit/src
rbri--- via HtmlUnit-develop <[email protected]> Mon, 20 Aug 2018 17:36:23 +0000
| Newsgroups | gmane.comp.java.htmlunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Revision: 15532
http://sourceforge.net/p/htmlunit/code/15532
Author: rbri
Date: 2018-08-20 17:36:20 +0000 (Mon, 20 Aug 2018)
Log Message:
-----------
preventDefault is available in Chrome also
Modified Paths:
--------------
trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event.java
trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTest.java
Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event.java 2018-08-20 17:30:03 UTC (rev 15531)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event.java 2018-08-20 17:36:20 UTC (rev 15532)
@@ -529,7 +529,7 @@
* called for this event. Otherwise this attribute must return {@code false}.
* @return {@code true} if this event has been cancelled or not
*/
- @JsxGetter({FF, IE, EDGE})
+ @JsxGetter
public boolean isDefaultPrevented() {
return cancelable_ && preventDefault_;
}
Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTest.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTest.java 2018-08-20 17:30:03 UTC (rev 15531)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTest.java 2018-08-20 17:36:20 UTC (rev 15532)
@@ -974,6 +974,27 @@
* @throws Exception if the test fails
*/
@Test
+ @Alerts({"false", "boolean"})
+ public void defaultPrevented() throws Exception {
+ final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_
+ + "<html><head><title>foo</title><script>\n"
+ + " function test() {\n"
+ + " try {\n"
+ + " var event = document.createEvent('Event');\n"
+ + " alert(event.defaultPrevented);\n"
+ + " alert(typeof event.defaultPrevented);\n"
+ + " } catch (e) { alert('exception') }\n"
+ + " }\n"
+ + "</script></head><body onload='test()'>\n"
+ + "</body></html>";
+
+ loadPageWithAlerts2(html);
+ }
+
+ /**
+ * @throws Exception if the test fails
+ */
+ @Test
@Alerts(DEFAULT = {"undefined", "undefined"},
CHROME = {"true", "boolean"})
public void returnValue() throws Exception {
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot