diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/xbl/test/test_bug398492.xul | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/xbl/test/test_bug398492.xul')
-rw-r--r-- | dom/xbl/test/test_bug398492.xul | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/dom/xbl/test/test_bug398492.xul b/dom/xbl/test/test_bug398492.xul new file mode 100644 index 000000000..a854d50fc --- /dev/null +++ b/dom/xbl/test/test_bug398492.xul @@ -0,0 +1,91 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=398492 +--> +<window title="Mozilla Bug 398492" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> + <bindings xmlns="http://www.mozilla.org/xbl"> + <binding id="test"> + <content> + <xul:hbox id="xxx" + xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <children/> + </xul:hbox> + </content> + </binding> + </bindings> + + <!-- test results are displayed in the html:body --> + <body xmlns="http://www.w3.org/1999/xhtml"> + <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=398492" + target="_blank">Mozilla Bug 398492</a> + </body> + + <hbox id="testbox" style="-moz-binding: url(#test)">Text</hbox> + + <!-- test code goes here --> + <script type="application/javascript"><![CDATA[ + + /** Test for Bug 398492 **/ + SimpleTest.waitForExplicitFinish(); + + function getXBLParent(node) { + var utils = Components.classes["@mozilla.org/inspector/dom-utils;1"] + .getService(Components.interfaces.inIDOMUtils); + return utils.getParentForNode(node, true); + } + + addLoadEvent(function() { + var n = $("testbox"); + var kid = n.firstChild; + var anonKid = document.getAnonymousNodes(n)[0]; + is(anonKid instanceof XULElement, true, "Must be a XUL element"); + is(anonKid, getXBLParent(kid), "Unexpected anonymous nodes"); + + var n2 = n.cloneNode(true); + var kid2 = n2.firstChild; + var anonKid2 = document.getAnonymousNodes(n2)[0]; + is(anonKid2 instanceof XULElement, true, + "Must be a XUL element after clone"); + is(anonKid2, getXBLParent(kid2), + "Unexpected anonymous nodes after clone"); + + var n3 = document.createElement("hbox"); + document.documentElement.appendChild(n3); + var kid3 = document.createTextNode("Text"); + n3.appendChild(kid3); + + // Note - we rely on the fact that the binding is preloaded + // by the other hbox here, so that the binding will be applied + // sync. + n3.style.MozBinding = "url(" + document.location.href + "#test)"; + n3.getBoundingClientRect(); // Flush styles. + + var anonKid3 = document.getAnonymousNodes(n3)[0]; + is(anonKid3 instanceof XULElement, true, + "Must be a XUL element after addBinding"); + is(anonKid3, getXBLParent(kid3), + "Unexpected anonymous nodes after addBinding"); + + + n.removeChild(kid); + isnot(anonKid, getXBLParent(kid), + "Should have removed kid from insertion point"); + + n2.removeChild(kid2); + isnot(anonKid2, getXBLParent(kid2), + "Should have removed kid2 from insertion point"); + + n3.removeChild(kid3); + isnot(anonKid3, getXBLParent(kid3), + "Should have removed kid3 from insertion point"); + + SimpleTest.finish(); + }); + + + ]]></script> +</window> |