Skip to main content

Bug Tracker

Side navigation

#9291 closed bug (worksforme)

Opened May 16, 2011 08:43AM UTC

Closed May 16, 2011 02:57PM UTC

append node to body element

Reported by: OlgaGr Owned by:
Priority: low Milestone: 1.next
Component: manipulation Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:
Description

I noticed a problem with appending elements to body node in IE9.

Example code:

<!DOCTYPE html>
<html>
<head>
	<title>Test</title>
	<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.js"></script>
</head>
<body>
	<a href="http://codequest.eul">test</a>
	<script type="text/javascript">
		jQuery(document).ready(function($){
			$('a').click(function(){
				$('body').append('<p>test</p>');
				return false;
			});
		});
	</script>
</body>
</html>

IE9 don't prevent default event and redirect to the location which is in href attribute. I tried to replace the value of href attribute to "#". Then I get this error message in the browser console:

error in jquery-1.6.1.js, row 5569, character 5.

When I'm trying to append to another element, for example:

$('a').append('<p>test</p>');

it works fine. When I remove http adress from href attribute

Attachments (0)
Change History (2)

Changed May 16, 2011 08:45AM UTC by OlgaGr comment:1

jsFiddle doesn't seem to work, so I put code inline.

Changed May 16, 2011 02:57PM UTC by timmywil comment:2

component: unfiledmanipulation
priority: undecidedlow
resolution: → worksforme
status: newclosed

I created a test case and everything seems to be working fine in all browsers: http://jsfiddle.net/timmywil/BGt8U/

If you can reproduce with a test case, we can revisit this ticket.