-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Effective children #2548
Effective children #2548
Conversation
Conflicts: src/lib/dom-api.html
…xample, when attributes change under Shadow DOM.
Conflicts: src/lib/dom-api.html
…tifications under shadow dom.
Conflicts: test/unit/utils-content.html test/unit/utils-elements.html
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
for (var i=0, h, n; (i < elements.length) && (n=elements[i]); i++) { | ||
if (this._isContent(n)) { | ||
n.__observeNodesMap = n.__observeNodesMap || new WeakMap(); | ||
if (n.__observeNodesMap.get(this) == null) { |
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.
n.__observeNodesMap.has(this)
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.
Is the check necessary? If everything is working correctly, should only ever observe one content once?
// attribute tracking? | ||
this._observer.observe(this.node, { | ||
childList: true, | ||
attributes: true, |
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.
Sucks that there's no childList
+ attributes
combo that actually means "any attribute changes on my childList".
So any change (add, remove, attribute change) to any of its light children descendants will incur the cost of an _observeContentElements
iteration (once) and a levenshtein (per listener).
Seems potentially expensive enough to keep the attributes option, since it allows you to remove both attributes
+ subtree
.
Is there an option to auto-enable attributes if you encounter a select
on a <content>
while observing? Or is that too complicated?
…t select> that depends on attributes; add tests.
this._scheduleNotify.bind(this)); | ||
if (this._hasAttrSelect()) { | ||
Polymer.dom(host).observer.enableShadowAttributeTracking(); | ||
this._observer._alwaysCallListener = true; |
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.
_alwaysCallListener
needs to get passed up via enableShadowTracking
?
…ibutes under native Shadow DOM; +minor factoring
LGTM! 👍 🏆 children: [ 👦 👧 👶 ] changed: [ 🚸 ] |
@sorvell / @kevinpschaaf any design docs around this feature / why it is good / how/when to use it? |
Will be forthcoming after discussion with @arthurevans ... |
What I have learned so far is:
For example, consider a tab panel element that we use like this:
The contract is simply: clicking the first tab shows the first tab-page, and so on. But since I'm a good citizen, I want to generate unique IDs for each of these elements and set up ARIA attributes to link them: It's easy to do this once in Now I can do something like:
Which is pretty nifty, right? |
See also: Chris's PR, above, for example niftiness. |
Wooot for observeNodes makes sense thx @arthurevans , is there a way to unregister an observation? nm I found |
@sorvell @arthurevans The asynchrony involved in using a |
Q: should |
@samccone I don't think that you necessarily want that always, although I admit it is usually dubious for a user to want to respond to these types of changes while detached. |
I only wonder because of the potential for users to shoot themselves in the foot memory leak wise with this non private API. |
In support of what you are saying, |
Okay, I take that back. |
yeah so, imho unregistering automatically is a huge win for users from a memory and leak standpoint.. with the ability to conditionally opt out of this behavior Can anyone come up with a case why this should not act this way? |
Can you open an issue to discuss? This PR probably isn't the right place to On Wed, Oct 14, 2015 at 5:17 PM Sam Saccone [email protected]
|
No description provided.