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

Sync Lightbox with Carousel #13050

Merged
merged 5 commits into from Jan 26, 2018

Conversation

cathyxz
Copy link
Contributor

@cathyxz cathyxz commented Jan 26, 2018

Closes #12578 and #13052

Copy link
Contributor

@cvializ cvializ left a comment

Choose a reason for hiding this comment

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

Overall looks good, but I want to bikeshed on the usage of hasOwnProperty.

* mapping of the lightbox group id to the carousel element.
* @private {!Object<string, !Element>}
*/
this.lightboxSourceCarousels_ = {};
Copy link
Contributor

Choose a reason for hiding this comment

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

This might need to be a src/object.js#map to speed up lookups. map is prototypeless so failed lookups happen faster. In the AMP codebase I see we generally prefer maps and map[key] notation vs {} literals and hasOwnProperty.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jridgewell any guidance?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed this and yes you're right. This should happen for security reasons too, not just performance.

@cathyxz
Copy link
Contributor Author

cathyxz commented Jan 26, 2018

Actually I realized that I forgot to handle a pretty major edge case here, which is making sure that sync-ing still behaves properly when we exclude items from the lightbox. Going to add logic for that.

@cathyxz cathyxz force-pushed the feature/sync-lightbox-carousel branch from 9249058 to d6daf5d Compare January 26, 2018 20:43
@cathyxz cathyxz removed their assignment Jan 26, 2018
@cathyxz cathyxz merged commit 6f3a877 into ampproject:master Jan 26, 2018
@cathyxz cathyxz deleted the feature/sync-lightbox-carousel branch January 26, 2018 22:15
jonkeller pushed a commit to jonkeller/amphtml that referenced this pull request Jan 29, 2018
* Sync slides to lightbox

* Only exit if you're going back to your original element or you're a sync-ed carousel

* Exclude scroll carousel

* Add null check to shouldAnimate

* Handle excluding elements from lightbox
RanAbram pushed a commit to RanAbram/amphtml that referenced this pull request Mar 12, 2018
* Sync slides to lightbox

* Only exit if you're going back to your original element or you're a sync-ed carousel

* Exclude scroll carousel

* Add null check to shouldAnimate

* Handle excluding elements from lightbox
protonate pushed a commit to protonate/amphtml that referenced this pull request Mar 15, 2018
* Sync slides to lightbox

* Only exit if you're going back to your original element or you're a sync-ed carousel

* Exclude scroll carousel

* Add null check to shouldAnimate

* Handle excluding elements from lightbox
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

3 participants