✨ Update FixedLayer on Element Hidden Toggle#18797
Merged
jridgewell merged 8 commits intoampproject:masterfrom Oct 23, 2018
Merged
✨ Update FixedLayer on Element Hidden Toggle#18797jridgewell merged 8 commits intoampproject:masterfrom
jridgewell merged 8 commits intoampproject:masterfrom
Conversation
dreamofabear
left a comment
There was a problem hiding this comment.
Looks good. Will approve after rebase.
src/service/fixed-layer.js
Outdated
| } | ||
|
|
||
| /** | ||
| * Clears the mutation observer and it's pass queue. |
src/service/fixed-layer.js
Outdated
| } | ||
|
|
||
| /** | ||
| * @return {?MutationObserver} |
| for (let i = 0; i < mutations.length; i++) { | ||
| const mutation = mutations[i]; | ||
| if (mutation.attributeName === 'hidden') { | ||
| this.updatePass_.schedule(16); |
There was a problem hiding this comment.
Explain magic number in a comment?
Contributor
|
@jridgewell @choumx would this make it to Canary tomorrow of 10/30 release? |
3d8ff81 to
ce11c0d
Compare
dreamofabear
approved these changes
Oct 23, 2018
dreamofabear
left a comment
There was a problem hiding this comment.
Let's gate this under an default-enabled experiment so we can easily turn it off if needed.
| const mutation = mutations[i]; | ||
| if (mutation.attributeName === 'hidden') { | ||
| // Wait one animation frame so that other mutations may arrive. | ||
| this.updatePass_.schedule(16); |
There was a problem hiding this comment.
For a follow-up: bit of a waste to run the whole update() on a single element's hidden attribute change, no? Can we constrain the operation to just the mutated elements?
Contributor
Author
Yah, I'll wait for this to land before cutting canary. I'm on duty this week, so it's lucky. |
8680549 to
74fd22d
Compare
74fd22d to
a0366af
Compare
Enriqe
pushed a commit
to Enriqe/amphtml
that referenced
this pull request
Nov 28, 2018
* Initial fixed-layer mutaiton observer * Unobserve if possible * Fake mutation observer class * Tests * Review comments * Guard mutation-observer behind an experiment * Add experiment * Fix tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now when an element is toggled (hidden or un-hidden), the
FixedLayerwill run an update.Fixes #17475
Fixes #16554
Fixes #16933
Depends on #18788