shama / yo-yoify

Transform choo, yo-yo or bel template strings into pure and fast document calls
111 stars 17 forks source link

Inline style isn't being set correctly #31

Open josephg opened 7 years ago

josephg commented 7 years ago

This code:

  const canvas = yo`<canvas style="width: ${width}px; height: ${height}px;" />`;

... Works without yo-yoify, but with yo-yoify the string is truncated after 'height:':

<canvas style="width: 300px; height: "></canvas>

(Yo-yoify turned it into this):

  const canvas = (function () {
          var ac = require('/Users/josephg/src/b/steamdance/node_modules/yo-yoify/lib/appendChild.js')
          var bel0 = document.createElement("canvas")
bel0.setAttribute("style", "width: " + arguments[0] + "px; height: ")
          return bel0
        }(width));
yoshuawuyts commented 7 years ago

this feels a bit like an edge case; does this still happen if you define the styles in a string outside of the main template?

On Sat, Nov 19, 2016 at 1:03 AM Joseph Gentle notifications@github.com wrote:

This code:

const canvas = yo<canvas style="width: ${width}px; height: ${height}px;" />;

... Works without yo-yoify, but with yo-yoify the string is truncated after 'height:':

(Yo-yoify turned it into this):

const canvas = (function () { var ac = require('/Users/josephg/src/b/steamdance/node_modules/yo-yoify/lib/appendChild.js') var bel0 = document.createElement("canvas")bel0.setAttribute("style", "width: " + arguments[0] + "px; height: ") return bel0 }(width));

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/shama/yo-yoify/issues/31, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWlesdVSn_RrNphOBRKH6PjSsOiwWNaks5q_jy4gaJpZM4K3DRA .

josephg commented 7 years ago

If I do that it works fine - thats how I've gotten around it for now.

https://github.com/josephg/steamdance/blob/07f2a7c911f43c901120a88827b44aa1154af567/browser/simplegrid.js#L74-L81