Closed tkh44 closed 8 years ago
Ahh - I had left this out because I wanted undom to treat SVG elements as regular elements, but I realize now this would throw because SVGElement would then be undefined. Perhaps undom can just export SVGElement as an alias of Element (thus making it global when pulled in via the polyfill).
I wasn't sure how to accomplish this either because of the straight call to SVGElement from window.
The polyfill installs everything from document.defaultView
as globals, so just adding the alias should make it a global as well.
Let me know if you're able to test that this fixed things for you! :)
Ok will do
Tested and working!
I just did Object.assign(global, undom())
. Is this the method you would use?
That's basically all the polyfill does, just a little easier to type:
import 'undom/register';
// or
require('undom/register');
I'll cut a release with this fix ASAP. Working on a V2 though ;)
Now that preact checks for
instanceof SVGElement
you are unable to test preact components using undom.https://github.com/developit/preact/blob/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9/src/vdom/diff.js#L37