tag:blogger.com,1999:blog-13756280.post6102964282534049511..comments2024-02-08T03:44:23.780-08:00Comments on Jeremiah Grossman: (almost) Rending HTML without JavaScriptJeremiah Grossmanhttp://www.blogger.com/profile/05017778127841311186noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-13756280.post-27921016628798388182007-03-13T21:43:00.000-07:002007-03-13T21:43:00.000-07:00I think this behavior (not executing scripts in sc...I think this behavior (not executing scripts in script tags during the magic) is to be expected, though it does initially seem counterintuitive. According to <A HREF="http://www.w3schools.com/tags/tag_script.asp" REL="nofollow">the w3schools website</A>:<BR/><I><BR/>Code within this element is executed immediately when the page is loaded, if it is not in a function.<BR/></I><BR/>That suggests that script tag contents are evaluated only as the page is loading, and once it is finished, they are ignored, or rather simply treated like the HTML these tags are.<BR/><BR/>You can chain the creation of script tags (i.e., script in one tag causes more script tags to be added to the DOM) because the scripts execute while the document is loading. (<A HREF="http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.4" REL="nofollow">alluded to by the W3C HTML4 docs</A>)<BR/><BR/>Anything that is inserted into the global environment (or its descendant scopes) during loading persists, thus the ability to use event handlers.<BR/><BR/>What is interesting is that the newly created iframe's document has the domain of about:blank, no matter where the containing page is served from... even after changing the body's content. A brief search brings up <A HREF="http://karma.nucleuscms.org/item/101" REL="nofollow">Wouter Demuynck's</A> blog entry about similar behaviors. I wonder if there's anything else (given the "weirdness" experienced) that can be done...Sid Stammhttps://www.blogger.com/profile/08788622306405563565noreply@blogger.com