Skip to main content

Bug Tracker

Side navigation

Ticket #3302: test2.html
File test2.html, 1.6 KB (added by mv987, August 29, 2008 05:39PM UTC)

this shows the clone problems on divs

<html>
<head>
	<title>
		Test Case - clone problem in IE
	</title>
    <script type="text/javascript" src="jquery.js"></script>

	<script>

		
		var controlcellstring = "<div class='controlcell'>Number of cells in blue div: <a href='#' class='buttontest'>click here</a></div>";
		var maincellstring = "<div>content</div>";
		var mainrowstring = "<div class='tableconstructrow'></div>";

		$(document).ready(function() {

			$("#buttonaddrow").click(function() {
				addrow();
				return false;
			});

			var table = $("<div id='tableconstruct' cellspacing='10'></div>");
			var row = $(mainrowstring).append(controlcellstring).append($(maincellstring)).append($(maincellstring));
			$("#tablecontructholder").append(table.append(row));

			applyeventhandlers();
 		});


		function applyeventhandlers(context)
		{
			$(".buttontest", context).click(function() {
				alert($(this).parents(".tableconstructrow").children().length);
				return false;
			});
		}

		function addrow()
		{
			var tbody = $("#tableconstruct");
			var newrow = tbody.children(":last").clone(true);
			//var newrow = tbody.children(":last").clone();
			//applyeventhandlers(newrow);
			newrow.appendTo(tbody);
		}


	</script>

	<style type="text/css">
	
    	.tableconstructrow div {
		margin:5px;
		background-color:#f0f0f0;
		}
    	.tableconstructrow
		{
		background-color:#aaaaff;
		padding:10px;
		margin:10px;
		}

    </style>
</head>
<body>


	<div>
    	<div id='controlpanel'>
            <a href='#' id='buttonaddrow'>Add Row</a>
        </div>

		<div id='tablecontructholder'></div>

	</div>




</body>

Download in other formats:

Original Format