/// <summary>Called after the innerHTML of the body tag was changed.</summary> public void NewBody() { // Is this an iframes document? if (window.iframe != null) { // Yes it is. // The new HTML may have contained a HTML tag and just replaced document.html with it. // In this case though, the original HTML tag is the child of the iframe element. // So, we need to check if the HTML tag changed. // Grab the original one: Element previousHtml = window.iframe.firstChild; // Have we got an original one, and has it changed? if (previousHtml != null && html != previousHtml) { // Yep, it changed! // Remove all kids from the iframe: window.iframe.innerHTML = ""; // Put the new html node in the iframe: window.iframe.appendChild(html); // The html documents changed - reapply this to it: html.Document = this; } } if (DropdownBox != null) { // Change its parent: if (DropdownBox.parentNode != null) { DropdownBox.parentNode.removeChild(DropdownBox); } html.appendChild(DropdownBox); } TryStyle(); if (!TryCompile()) { // We're downloading code. // This flag lets the downloader know it needs to also attempt a TryCompile. FinishedParsing = true; } }
public override void OnTagLoaded() { Loaded = true; // Iframes generate a new document object for isolation purposes: ContentDocument = new Document(Element.Document.Renderer, Element.Document.window); // Setup the iframe ref: ContentDocument.window.iframe = Element; // Grab the parent document: Document originalDocument = Element.Document; // Temporarily set the document of this element: Element.Document = ContentDocument; // Append the documents html node as a child of the iframe: Element.appendChild(ContentDocument.html); Element.Document = originalDocument; LoadContent(); // And handle style/ other defaults: base.OnTagLoaded(); }