dom/tests/mochitest/chrome/test_focus_switchbinding.xul

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <?xml version="1.0"?>
     2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     5 <window title="Focus Switch Binding Test"
     6         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     8   <script type="application/javascript"
     9           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    11 <script>
    12 SimpleTest.waitForExplicitFinish();
    14 function switchBinding()
    15 {
    16   $("box").style.MozBinding = "url(#second)";
    17 }
    18 </script>
    20 <xbl:bindings xmlns:xbl="http://www.mozilla.org/xbl"
    21               xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    22   <xbl:binding id="first">
    23     <xbl:content>
    24       <xul:button label="First"/>
    25     </xbl:content>
    26     <xbl:implementation>
    27       <xbl:constructor>
    28         document.getAnonymousNodes(this)[0].focus();
    29         setTimeout(switchBinding, 0);
    30       </xbl:constructor>
    31     </xbl:implementation>
    32   </xbl:binding>
    33   <xbl:binding id="second">
    34     <xbl:content>
    35       <xul:button label="Second"/>
    36     </xbl:content>
    37     <xbl:implementation>
    38       <xbl:constructor>
    39         $("after").focus();
    40       </xbl:constructor>
    41     </xbl:implementation>
    42   </xbl:binding>
    43 </xbl:bindings>
    45 <box id="box" style="-moz-binding: url(#first)"/>
    46 <button id="after" label="After" onfocus="is(document.activeElement, $('after'), 'focus set'); SimpleTest.finish()"/>
    48 <body xmlns="http://www.w3.org/1999/xhtml">
    49 <p id="display">
    50 </p>
    51 <div id="content" style="display: none">
    52 </div>
    53 <pre id="test">
    54 </pre>
    55 </body>
    57 </window>

mercurial