Skip to content

Table manipulation regression (XHTML) #2493

@anthonyryan1

Description

@anthonyryan1

jQuery 3.0 introduced an XHTML regression in the appending and updating of table rows, it appears the outermost element in every .append(), .html(), .load(), etc gets removed and only the contents of that outermost element are actually appended or set as the innerHTML.

Simple test case (requires Content-type: application/xhtml+xml; charset=utf-8; to properly demonstrate the regression)

<!-- fill in doctype, html, head, body, etc. -->
<table>
<thead>
    <tr>
        <th>One</th>
        <th>Two</th>
        <th>Three</th>
    </tr>
</thead>
<tbody id="append"></tbody>
</table>
$(document).ready(function(){
    $('#append').append('<tr><td>Four</td><td>Five</td><td>Six</td></tr>');
    $('#append').append('<tr><td>Seven</td><td>Eight</td><td>Nine</td></tr>');
});

In XHTML mode, the resulting DOM is the equivalent of:

<table>
<thead>
    <tr>
        <th>One</th>
        <th>Two</th>
        <th>Three</th>
    </tr>
</thead>
<tbody id="append">
    <td>Four</td>
    <td>Five</td>
    <td>Six</td>
    <td>Seven</td>
    <td>Eight</td>
    <td>Nine</td>
</tbody>
</table>

I've also noticed the XHTML test harness is once again broken and likely how this regression occurred, but that's outside the scope of this issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions