Now that I could step into my Javascript code things got even weirder. I had a simple
<span id="test"><script ... ></span>
construction and I tried do replace element "test" with an AJAX call. So what do you think happened? I did:
item.insertAdjacentHTML('beforeBegin', '<span id="test"><script ... ></span>');
and then checked item.previousSibling. I turned out IE8 had inserted:
<span id="test"></span>
It just left out my new script. I changed the HTML code to look like (don't ask me what gave me the idea to do so, years of suffering train intuition):
<span id="test">
<input type="hidden" />
<script ... >
</span>
and suddenly IE inserted it all like it should. If you want to know which tricks are necessary to trigger script execution have a look at the MyFaces repository:
http://svn.apache.org/repos/asf/myfaces/core/branches/2_0_0/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Utils.js
It's interesting code - external and embedded scripts need to be treated differently.
No comments:
Post a Comment