Closed
Bug 632010
Opened 14 years ago
Closed 14 years ago
DOM table.tHead.rows.length is 0 expected >0
Categories
(Core :: General, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: sven.siwek, Unassigned)
Details
(Keywords: testcase)
Attachments
(1 file)
|
1.31 KB,
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ( .NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ( .NET CLR 3.5.30729)
I created a table with <THEAD><TH>......</TH></THEAD>
In javascript I don't get the expected value.
Reproducible: Always
Steps to Reproduce:
Look at the html example.
It happens every time.
Actual Results:
I get 0
Expected Results:
I expect > 0
Other Browsers do generate the correct result ( Tested with Google Chrome and IE 8 )
<html>
<head>Test
</head>
<script>
addEvent(window, "load", sortables_init);
var SORT_COLUMN_INDEX;
function sortables_init() {
// Find all tables with class sortable and make them sortable
if (!document.getElementsByTagName) return;
tbls = document.getElementsByTagName("table");
for (ti=0;ti<tbls.length;ti++) {
thisTbl = tbls[ti];
if (((' '+thisTbl.className+' ').indexOf("sortable") != -1) && (thisTbl.id)) {
alert("THEAD rows is :"+thisTbl.tHead.rows.length);
}
}
}
function addEvent(elm, evType, fn, useCapture)
// addEvent and removeEvent
// cross-browser event handling for IE5+, NS6 and Mozilla
// By Scott Andrew
{
if (elm.addEventListener){
elm.addEventListener(evType, fn, useCapture);
return true;
} else if (elm.attachEvent){
var r = elm.attachEvent("on"+evType, fn);
return r;
} else {
alert("Handler could not be removed");
}
}
</script>
<body>
<center>Test for DOM: table.tHead.rows.length</center>
<table id="tab1" class="sortable">
<thead>
<th>column 1</th>
<th>column 2</th>
<th>column 3</th>
</thead>
<tbody>
<tr><td>1</td><td>a</td><td>a1</td></tr>
<tr><td>2</td><td>b</td><td>b2</td></tr>
<tr><td>3</td><td>c</td><td>c3</td></tr>
<tr><td>4</td><td>d</td><td>d4</td></tr>
</body>
</html>
Comment 1•14 years ago
|
||
Confirmed on http://hg.mozilla.org/releases/mozilla-1.9.2/rev/a46241adb9b9.
WFM ("1" as Result) on http://hg.mozilla.org/mozilla-central/rev/4c62984f12d1.
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → 1.9.2 Branch
Comment 2•14 years ago
|
||
Comment 3•14 years ago
|
||
The old HTML parser doesn't do invalid-markup fixup on this testcase, so doesn't create an <tr> kids of the <thead>; instead the <th> are just kids of the <thead> directly.
The HTML5 parser creates a <tr> kid in this situation.
This is fixed in trunk; we're not going to change the behavior on the 1.9.2 branch.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•