How to use the driver-dom.setStyle function in driver-dom

To help you get started, we’ve selected a few driver-dom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alibaba / rax / packages / driver-universal / src / dom.js View on Github external
setStyle(node, style) {
    if (Array.isArray(style)) {
      style = style.reduce((prev, curr) => Object.assign(prev, curr), {});
    }
    const tranformedStyle = transformStyle(style);

    // Fist use DriverDOM set standard style.
    DriverDOM.setStyle(node, tranformedStyle);
    // Second process flex compatible style, like {display: ["-webkit-box", "-webkit-flex", "flex"]}.
    for (let prop in tranformedStyle) {
      if (tranformedStyle.hasOwnProperty(prop)) {
        const transformValue = tranformedStyle[prop];
        // Hack handle compatibility issue
        if (Array.isArray(transformValue)) {
          for (let i = 0; i < transformValue.length; i++) node.style[prop] = transformValue[i];
        }
      }
    }
  }
});
github alibaba / rax / packages / driver-miniapp / src / index.js View on Github external
setStyle(node, style) {
    return DriverDOM.setStyle(node, style, true);
  }
});

driver-dom

DOM driver for Rax

BSD-3-Clause
Latest version published 4 years ago

Package Health Score

57 / 100
Full package analysis

Similar packages