-
Notifications
You must be signed in to change notification settings - Fork 55
fixes #504, avoids global list of all MutationObservers #505
Conversation
@arv mind taking a look? |
@@ -180,13 +183,11 @@ | |||
record.oldValue = associatedStrings[uid]; | |||
|
|||
// 8. | |||
if (!observer.records_.length) { | |||
scheduleCallback(observer); | |||
} | |||
observer.records_.push(record); |
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 this reordering intentional?
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.
Never mind.
LGTM Nice work around |
Actually. Could we move the call to scheduleCallback out of the loop. No need to do that work more than once. |
Done. Yeah was thinking it probably didn't matter much perf wise (because of the length check, and the isScheduled check inside scheduleCallback), and I liked having one less state variable and slightly better "encapsulation" of the global list (only schedule/notify touch it). But those are very minor things in the grand scheme of things. :) |
by the way, @arv do you usually prefer to squash into a single commit before submitting a pull req? |
LGTM Squashing is preferred. Less churn. |
thanks! will squash the follow up & land :) |
d8fcfe2
to
7c8b908
Compare
fixes #504, avoids global list of all MutationObservers
They're now added to the global list on-demand, and it is sorted by ID before delivering. Sounds like this is similar to the Blink implementation (https://github.com/Polymer/ShadowDOM/issues/504#issuecomment-55013158)