react-magic icon indicating copy to clipboard operation
react-magic copied to clipboard

Bookmarklet fails on tt

Open electrum opened this issue 11 years ago • 5 comments

I tried the bookmarklet on http://cr.yp.to/ and it fails with this in the Chrome console:

 Uncaught Error: Something bad happened when transforming HTML to JSX: ReferenceError: tt is not defined

electrum avatar Oct 22 '14 22:10 electrum

This is because React doesn't recognise the <tt> element. React 0.11 and older has a whitelist of HTML tags that it recognises, and I guess tt is not one of them.

The RC of React 0.12 has removed this whitelist and instead treats all lowercase tags as HTML tags (see http://facebook.github.io/react/blog/2014/10/16/react-v0.12-rc1.html). Using React 0.12 instead of 0.11 should avoid this issue. Try using http://fb.me/react-0.12.0-rc1.min.js instead of 0.11 and see if that works for you.

Daniel15 avatar Oct 22 '14 22:10 Daniel15

I tried that and got the same error.

electrum avatar Oct 22 '14 22:10 electrum

Oh I forgot to mention you'll probably have to update the JSXTransformer reference to point to 0.12 RC1 as well.

Daniel15 avatar Oct 23 '14 17:10 Daniel15

<tt> is obsolete. React still uses a whitelist for the time being in 0.12 (it's not gone completely yet), but we won't be adding support for obsolete tags.

zpao avatar Oct 28 '14 00:10 zpao

Oh, I didn't realise a whitelist was still used. I could work around this by converting <tt> to a different tag like <code> or something, but perhaps that's unexpected behaviour and will result in strangeness if they're using CSS rules explicitly targeting tt tags.

Daniel15 avatar Oct 28 '14 00:10 Daniel15