How to use the spritejs.createNode function in spritejs

To help you get started, we’ve selected a few spritejs 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 spritejs / sprite-react / src / SpriteRender.js View on Github external
function applyAttrs(target, props) {
  const events = {};
  props = Object.assign({}, props);

  Object.keys(props).forEach((key) => {
    if(key.indexOf('on') === 0) {
      const eventName = key.slice(2).toLowerCase();
      events[eventName] = props[key];
      delete props[key];
    }
  });

  if(typeof target === 'string') target = createNode(target, props);
  else target.attr(props);

  Object.keys(events).forEach((key) => {
    target.__originalEvents = target.__originalEvents || {};
    target.off(key, target.__originalEvents[key]);
    target.on(key, events[key]);
    target.__originalEvents[key] = events[key];
  });

  return target;
}
github Tencent / omi / packages / omi-sprite / src / nodeapi.js View on Github external
export function createElement(tagName) {
  return createNode(tagName)
}
export function createElementNS(namespaceURI, qualifiedName) {
github Tencent / omi / packages / omi-sprite / src / nodeapi.js View on Github external
export function createElementNS(namespaceURI, qualifiedName) {
  return createNode(qualifiedName)
}
export function createTextNode(text) {