Closed Bug 378593 Opened 17 years ago Closed 14 years ago

javascript not handling correctly the lastChild selector, it selects a white space, not an element of the DOM

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: joao.bordalo, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2

Mozilla browsers don't get the last element of the DOM when using the lastChild selector.

For more info, check my blog post on:

http://joaobordalo.com/articles/2007/04/24/lastchild-in-mozilla-browsers

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Please provide a URL or (preferably) attach small example that demonstrates
the problem.
This is expected behavior. White space needs to be preserved in the DOM.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Component: General → DOM: Core & HTML
Product: Firefox → Core
QA Contact: general → general
Resolution: --- → INVALID
Verified.  If you want the last _element_, use lastElementChild.

Note that this is a known longstanding bug in IE; what lastChild returns in IE will actually change depending on the CSS applied.  Every single other browser gets this right.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.