Closed
Bug 179709
Opened 22 years ago
Closed 22 years ago
obj.lastChild returns undefined ID
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
People
(Reporter: matiasnu, Assigned: jst)
References
()
Details
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.2b) Gecko/20021016 Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.2b) Gecko/20021016 When using lastChild on a table row to get the last td in the row, mozilla/chimera/netscape on Mac and PC returns Undefined (if I try to get the ID of the table cell). Explorer 5.2 Mac OS X, and Explorer 5.0 PC returns the ID as they are supposed to do. Reproducible: Always Steps to Reproduce: 1.Load the url http://homepage.mac.com/matias/lastchildbug.html 2.Click on the table 3.The alert should return "B" and not undefined. Actual Results: The alert returned undefined Expected Results: It should have returned the Id of the last td.
Comment 1•22 years ago
|
||
Nice testcase! Browser, not engine ---> DOM Level 0. Confirming reported behavior with Mozilla trunk 20021107xx on WinNT. <html><head><script> function getLastChild(object) { var lc = object.lastChild; alert('the element you clicked was: ' + object.id + ' and the last child of this element is: ' + lc + ' (should be B)'); } </script><body><table border="1"> <tr id="TableRow" onClick="getLastChild(this);"> <td id="A">A</td> <td id="B">B</td> </tr> </table></body></html> In Mozilla's Tools > Web Development > JavaScript Debugger, we see that |lc| is an object of type Text, containing "\n", and that |lc.previousSibling| is the table cell element "B". The reason 'undefined' pops up is just because the [object Text] element wasn't given an HTML id. The real issue is, should |lc| evaluate to this text node, or to the table cell element "B"?
Assignee: rogerl → jst
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → DOM Level 0
Ever confirmed: true
QA Contact: pschwartau → desale
Comment 2•22 years ago
|
||
It should evaluate to the text node. *** This bug has been marked as a duplicate of 26179 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•