[Webkit-unassigned] [Bug 68661] New: innerHTML call returns before DOM is rendered in element
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Sep 22 15:17:30 PDT 2011
https://bugs.webkit.org/show_bug.cgi?id=68661
Summary: innerHTML call returns before DOM is rendered in
element
Product: WebKit
Version: 528+ (Nightly build)
Platform: PC
OS/Version: Windows 7
Status: UNCONFIRMED
Severity: Normal
Priority: P2
Component: HTML DOM
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: fastest963 at gmail.com
After the innerHTML setting returns and moves on to the next command in JS, the DOM hasn't finished parsing the new HTML and the next call fails because the element it is looking for doesn't exist. The HTML is in the element it just hasn't been parsed yet by the DOM.
Example code (actual htmlString: http://pastebin.com/JUHYy9Yt)
element[0].innerHTML = htmlString;
console.log(document.getElementById('services_content')); //returns null
console.log(element[0].innerHTML); //prints the html in console though
If I wrap the next call in setTimeout with a timeout of 0 then it works:
element[0].innerHTML = htmlString;
setTimeout(function(){console.log(document.getElementById('services_content'));}, 0); //returns actual element
The innerHTML is <1900 chars so it is by no means something huge. The call after setting the html loads content into one of the divs and thus fails because the element doesn't exist yet.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list