edemaine / svgtiler

Tool for drawing diagrams on a grid, combining grids of SVGs into a big SVG figure
MIT License
58 stars 6 forks source link

xlink:href in preact tags #41

Closed diomidov closed 4 years ago

diomidov commented 5 years ago
svgtiler puuull.coffee svgtiler/*.asc
* puuull.coffee
/home/diomidov/.npm-global/lib/node_modules/svgtiler/node_modules/coffeescript/lib/coffeescript/coffeescript.js:60
        throw helpers.updateSyntaxError(err, code, options.filename);
        ^

puuull.coffee:7:17: error: unexpected :
    <image xlink:href="data:image/png;base64,#{base64}" />

It works if I explicitly call preact.h:

    preact.h('image', {
        'xlink:href': "data:image/png;base64,#{base64}"
    })
edemaine commented 5 years ago

Thanks for the report. This sounds like a problem with the Babel transpiler, though I thought I passed the argument to explicitly allow namespaces like this.. Will investigate.

edemaine commented 5 years ago

This turns out to be a bug in CoffeeScript; it works fine in JSX. Once https://github.com/jashkenas/coffeescript/pull/5218 is merged, this will be fixed. If it's urgent, I can switch the coffeescript version to my fork.

diomidov commented 5 years ago

Not urgent, I used the preact.h workaround.