Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | <html xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 2 | <head> |
michael@0 | 3 | <bindings xmlns="http://www.mozilla.org/xbl"> |
michael@0 | 4 | <binding id="test"> |
michael@0 | 5 | <content> |
michael@0 | 6 | <span><children/></span> |
michael@0 | 7 | </content> |
michael@0 | 8 | </binding> |
michael@0 | 9 | </bindings> |
michael@0 | 10 | <script type="application/x-javascript"> |
michael@0 | 11 | function runTest() { |
michael@0 | 12 | var div = document.getElementById("testDiv"); |
michael@0 | 13 | |
michael@0 | 14 | // First we have to make sure that we've looked up the primary frame for |
michael@0 | 15 | // the textnode. Appending a space should do the trick. |
michael@0 | 16 | div.firstChild.data += " "; |
michael@0 | 17 | |
michael@0 | 18 | // Now flush our reflow |
michael@0 | 19 | document.body.offsetWidth; |
michael@0 | 20 | |
michael@0 | 21 | var node = document.createElementNS("http://www.w3.org/1999/xhtml", |
michael@0 | 22 | "span"); |
michael@0 | 23 | div.appendChild(node); |
michael@0 | 24 | node.appendChild(document.createTextNode("This text should appear")); |
michael@0 | 25 | } |
michael@0 | 26 | </script> |
michael@0 | 27 | </head> |
michael@0 | 28 | |
michael@0 | 29 | <body onload="runTest()"> |
michael@0 | 30 | <div id="testDiv" style="width: 0; -moz-binding: url(#test)">This is text in a div</div> |
michael@0 | 31 | |
michael@0 | 32 | </body> |
michael@0 | 33 | </html> |