WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
VERIFIED FIXED
3330
REGRESSION (125-300): JavaScript "children" array includes all descendants, not just immediate children
https://bugs.webkit.org/show_bug.cgi?id=3330
Summary
REGRESSION (125-300): JavaScript "children" array includes all descendants, n...
Timothy Hatcher
Reported
2005-06-07 20:42:30 PDT
Radar: 4063841 Summary: The "children" array on nodes returns children's children in on flattened array. This is a regression from Safari 1.2 and from the DOM specs. A test case is setup here. It "children.length" should return 5 for the number of div elements.
http://colloquy.info/test/children.html
Steps to Reproduce: 1) Access the children array on a DOM node with JavaScript. Expected Results: Only immediate children should be in the array, not the children's children, etc. Actual Results: The array has more elements than expected if the immediate children have children elements also. They all get flattened out into the main array (a recursive behavior). Regression: This is a regression from Safari 1.2 builds. Notes: Test case at:
http://colloquy.info/test/children.html
Attachments
Fix
(1.35 KB, patch)
2005-06-08 22:35 PDT
,
Timothy Hatcher
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Dave Hyatt
Comment 1
2005-06-07 20:45:35 PDT
This is actually a bug with collections in general. traverseNextItem begins by calling traverseNextNode, but traverseNextNode is a deep traversal. This means that shallow traversals like children are deep when they should not be when you make repeated calls to traverseNextItem to iterate (as calcLength does). The same is true of some of the other collections that should not be deep, and so this bug could be the cause of other HTML collection DOM bugs.
Timothy Hatcher
Comment 2
2005-06-08 22:35:51 PDT
Created
attachment 2168
[details]
Fix
Maciej Stachowiak
Comment 3
2005-06-08 23:33:21 PDT
I sent review comment to Timothy by email.
Timothy Hatcher
Comment 4
2005-06-20 07:55:59 PDT
This was fixed with the attached patch, and landed by Maciej. Thought I would close this and help out.
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