1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/reftests/dom/xbl-children-3.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,61 @@ 1.4 +<html xmlns="http://www.w3.org/1999/xhtml" 1.5 + xmlns:html="http://www.w3.org/1999/xhtml" 1.6 + xmlns:xbl="http://www.mozilla.org/xbl" 1.7 + xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.8 + class="reftest-wait"> 1.9 +<head> 1.10 + <xbl:bindings xmlns="http://www.mozilla.org/xbl"> 1.11 + <binding id="base"> 1.12 + <content> 1.13 + <html:div style="border: solid red"> 1.14 + <children /> 1.15 + </html:div> 1.16 + </content> 1.17 + <implementation> 1.18 + <property name="foo" onget="return 42" /> 1.19 + </implementation> 1.20 + </binding> 1.21 + <binding id="derived" extends="#base"> 1.22 + <content> 1.23 + <html:div style="border: dashed green"> 1.24 + <children includes="span" /> 1.25 + </html:div> 1.26 + </content> 1.27 + </binding> 1.28 + <binding id="nochildren"> 1.29 + <content> 1.30 + PASS 1.31 + </content> 1.32 + </binding> 1.33 + </xbl:bindings> 1.34 +</head> 1.35 +<body> 1.36 + <!-- Control case: our (only) child matches the children element. --> 1.37 + <div id="first" style="-moz-binding: url(#derived)"><span style="color: green">should be green in a green border</span></div> 1.38 + <!-- Make sure we ignore xul:template and xul:observes elements! --> 1.39 + <div style="-moz-binding: url(#derived)"><xul:template /><xul:observes /><span style="color: green">should be green in a green border</span></div> 1.40 + <!-- Case where our (only) child doesn't match any children elements. --> 1.41 + <div id="second" style="-moz-binding: url(#derived)"><div>Should be uncolored with no border</div></div> 1.42 + <!-- But make sure the binding was still applied! --> 1.43 + <div id="output" /> 1.44 + <script> 1.45 + var $ = document.getElementById.bind(document); 1.46 + // Note: Done in an onload handler because binding instantiation is 1.47 + // asynchronous. 1.48 + onload = function() { 1.49 + $('output').textContent = 1.50 + ($('first').foo === 42) + ", " + ($('first').foo === $('second').foo); 1.51 + document.documentElement.removeAttribute('class'); 1.52 + } 1.53 + </script> 1.54 + <!-- Case where one of our children matches but the other one doesn't. --> 1.55 + <div id="third" style="-moz-binding: url(#derived)"><span>In a span</span><div>Should be uncolored with no border</div></div> 1.56 + 1.57 + <!-- Control case with no <children> in the binding. --> 1.58 + <div style="-moz-binding: url(#nochildren)" /> 1.59 + <!-- Case where we have a child but no <children> in the binding. --> 1.60 + <div style="-moz-binding: url(#nochildren)"><span style="color: green">PASS</span></div> 1.61 + <!-- But we must ignore xul:template and xul:observes elements! --> 1.62 + <div style="-moz-binding: url(#nochildren)"><xul:template /><xul:observes /></div> 1.63 +</body> 1.64 +</html>