Commit bbffabf1 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IDOMEvent::get_defaultPrevented implementation.

parent 0bff85cd
......@@ -995,8 +995,11 @@ static HRESULT WINAPI DOMEvent_get_currentTarget(IDOMEvent *iface, IEventTarget
static HRESULT WINAPI DOMEvent_get_defaultPrevented(IDOMEvent *iface, VARIANT_BOOL *p)
{
DOMEvent *This = impl_from_IDOMEvent(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
*p = variant_bool(This->prevent_default);
return S_OK;
}
static HRESULT WINAPI DOMEvent_get_eventPhase(IDOMEvent *iface, USHORT *p)
......
......@@ -267,6 +267,31 @@ function test_stop_propagation() {
next_test();
}
function test_prevent_default() {
document.body.innerHTML = '<div><a href="about:blank"></a></div>';
var div = document.body.firstChild;
var a = div.firstChild;
var calls;
div.addEventListener("click", function(e) {
calls += "div,";
ok(e.defaultPrevented === false, "e.defaultPrevented = " + e.defaultPrevented);
e.preventDefault();
ok(e.defaultPrevented === true, "e.defaultPrevented = " + e.defaultPrevented);
}, true);
a.addEventListener("click", function(e) {
calls += "a,";
ok(e.defaultPrevented === true, "e.defaultPrevented = " + e.defaultPrevented);
}, true);
calls = "";
a.click();
ok(calls === "div,a,", "calls = " + calls);
next_test();
}
var tests = [
test_content_loaded,
test_add_remove_listener,
......@@ -274,5 +299,6 @@ var tests = [
test_remove_listener_in_listener,
test_event_phase,
test_stop_propagation,
test_prevent_default,
test_listener_order
];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment