Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  window_focus_docnav.xhtml   Sprache: unbekannt

 
rahmenlose Ansicht.xhtml DruckansichtUnknown {[0] [0] [0]}Mathematik

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>

<window onload="start()"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>

<div xmlns="http://www.w3.org/1999/xhtml" id="focusable1" tabindex="0" />
<div xmlns="http://www.w3.org/1999/xhtml" id="focusable2" tabindex="0" />

<panel id="panel" onpopupshown="runTests(this, 1);"
                  onpopuphidden="noChildrenTest()">
  <div xmlns="http://www.w3.org/1999/xhtml" id="p1focusable" tabindex="0"/>
</panel>
<panel id="panel2" onpopupshown="runTests(this, 2);" onpopuphidden="document.getElementById('panel').hidePopup()">
  <div xmlns="http://www.w3.org/1999/xhtml" id="p2focusable" tabindex="0"/>
</panel>

<browser id="browser" type="content" src="focus_frameset.html" style="width: 500px; height: 400px"/>

<script type="application/javascript">
<![CDATA[

var fm = Cc["@mozilla.org/focus-manager;1"].
           getService(Ci.nsIFocusManager);

function is(l, r, n) { window.arguments[0].SimpleTest.is(l,r,n); }
function ok(v, n) { window.arguments[0].SimpleTest.ok(v,n); }

function noChildrenTest()
{
  // Remove the browser element and test navigation when there are no other documents.
  // The focus should move or stay on the first focusable element.
  let browser = document.getElementById("browser");
  browser.remove();

  let focusable1 = document.getElementById("focusable1");
  let focusable2 = document.getElementById("focusable2");

  focusable2.focus();
  next(window, focusable1, "Focus forward when no child documents");
  next(window, focusable1, "Focus forward again when no child documents");

  focusable2.focus();
  previous(window, focusable1, "Focus backward when no child documents");
  previous(window, focusable1, "Focus backward again when no child documents");

  done();
}

function done()
{
  window.close();
  window.arguments[0].SimpleTest.finish();
}

function previous(expectedWindow, expectedElement, desc)
{
  synthesizeKey("KEY_F6", {shiftKey: true});
  is(fm.focusedWindow, expectedWindow, desc);
  is(fm.focusedElement, expectedElement, desc + " element");
}

function next(expectedWindow, expectedElement, desc)
{
  synthesizeKey("KEY_F6");
  is(fm.focusedWindow, expectedWindow, desc);
  is(fm.focusedElement, expectedElement, desc + " element" + "::" + (fm.focusedElement ? fm.focusedElement.parentNode.id : "<none>"));
}

// This test runs through three cases. Document navigation forward and
// backward using the F6 key when no popups are open, with one popup open and
// with two popups open.
function runTests(panel, popupCount)
{
  if (!popupCount || popupCount > 2)
    popupCount = 0;

  fm.clearFocus(window);

  var childwin = document.getElementById("browser").contentWindow;

  if (popupCount) {
    next(window, document.getElementById("p1focusable"), "First into popup 1 with " + popupCount);

    if (popupCount == 2) {
      next(window, document.getElementById("p2focusable"), "First into popup 2 with " + popupCount);
    }
  }

  next(childwin.frames[0], childwin.frames[0].document.documentElement, "First with " + popupCount);
  next(childwin.frames[1], childwin.frames[1].document.documentElement, "Second with " + popupCount);
  previous(childwin.frames[0], childwin.frames[0].document.documentElement, "Second back with " + popupCount);

  if (popupCount) {
    if (popupCount == 2) {
      previous(window, document.getElementById("p2focusable"), "First back from popup 2 with " + popupCount);
    }

    previous(window, document.getElementById("p1focusable"), "First back from popup 1 with " + popupCount);
  }

  previous(window, document.getElementById("focusable1"), "First back with " + popupCount);

  if (panel == document.getElementById("panel"))
    document.getElementById("panel2").openPopup(null, "after_start", 10020);
  else if (panel == document.getElementById("panel2"))
    panel.hidePopup();
  else
    document.getElementById("panel").openPopup(null, "after_start");
}

function start()
{
  window.arguments[0].SimpleTest.waitForExplicitFinish();
  window.arguments[0].SimpleTest.waitForFocus(
    function() { runTests(null, 0); },
    document.getElementById("browser").contentWindow);
}

]]></script>

</window>

[Dauer der Verarbeitung: 0.26 Sekunden, vorverarbeitet 2026-08-26]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002