summaryrefslogtreecommitdiffstats
path: root/chrome/test/data/find_in_page/end_state.html
blob: bf8332ca8b8c95dd948992138b91e6463d44f6d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<html>
<head>
<script>
  var focused_elem = "{nothing focused}";

  function setFocusedElem(id) {
    focused_elem = id;
    updateLog();
  }

  function clearFocus() {
    focused_elem = "";
    updateLog();
  }

  function getFocusedElement() {
    return focused_elem;
  }

  function updateLog() {
    document.getElementById("log").innerHTML = "Focused element: " + focused_elem;
  }

  function selectLink1() {
    clearFocus();
    var sel = window.getSelection();
    var range = document.createRange();
    range.setStartBefore(document.getElementById('link1'));
    range.setEndAfter(document.getElementById('link1'));
    sel.addRange(range);
    return "";
  }

</script>
</head>

<body>
  This is
   a <a id="link1" href="http://www.google.com" onfocus="setFocusedElem(this.id)" onblur="clearFocus()">link</a>
  to <a id="link2" href="http://www.google.com" onfocus="setFocusedElem(this.id)" onblur="clearFocus()">Google</a>.

  <br><br><br>
  <div id="log"><div>
</body>
</html>