Skip to main content

Bug Tracker

Side navigation

#1980 closed bug (wontfix)

Opened November 27, 2007 11:29PM UTC

Closed December 07, 2007 03:33AM UTC

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" "">
<html xmlns="" 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();

Attachments (0)
Change History (1)

Changed December 07, 2007 03:33AM UTC by brandon comment:1

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();