WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
47166
querySelectorAll('body>:last-child') does not work unless HTML file ends with 'new-line'.
https://bugs.webkit.org/show_bug.cgi?id=47166
Summary
querySelectorAll('body>:last-child') does not work unless HTML file ends with...
Hayato Ito
Reported
2010-10-05 03:29:48 PDT
Created
attachment 69768
[details]
test1.html Please see attachment files, test1.html and test2.html. The only difference between them is whether there is a 'new-line' at the end of file or not. - test1.html ends with 'new-line', like '... </html>\n<EOF>' - test2.html does not end with 'new-line', like '.... </html><EOF>'. Open each files, then try the following JavaScript code in JavaScript console. > document.querySelectorAll('body>:last-child') The results differs in test1.html and test2.html: - In test1.html, querySelectorAll returns a correct result, ['<div id="last">last</div>]. - In test2.html, querySelectorAll returns an empty list, [], which is wrong result. This might be a regression because Safari Version 5.0 (6533.16) returns the same correct results for both test1.html and test2.html.
Attachments
test1.html
(208 bytes, text/html)
2010-10-05 03:29 PDT
,
Hayato Ito
no flags
Details
test2.html
(207 bytes, text/html)
2010-10-05 03:30 PDT
,
Hayato Ito
no flags
Details
Patch
(4.05 KB, patch)
2010-10-27 23:03 PDT
,
Adam Barth
eric
: review+
eric
: commit-queue-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Hayato Ito
Comment 1
2010-10-05 03:30:27 PDT
Created
attachment 69769
[details]
test2.html
Adam Barth
Comment 2
2010-10-05 12:59:44 PDT
We had trouble with the last-child selector early on when developing the new tree builder. There's some API we need to call on an element when it's received its last child (as I recall). I'll possible we're screwing that up in this case. The newline at the end of the file gets moved to just inside the body element, which might be confusing something. Thanks for the report. I'll take a look.
Adam Barth
Comment 3
2010-10-27 22:32:42 PDT
Looking now.
Adam Barth
Comment 4
2010-10-27 23:03:52 PDT
Created
attachment 72148
[details]
Patch
Eric Seidel (no email)
Comment 5
2010-10-28 13:41:31 PDT
Comment on
attachment 72148
[details]
Patch OK. Your test case is really subtle. It should document that it's important to not have a newline at the end. Would probably be clearer if you document.wrote the contnet into an ifram.
Eric Seidel (no email)
Comment 6
2010-10-28 13:41:49 PDT
You mentioned there was a spec bug? What's the bug?
Adam Barth
Comment 7
2010-10-28 14:00:59 PDT
(In reply to
comment #6
)
> You mentioned there was a spec bug? What's the bug?
It's for one of the FIXME cases. It's just a typo in the spec.
Adam Barth
Comment 8
2010-11-02 12:15:49 PDT
Committed
r71147
: <
http://trac.webkit.org/changeset/71147
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug