If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

last-child selector bug for nested tables

RESOLVED INVALID

Status

()

Firefox
Untriaged
RESOLVED INVALID
6 years ago
6 years ago

People

(Reporter: Mats, Unassigned)

Tracking

9 Branch
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
Created attachment 587657 [details]
buttons.html

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1
Build ID: 20111220165912

Steps to reproduce:

Run the pasted source

<html>
<head>
    <title>BUG</title>
</head>
<body>
<div>
    <table>
        <tr>
            <td>
                <div id="FOOOO">
                    <div>
                        <div>
                            <table>
                                <thead>
                                    <tr>
                                        <td>
                                        </td>
                                    </tr>
                                </thead>
                            </table>
                            <table>
                                <thead>
                                    <tr>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                    </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                </div>
            </td>
        </tr>
    </table>
    </div>
    <span id="result"></span>
    <script type="text/javascript">
        var nbrTds = document.getElementById('FOOOO').querySelectorAll('table:last-child td').length;
        document.getElementById('result').innerHTML = nbrTds + ' TDs found, expecting 4';
    </script>
</body>
</html>



Actual results:

Saw 5 TDs


Expected results:

Saw 4 TDs
(Reporter)

Comment 1

6 years ago
Removing the top level 'div' makes the bug go away for some reason... Same in Chrome and IE9
(Reporter)

Comment 2

6 years ago
Note that first table should be ignored (it's not a last-child)

"table:last-child td"

Updated

6 years ago
Attachment #587657 - Attachment mime type: text/plain → text/html

Comment 3

6 years ago
There is no bug.

The first table *is* the last child its parent element (the div element) - no more sibilngs are present after the table. It is no longer the last child if you remove the outermost div element (the table has a span and a script sibling).
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.