Closed Bug 717211 Opened 13 years ago Closed 12 years ago

last-child selector bug for nested tables

Categories

(Firefox :: Untriaged, defect)

9 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: mats, Unassigned)

Details

Attachments

(1 file)

Attached file 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
Removing the top level 'div' makes the bug go away for some reason... Same in Chrome and IE9
Note that first table should be ignored (it's not a last-child)

"table:last-child td"
Attachment #587657 - Attachment mime type: text/plain → text/html
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
Closed: 12 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: