JavaScript error in Widgets-JS on websites using FastDOM 1.0 (with JSFiddle demo!)

embeddedtweet
javascript

#1

Twitter’s widgets-js script throws an error if the website uses FastDOM 1.0:

widgets.js:8 Uncaught (in promise) TypeError: u.write is not a function(…)

JSFiddle demo: https://jsfiddle.net/steffenweber/bph95z8j/

Twitter’s widgets-js checks whether window.fastdom exists. If it does not exist then widgets-js injects its own copy of FastDOM 0.x and everything is fine. However, if window.fastdom does exist then widgets-js uses it assuming that the FastDOM version is 0.x and not the current version 1.0 (which has a completely different API). This is where things break.

For example, fastdom.read and fastdom.write have been renamed to fastdom.measure and fastdom.mutate in FastDOM 1.0. Furthermore, fastdom.defer has been removed.


#2

Thank you for your report. We acknowledge the issue and are working on a solution with FastDom.


#3

For reference, a link to the FastDOM bug report: https://github.com/wilsonpage/fastdom/issues/90


#4

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.