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

Implement twitter with resize event #3397

Merged
merged 6 commits into from Jun 2, 2016

Conversation

indianburger
Copy link
Contributor

Intent to implement reference: #3377
Twitter exposes a resize event which can be used instead of setting up listeners. Also use the element returned by twttr.widgets.createTweet instead of looking for iframes/shadow DOM elements. This avoid AMP breaking when twitter changes internal implementation.

Testing done:
gulp dist --fortesting; gulp test: I have 2 unrelated tests that fail constantly. Perhaps I'm running it wrongly?
Manual tests. Ran the twitter example page in IE edge 12, mobile safari 9.2, Chrome 50, FF 46, Android Chrome 49.

I can do more testing, let me know where I should spend my time.

@mkhatib
Copy link
Contributor

mkhatib commented Jun 1, 2016

This LGTM thanks for doing some manual testing. @cramforce mind taking a look as well?


let twitterWidgetSandbox;
twttr.events.bind('resize', event => {
if (twitterWidgetSandbox === event.target) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a comment as to what other cases happen here.

@cramforce
Copy link
Member

Nice! So much simpler :)

LGTM with one comment.

}
});

twttr.widgets.createTweet(data.tweetid, tweet, data).then(el => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems you still need to /*OK*/then this promise. You can check for failures locally with gulp presubmit

Copy link
Member

Choose a reason for hiding this comment

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

Yep. Quick explanation: We do not ship with a promise polyfill inside of this iframe ourselves.

@mkhatib mkhatib merged commit aafab93 into ampproject:master Jun 2, 2016
@mkhatib
Copy link
Contributor

mkhatib commented Jun 2, 2016

Thanks @indianburger for sending this! Let us know if there are some more stuff we can do to make amp-twitter even better (e.g. other useful params to expose for publishers to use).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants