Skip to content
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

First pass on optimizing lightbox performance #13679

Merged
merged 2 commits into from Feb 27, 2018

Conversation

cathyxz
Copy link
Contributor

@cathyxz cathyxz commented Feb 26, 2018

Found some mutations that didn't go in vsync.mutate.

this.toggleDescriptionOverflow_();
event.stopPropagation();
});
this.container_.appendChild(this.descriptionBox_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the only part that needs to be inside the vsync.mutate block is this.container_.appendChild(this.descriptionBox_); since that's the only mutation to the live DOM tree. Everything else is mutating detached nodes and has no effect on layout. The same goes for the other build* methods that create and modify new detached DOM nodes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh got it. Thank you!

@cathyxz cathyxz merged commit 249c98f into ampproject:master Feb 27, 2018
@cathyxz cathyxz deleted the bugfix/lightbox-perf branch February 27, 2018 23:54
RanAbram pushed a commit to RanAbram/amphtml that referenced this pull request Mar 12, 2018
* Improve lightbox performance

* Don't need to vsync mutate detached node manipulations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants