-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support non-Bento children of Bento elements #33450
Conversation
Hey @jridgewell! These files were changed:
|
1556efb
to
b632851
Compare
} else { | ||
// Breadth-first search. Rely on the `getElementsByClassName` DOM order | ||
// to ignore DOM subtrees already covered. | ||
seen = seen || []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be a Set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied it from owners-impl.js
. But the reason it's not a set is because the test is not seen.contains(target)
, but seen.some(x => x.contains(target))
. The uniqueness of seen
itself is guaranteed by the querySelectorAll
. Do you think those cases are still improved by using a set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, iterating a Set is considerably slower than iterating an array. Given we must do a some
, the Array is the right choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. That's what I figured as well.
This looks a bit like "owners" code and some of that code was moved. But a big improvement is that this approach no longer requires us to intercept a child's lifecycle - we never need to call
Owners.setOwner()
here. As such, the iterators have become simple static utils which I moved to thesrc/utils/resource-container-helper.js
.Also, notice that all lifecycle calls I made via
requiresIdleCallback
when available.More specific changes are:
slot.js
. These are changes are very modest in size.owners-impl.js
has been moved as a set of static utilities into thesrc/utils/resource-container-helper.js
.test-owners.js
and added a bunch of new tests.Partial for #30952.