Fix check for DOMNodeInserted/DOMNodeRemoved event handlers. Bug 367164,
r+sr=sicking git-svn-id: svn://10.0.0.236/trunk@218522 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
d84e6b8b15
commit
5c6bc301e6
@ -2328,7 +2328,7 @@ nsGenericElement::doInsertChildAt(nsIContent* aKid, PRUint32 aIndex,
|
||||
nsNodeUtils::ContentInserted(container, aKid, aIndex);
|
||||
}
|
||||
|
||||
if (nsContentUtils::HasMutationListeners(container,
|
||||
if (nsContentUtils::HasMutationListeners(aKid,
|
||||
NS_EVENT_BITS_MUTATION_NODEINSERTED)) {
|
||||
nsMutationEvent mutation(PR_TRUE, NS_MUTATION_NODEINSERTED);
|
||||
mutation.mRelatedNode = do_QueryInterface(container);
|
||||
@ -2377,7 +2377,7 @@ nsGenericElement::doRemoveChildAt(PRUint32 aIndex, PRBool aNotify,
|
||||
nsMutationGuard guard;
|
||||
|
||||
if (aNotify &&
|
||||
nsContentUtils::HasMutationListeners(container,
|
||||
nsContentUtils::HasMutationListeners(aKid,
|
||||
NS_EVENT_BITS_MUTATION_NODEREMOVED)) {
|
||||
nsMutationEvent mutation(PR_TRUE, NS_MUTATION_NODEREMOVED);
|
||||
mutation.mRelatedNode = do_QueryInterface(container);
|
||||
|
||||
@ -100,6 +100,7 @@ RunSet.runall = function() {
|
||||
'test_bug364092.xhtml',
|
||||
'test_bug364413.xhtml',
|
||||
'test_bug365773.xul',
|
||||
'test_bug367164.html,
|
||||
'test_MochiKit-Async.html',
|
||||
'test_MochiKit-Base.html',
|
||||
'test_MochiKit-DateTime.html',
|
||||
|
||||
48
mozilla/testing/mochitest/tests/test_bug367164.html
Normal file
48
mozilla/testing/mochitest/tests/test_bug367164.html
Normal file
@ -0,0 +1,48 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=367164
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 367164</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=367164">Mozilla Bug 367164</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 367164 **/
|
||||
|
||||
var span = document.createElement("span");
|
||||
|
||||
var ins1 = false;
|
||||
var ins2 = false;
|
||||
var rem1 = false;
|
||||
var rem2 = false;
|
||||
|
||||
span.addEventListener("DOMNodeInserted", function() { ins1 = true; }, true);
|
||||
span.addEventListener("DOMNodeInserted", function() { ins2 = true; }, false);
|
||||
span.addEventListener("DOMNodeRemoved", function() { rem1 = true; }, true);
|
||||
span.addEventListener("DOMNodeRemoved", function() { rem2 = true; }, false);
|
||||
|
||||
$("content").appendChild(span);
|
||||
$("content").removeChild(span);
|
||||
|
||||
is(ins1, true, "Capturing DOMNodeInserted listener");
|
||||
is(ins2, true, "Bubbling DOMNodeInserted listener");
|
||||
is(rem1, true, "Capturing DOMNodeRemoved listener");
|
||||
is(rem2, true, "Bubbling DOMNodeRemoved listener");
|
||||
|
||||
</script>
|
||||
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user