mshtml: Added IDOMEvent::get_defaultPrevented implementation.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-11-02 16:47:53 +01:00 committed by Alexandre Julliard
parent 0bff85cd44
commit bbffabf1b1
2 changed files with 31 additions and 2 deletions

View File

@ -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)

View File

@ -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
];