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
Conversation
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) { |
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.
Maybe add a comment as to what other cases happen here.
Nice! So much simpler :) LGTM with one comment. |
} | ||
}); | ||
|
||
twttr.widgets.createTweet(data.tweetid, tweet, data).then(el => { |
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.
Seems you still need to /*OK*/then
this promise. You can check for failures locally with gulp presubmit
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.
Yep. Quick explanation: We do not ship with a promise polyfill inside of this iframe ourselves.
Thanks @indianburger for sending this! Let us know if there are some more stuff we can do to make |
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.