Bug Tracker

Opened 13 years ago

Closed 13 years ago

#1980 closed bug (wontfix)

cannot clone <html> or <body> in Safari

Reported by: tdhooper Owned by:
Priority: major Milestone: 1.2.2
Component: core Version: 1.2.1
Keywords: clone safari body head Cc:
Blocked by: Blocking:

Description

The page below give the following error in Safari (JavaScript console):

Value undefined (result of expression ret[i].getElementsByTagName) is not object.

This happens when using either $("body").clone() or $("html").clone()

(Safari 3.0.4 tested)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title>jQuery.clone() test</title>
		
		<script src="jquery-1.2.1.min.js" type="text/javascript"> </script>
		<script type="text/javascript">
			
			$(document).ready(function(){
			

				var cloneTest = $("html").clone();
				alert(cloneTest);
				

			});
		
		</script>
	</head>
	
	<body>
		<p>test</p>
	</body>
</html>

Change History (1)

comment:1 Changed 13 years ago by brandon

Resolution: wontfix
Status: newclosed

A possible workaround might be to wrap the contents of the body with a div and clone that.

$('body').wrapInner('<div />').clone();

Note: See TracTickets for help on using tickets.