Bug Tracker

Opened 15 years ago

Closed 15 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:


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">
		<title>jQuery.clone() test</title>
		<script src="jquery-1.2.1.min.js" type="text/javascript"> </script>
		<script type="text/javascript">

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


Change History (1)

comment:1 Changed 15 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.