sketch.js icon indicating copy to clipboard operation
sketch.js copied to clipboard

When augmenting a DOM element, height is undefined

Open KingScooty opened this issue 8 years ago • 1 comments

<div class="test-context"></div>
var container = document.querySelectorAll('.test-context')[0];
var test = Sketch.augment(container);

As far as i'm aware, i should be able to augment an existing DOM element and manipulate said DOM element using CSS.

I seem to be getting the following error:

Cannot read property 'height' of undefined

On sketch.js 298, which looks like it's not getting the style.height correctly for DOM elements.

Am i missing a step? Or is this an error with Sketch?

KingScooty avatar Dec 06 '16 13:12 KingScooty

Looks like this could be a bug, yes—I'll look into that. Although for now it will work if you use create instead, passing in the container:

var test = Sketch.create({
  container: container
});

soulwire avatar Jan 03 '17 07:01 soulwire