title: document.execCommand in iframe don't work
body: <p>I'm working on my WYSIWYG editor. And I have code like this:</p>
  
  <pre><code>doc.execCommand(cmd, false, null);
  </code></pre>
  
  <p>The <strong>cmd</strong> argument would be 'Bold', 'Italic', etc. And the <strong>doc</strong> variable refer to the document in the iframe, which is initialized somewhere else:</p>
  
  <pre><code>doc = iframe1.contentWindow.document; 
  </code></pre>
  
  <p>It works fine in Chrome, but in IE(my is IE9) doesn't work at all.</p>
  
  <p>I debugged my code with the developer tool and found nothing wrong, the <strong>execCommand</strong> function just doesn't work.</p>
  
  <p>I have searched through the Internet and couldn't found an available solution.</p>
  
  <p>Would anyone give me a help? </p>
  
  <p>Code sample:</p>
  
  <pre><code>function $see(e, o) {
      var that = this;
      ...
      this.e = $see.make('iframe', { 'class': 'editor' }); // editor iframe    
      this.e.onload = function () {  // call when the document is loaded
          var d = that.e.contentWindow || that.e.contentDocument;
          if (d.document) d = d.document;
          that.doc = d;
          that.doc.write('&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;');
          that.doc.body.innerHTML = that.ta.value; // that.ta refers to an textarea
          that.doc.body.setAttribute('contenteditable', 'true');
          ...
      };
  }
  $see.prototype.exec = function (cmd) { 
      // call in an &lt;a&gt; tag's onclick event outside the iframe
      this.doc.execCommand(cmd, false, null); 
  };
  </code></pre>