We have been using the createWidget function to load widgets on our website and suddenly we began receiving an error that r.appendChild was not a function.
Digging down into it it appears that the parameters and target element are being reversed. It works sometimes and it does not work other times, it appears that it may be an issue with a particular tweet.
Here is the gist of the function:
function $loadTweet( e){ //e is the target dom element
var tweetToLoad = ...;
var cbFunction = this.onTweetLoaded;
var loadedFunction = function(el){
if (el && el.contentDocument) {
var postElement = el.contentDocument.querySelector('.Tweet-text');
cbFunction.call(that, postElement);
}
}
;
var config = {cards:'hidden', converstation:'none', dnt:'true'};
var twObj = (new $wnd.twttr.widgets.createTweet(tweetToLoad, e, config)).then(loadedFunction);
return twObj;
}
Here is a tweet that it appears to be not working on 677922279905468416.
Here is a tweet that it appears to be working on 689621760044564480.
In the case where it is working:
parameters looks like:
cards: "hidden"
converstation: "none"
dnt: "true"
hideCard: true
hideThread: false
tweetId: "689621760044564480"
targetEl: div#tweet-689621760044564480
in the case where it is not working:
parameters: Object
tweetId: "677922279905468416"
targetEl: Object
cards: "hidden"
converstation: "none"
dnt: "true"
hideCard: true
hideThread: false
What could cause the dom object to be dropped and the config be shoved into the targetEl parameter?