How to use the incremental-dom.attr function in incremental-dom

To help you get started, we’ve selected a few incremental-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 node-organic / organic-oval / lib / incremental-create-element.js View on Github external
return function () {
      var createdElement
      if (tagName !== 'virtual' || originalTagName) {
        // console.log('element open ->', tagName, parsedAttrs.key)
        var TagClass = oval.getRegisteredTag(originalTagName || tagName)
        if (!TagClass) {
          IncrementalDOM.elementOpenStart(tagName, parsedAttrs.key, parsedAttrs.staticAttrs)
          for (var key in parsedAttrs.attrs) {
            IncrementalDOM.attr(key, parsedAttrs.attrs[key])
          }
        } else {
          IncrementalDOM.elementOpenStart(tagName, parsedAttrs.key)
        }
        createdElement = IncrementalDOM.elementOpenEnd()
        if (parsedAttrs.attrs['ref']) {
          tag.refs[parsedAttrs.attrs['ref']] = createdElement
        }
        if (parsedAttrs.attrs['freeze']) {
          IncrementalDOM.skip()
        }
        if (createdElement.tag) {
          if (!createdElement.tag.shouldRender) {
            IncrementalDOM.skip()
          } else {
            createdElement.tag.update(children, parsedAttrs.props, parsedAttrs.attrs)
github node-organic / organic-oval / engines / incremental-dom.js View on Github external
props: cleanprops,
          kids: kids,
          tagName: tagName
        }
        return
      }
      IncrementalDOM.elementOpenStart(tagName.toLowerCase(), parsedAttrs.oid)
      for (let key in parsedAttrs.attrs) {
        IncrementalDOM.attr(key, parsedAttrs.attrs[key])
      }
      if (!components[tagName]) {
        for (let key in parsedAttrs.props) {
          IncrementalDOM.attr(key, parsedAttrs.props[key])
        }
        for (let key in parsedAttrs.handlers) {
          IncrementalDOM.attr('on' + key, parsedAttrs.handlers[key])
        }
      }
      let createdElement = IncrementalDOM.elementOpenEnd()
      if (parsedAttrs.attrs['freeze']) {
        IncrementalDOM.skip()
      }
      if (components[tagName]) {
        IncrementalDOM.currentComponent = createdElement
        if (!createdElement.mounted) {
          components[tagName](createdElement)
          Object.assign(createdElement.state, parsedAttrs.props)
          for (let name in parsedAttrs.handlers) {
            createdElement.on(name, parsedAttrs.handlers[name])
          }
          appendChilds(kids)
          createdElement.connectedCallback()
github node-organic / organic-oval / engines / incremental-dom.js View on Github external
let cleanprops = {...props}
        delete cleanprops.slot
        IncrementalDOM.currentComponent.kids[props.slot] = {
          props: cleanprops,
          kids: kids,
          tagName: tagName
        }
        return
      }
      IncrementalDOM.elementOpenStart(tagName.toLowerCase(), parsedAttrs.oid)
      for (let key in parsedAttrs.attrs) {
        IncrementalDOM.attr(key, parsedAttrs.attrs[key])
      }
      if (!components[tagName]) {
        for (let key in parsedAttrs.props) {
          IncrementalDOM.attr(key, parsedAttrs.props[key])
        }
        for (let key in parsedAttrs.handlers) {
          IncrementalDOM.attr('on' + key, parsedAttrs.handlers[key])
        }
      }
      let createdElement = IncrementalDOM.elementOpenEnd()
      if (parsedAttrs.attrs['freeze']) {
        IncrementalDOM.skip()
      }
      if (components[tagName]) {
        IncrementalDOM.currentComponent = createdElement
        if (!createdElement.mounted) {
          components[tagName](createdElement)
          Object.assign(createdElement.state, parsedAttrs.props)
          for (let name in parsedAttrs.handlers) {
            createdElement.on(name, parsedAttrs.handlers[name])