Hi all!
I’m using platform.twitter.com/widgets.js to embed tweets into my webapp. In this app, for smooth UX I manually wrap all my DOM updates, for example:
my_wrapper(function () {
node.textContent = 'changed!';
});
where my_wrapper notices changes to page layout/scroll position as a result of the DOM update, and compensates by adjusting the scroll position.
Now my issue is that Twitter’s widgets.js scans for <blockquote> and turns them into <twitterwidget> asynchronously on its own schedule, resulting in my app’s layout being pushed around unpredictably.
My question is–how can I embed tweets in a controlled manner? Solutions I can think of, in order of preference:
- Predicting the dimensions of an embedded tweet before it loads
- Calling some internal
transformIntoTwitterWidget(blockquote) directly
- A hook into the DOM updates
- Somehow coding my app without
my_wrapper
- Wrapping the tweet in a fixed-size container with a scrollbar