spec/uglify/riot.js
function setNamed(dom, parent, keys) {
  // get the key value we want to add to the tag instance
  var key = getNamedKey(dom),
    isArr,
    // add the node detected to a tag instance using the named property
    add = function(value) {
      // avoid to override the tag properties already set
      if (contains(keys, key)) return
      // check whether this value is an array
      isArr = isArray(value)
      // if the key was never set
      if (!value)
        // set it once on the tag instance
        parent[key] = dom
      // if it was an array and not yet set
      else if (!isArr || isArr && !contains(value, dom)) {
        // add the dom node into the array
        if (isArr)
          value.push(dom)
        else
          parent[key] = [value, dom]
      }
    }

  // skip the elements with no named properties
  if (!key) return

  // check whether this key has been already evaluated
  if (tmpl.hasExpr(key))
    // wait the first updated event only once
    parent.one('mount', function() {
      key = getNamedKey(dom)
      add(parent[key])
    })
  else
    add(parent[key])

}
function setNamed(dom, parent, keys) {
  // get the key value we want to add to the tag instance
  var key = getNamedKey(dom),
    isArr,
    // add the node detected to a tag instance using the named property
    add = function(value) {
      // avoid to override the tag properties already set
      if (contains(keys, key)) return
      // check whether this value is an array
      isArr = isArray(value)
      // if the key was never set
      if (!value)
        // set it once on the tag instance
        parent[key] = dom
      // if it was an array and not yet set
      else if (!isArr || isArr && !contains(value, dom)) {
        // add the dom node into the array
        if (isArr)
          value.push(dom)
        else
          parent[key] = [value, dom]
      }
    }

  // skip the elements with no named properties
  if (!key) return

  // check whether this key has been already evaluated
  if (tmpl.hasExpr(key))
    // wait the first updated event only once
    parent.one('mount', function() {
      key = getNamedKey(dom)
      add(parent[key])
    })
  else
    add(parent[key])

}
function setNamed ( dom , parent , keys ) { // get the key value we want to add to the tag instance var key = getNamedKey ( dom ) , isArr , // add the node detected to a tag instance using the named property add = function ( value ) { // avoid to override the tag properties already set if ( contains ( keys , key ) ) return // check whether this value is an array isArr = isArray ( value ) // if the key was never set if ( ! value ) // set it once on the tag instance parent [ key ] = dom // if it was an array and not yet set else if ( ! isArr || isArr && ! contains ( value , dom ) ) { // add the dom node into the array if ( isArr ) value . push ( dom ) else parent [ key ] = [ value , dom ] } } // skip the elements with no named properties if ( ! key ) return // check whether this key has been already evaluated if ( tmpl . hasExpr ( key ) ) // wait the first updated event only once parent . one ( 'mount' , function ( ) { key = getNamedKey ( dom ) add ( parent [ key ] ) } ) else add ( parent [ key ] ) }
Set the named properties of a tag element
@param { Object } dom - DOM node we need to parse
@param { Object } parent - tag instance where the named dom element will be eventually added
@param { Array } keys - list of all the tag instance properties
Set the named properties of a tag element