Commit 5d2ee3ee authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Bind events to document node instead of body element.

parent 553ba810
...@@ -1328,16 +1328,8 @@ static HRESULT ensure_nsevent_handler(HTMLDocumentNode *doc, event_target_t *eve ...@@ -1328,16 +1328,8 @@ static HRESULT ensure_nsevent_handler(HTMLDocumentNode *doc, event_target_t *eve
return S_OK; return S_OK;
if(event_info[eid].flags & EVENT_BIND_TO_BODY) { if(event_info[eid].flags & EVENT_BIND_TO_BODY) {
nsIDOMHTMLElement *nsbody; nsnode = doc->node.nsnode;
nsresult nsres; nsIDOMNode_AddRef(nsnode);
nsres = nsIDOMHTMLDocument_GetBody(doc->nsdoc, &nsbody);
if(NS_SUCCEEDED(nsres) && nsbody) {
nsnode = (nsIDOMNode*)nsbody;
}else {
ERR("GetBody failed: %08x\n", nsres);
return E_UNEXPECTED;
}
} }
doc->event_vector[eid] = TRUE; doc->event_vector[eid] = TRUE;
......
...@@ -114,14 +114,16 @@ function test_handler_this() { ...@@ -114,14 +114,16 @@ function test_handler_this() {
ok(calls == "div2,div2*,div1,div1*,body,body*", "calls = " + calls); ok(calls == "div2,div2*,div1,div1*,body,body*", "calls = " + calls);
} }
function runTests(t) { window.onload = function() {
try { try {
ok(cnt == 1, "cnt=" + cnt + " exception during loading?"); ok(cnt == 1, "cnt=" + cnt + " exception during loading?");
ok(t === window, "t !== window"); ok(this === window, "this !== window");
ok(typeof(window.onload) === "function", "typeof(window.onload) = " + typeof(window.onload)); ok(typeof(window.onload) === "function", "typeof(window.onload) = " + typeof(window.onload));
ok(document.body.onload === window.onload, "document.body.onload !== window.onload"); ok(document.body.onload === window.onload, "document.body.onload !== window.onload");
ok(img_onload_called, "img.onload not called before window.onload");
test_scriptfor(); test_scriptfor();
ondataavailable_test(); ondataavailable_test();
test_handler_this(); test_handler_this();
...@@ -132,8 +134,18 @@ function runTests(t) { ...@@ -132,8 +134,18 @@ function runTests(t) {
external.reportSuccess(); external.reportSuccess();
} }
</script> </script>
<script>
var img = document.createElement("img");
img.src = "http://test.winehq.org/tests/winehq_snapshot/index_files/winehq_logo_glass.png";
var img_onload_called = false;
img.onload = function() {
external.trace("img.onload");
img_onload_called = true;
}
</script>
</head> </head>
<body onload="runTests(this)"> <body>
<div id="divid"></div> <div id="divid"></div>
<div id="divid2"></div> <div id="divid2"></div>
<script event="onclick" for="divid2"> <script event="onclick" for="divid2">
...@@ -152,5 +164,8 @@ function runTests(t) { ...@@ -152,5 +164,8 @@ function runTests(t) {
cnt++; cnt++;
})(); })();
</script> </script>
<script>
document.body.appendChild(img);
</script>
</body> </body>
</html> </html>
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