3

The following code:

$('<TABLE />').append('<TR><TD>1</TD></TR>').appendTo('BODY');

results in slightly different DOM structures.

Under 2.2.4 you get <TABLE><TBODY><TR>...

var table = $('<TABLE />');
table.append('<TR><TD>1</TD></TR>').appendTo('BODY');
console.log(table.prop('outerHTML'))
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>

Under 3.1.1 you get <TABLE><TR>...

var table = $('<TABLE />');
table.append('<TR><TD>1</TD></TR>').appendTo('BODY');
console.log(table.prop('outerHTML'))
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

(one has a TBODY and one does not)

This causes problems if you later have selectors like #id TBODY TR (to get all the body rows, and no header rows).

I've reviewed the jQuery Core 3.0 Upgrade Guide and can't see anything that might be related.

So my question is... is this expected behaviour or a bug in JQuery?

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.