Bug Tracker

Modify

Ticket #11747 (closed bug: invalid)

Opened 12 months ago

Last modified 12 months ago

Incorrete rowspan after Clone() in Explorer

Reported by: gianluca_medici@… Owned by: gianluca_medici@…
Priority: low Milestone: None
Component: misc Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:

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>

Change History

comment:1 follow-up: ↓ 2 Changed 12 months ago by sindresorhus

  • Owner set to gianluca_medici@…
  • Status changed from new to pending

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.

comment:2 in reply to: ↑ 1 Changed 12 months ago by gianluca_medici@…

  • Status changed from pending to new

Replying to 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.

comment:3 follow-ups: ↓ 4 ↓ 5 Changed 12 months ago by mikesherov

  • Status changed from new to pending

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.

comment:4 in reply to: ↑ 3 Changed 12 months ago by gianluca_medici@…

  • Status changed from pending to new

Replying to 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.

comment:5 in reply to: ↑ 3 Changed 12 months ago by gianluca_medici@…

Replying to 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.

comment:6 Changed 12 months ago by sindresorhus

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to misc

As Mike said, we don't support Quirksmode.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.