Side navigation
#13493 closed bug (wontfix)
Opened February 21, 2013 02:56PM UTC
Closed February 23, 2013 05:10PM UTC
Internet Explorer: Events in jQuery( . ) raw HTML with Hight Security Level and local Files
Reported by: | mario.priller@gmail.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Hi,
i have a simple test file that shows a strange effect on a local html-File:
<!DOCTYPE html>
<html>
<head>
<script language="javascript" src="jquery.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
function foo1()
{
jQuery('<button onclick="foo1();">foo</button>').appendTo('#foo1');
}
function foo2()
{
var elem = jQuery('#foo2')[0];
var oldHTML = elem.innerHTML;
elem.innerHTML = oldHTML + '<button onclick="foo2();">foo</button>';
}
</script>
</head>
<body>
<button onclick="foo1();">foo1</button>
<button onclick="foo2();">foo2</button>
<div id="foo1"></div>
<div id="foo2"></div>
</body>
</html>
If you put the content in a local html file and open this file with ie9 or ie10 and you have the internet security options to normal then foo1() and foo2() works identically.
If you set the internet security option to high, then foo1() works, but the onclick event handler form the inserted button don't work. foo2(.) works normal.
First of all i don't understand, why the internet security option for the Zone Internet has anything to do with a local file, but this is an ie-problem.
But the differnce between the ...innerHTML and the jQuery('..rawHTML') isn't clear for me.
Thanks.
Mario
Attachments (0)
Change History (1)
Changed February 23, 2013 05:10PM UTC by comment:1
resolution: | → wontfix |
---|---|
status: | new → closed |
Inline handlers have been on jQuery's wontfix list for several years since they are a very bad idea. It probably has something to do with jQuery creating DOM elements and then trying to attach them to the document.