Skip to main content

Bug Tracker

Side navigation

#11747 closed bug (invalid)

Opened May 10, 2012 10:38AM UTC

Closed May 29, 2012 10:06AM UTC

Incorrete rowspan after Clone() in Explorer

Reported by: gianluca_medici@tin.it Owned by: gianluca_medici@tin.it
Priority: low Milestone: None
Component: misc Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

I was testing on Microsoft Explorer 8, after calling clone() or clone(true) on a row all of its cells have rowspan=1 including all the cells that previously had rowspan > 1.

Testing the same thing on Firefox doesn't cause any problem.

Example:


<html>
<head>
<script class="jsbin" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
  article, aside, figure, footer, header, hgroup, 
  menu, nav, section { display: block; }
</style>
</head>
<body>
  <table border="1" id="test"> 
<tr > 
	<th rowspan="2" nowrap align="left">16</th> 
	<td>123456789</td> 
</tr> 
<tr> 
	<td>123456879</td> 
</tr> 
</table>
  <script>
    alert("Before "+$(test).get()[0].rows[0].children[0].rowSpan);
    alert("After "+$($(test).get()[0].rows[0]).clone()[0].children[0].rowSpan);
  </script>
</body>
</html>
Attachments (0)
Change History (6)

Changed May 10, 2012 11:33AM UTC by sindresorhus comment:1

owner: → gianluca_medici@tin.it
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

Changed May 19, 2012 10:33AM UTC by gianluca_medici@tin.it comment:2

status: pendingnew

Replying to [comment:1 sindresorhus]:

Thanks for taking the time to contribute to the jQuery project! ... Additionally, be sure to test against the jQuery Edge version to ensure >the issue still exists. To get you started, use this boilerplate: >http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top >menu) to get started.

Here is the link to the test case in jsfiddle:[http://jsfiddle.net/Vawhh/3/]

As I have already written the problem arises only on Explorer, as you can see on jfiddle there's no issue.(That's why I didn't provide with a jsfiddle test case before)

However if you paste the code in an editor , you save it as proper html page and you open it with Explorer (I've test it with 8.0 on Windows 7 64bit) you'll see the error. The rowSpan is always reset to 1 when a row is cloned with clone().

I've tested the problem in all jquery's versions >= 1.71 including edge.

Changed May 29, 2012 01:03AM UTC by mikesherov comment:3

status: newpending

Make sure you provide an HTML doctype declaration... we don't support quirks mode: http://docs.jquery.com/Won't_Fix

http://en.wikipedia.org/wiki/Quirks_mode

Add in your doctype <!doctype html> and let us know if it's still not working.

Changed May 29, 2012 08:01AM UTC by gianluca_medici@tin.it comment:4

status: pendingnew

Replying to [comment:3 mikesherov]:

Make sure you provide an HTML doctype declaration... we don't support

My bad. I'm sorry. Here's the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"> 
<script type='text/javascript' src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<title>JS Bin</title>
</head>
<body>
  <table border="1" id="test"> 
<tr > 
	<th rowspan="2" nowrap align="left">16</th> 
	<td>123456789</td> 
</tr> 
<tr> 
	<td>123456879</td> 
</tr> 
</table>
<div id="log"></div>
<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){
function log(message) {
		$( "<div/>" ).text( message ).appendTo( "#log" );
		$( "#log" ).scrollTop( 0 );
}
log("First cell first column, Span original: "+$(test).get()[0].rows[0].children[0].rowSpan);
log("First cell first column, Span after cloning: "+$($(test).get()[0].rows[0]).clone()[0].children[0].rowSpan);
});//]]>
</script>
</body>
</html>

The problem still exists, even with jquery edge.

If the doctype is changed into the html5 doctype declaration, changing only the first line with this:

<!DOCTYPE html>

The problem does not happens.

Changed May 29, 2012 08:18AM UTC by gianluca_medici@tin.it comment:5

Replying to [comment:3 mikesherov]:

Make sure you provide an HTML doctype declaration... we don't support quirks mode: http://docs.jquery.com/Won't_Fix http://en.wikipedia.org/wiki/Quirks_mode Add in your doctype <!doctype html> and let us know if it's still not working.

Never mind. It seems that this doctype:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

in most browsers causes to render the page in quirks mode (thanks to the link from wikipedia) and that's why the problem arises. If the page is rendered in standard mode, like this for example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

then there's no problem.

(You could put a reference to this problem in the clone() documentation page, so it does not happen again to someone else)

Thanks anyway.

Changed May 29, 2012 10:06AM UTC by sindresorhus comment:6

component: unfiledmisc
priority: undecidedlow
resolution: → invalid
status: newclosed

As Mike said, we don't support Quirksmode.