prismicio / prismic-toolbar

An embeddable UI for Prismic content and previews directly on your website.
12 stars 19 forks source link

fix: treat dev.style as an object. #59

Closed MarcMcIntosh closed 4 years ago

MarcMcIntosh commented 4 years ago

56

fixed issue with setAttribute("style", obj) resulting in

Documentation on recreating and testing this has been added to notion.

Or can be reproduce on a web-based code editor with

<div id="foo" />
<script>
  const elem = document.getElementById("foo")
  const styl =  { width: "100px", height: "100px", backgroundColor: "red" };
  // here
  elem.setAttribute("style", styl);
<script>

The following code fix the issue

<div id="foo" />
<script>
  const elem = document.getElementById("foo")
  const styl =  { width: "100px", height: "100px", backgroundColor: "red" };
  // here
  Object.assign(elem.style, styl);
<script>