title: hasFocus() returning error
body: <p>I'm not quite sure what I am doing wrong, I looked up a way to see if an element has focus. I found the document.hasFocus() method. So I tried and I debugged on Chrome and got "Uncaught TypeError: Object # has no method 'hasFocus'.". Here is my JavaScript:</p>
  
  <pre><code>var e = document.getElementById("editor").contentWindow;
  e.document.designMode="on";
  e.document.open();
  e.document.write("&lt;head&gt;&lt;style&gt;body{font-family:arial,helvetica,sans-serif;font-size:12px;}&lt;/style&gt;&lt;/head&gt;");
  e.document.close();
  function def() {
     document.getElementById("fonts").selectedIndex = 0;
     document.getElementById("size").selectedIndex = 1;
     document.getElementById("color").selectedIndex = 0;
  }
  function edit(x, y) {
     e.document.execCommand(x, false, y);
     e.focus();
  }
  setInterval(function() {
      if (document.getElementById("editor").contentWindow.hasFocus()) {
          document.getElementById("html").value = document.getElementById("editor").contentWindow.document.body.innerHTML;
      }
      else if (document.getElementById("html").hasFocus()) {
          document.getElementById("editor").contentWindow.document.body.innerHTML = document.getElementById("html").value;
      }
  }, 100);
  </code></pre>