function (el, att) {
  var result = false
  if (/^\.[\w]+/.test(att)) {
    var className = att.match(/^\.([\w]+)/)[1]
    var gClass = el.className.split(' ')
    if (gClass.indexOf(className)>-1) {
      result = true
    }
  }
  if (/^\#[\w]+/.test(att)) {
    var idName = att.match(/^\#([\w]+)/)[1]
    if (el.hasAttribute('id') && el.getAttribute('id')===idName) result = true
  }
  if (/^\[[\w]+=\"[\w]+\"\]$/.test(att)) {
    var attr = att.match(/^\[([\w]+)=\"([\w]+)\"\]$/)
    var attName = attr[1]
    var attval = attr[2]
    if (el.hasAttribute(attName) && el.getAttribute(attName)===attval) result = true
  }
  if (/^\[[\w]+=\'[\w]+\'\]$/.test(att)){
    var attr = att.match(/^\[([\w]+)=\'([\w]+)\'\]$/)
    var attName = attr[1]
    var attval = attr[2]
    if (el.hasAttribute(attName) && el.getAttribute(attName)===attval) result = true
  }
  return result
}
function (el, att) {
  var result = false
  if (/^\.[\w]+/.test(att)) {
    var className = att.match(/^\.([\w]+)/)[1]
    var gClass = el.className.split(' ')
    if (gClass.indexOf(className)>-1) {
      result = true
    }
  }
  if (/^\#[\w]+/.test(att)) {
    var idName = att.match(/^\#([\w]+)/)[1]
    if (el.hasAttribute('id') && el.getAttribute('id')===idName) result = true
  }
  if (/^\[[\w]+=\"[\w]+\"\]$/.test(att)) {
    var attr = att.match(/^\[([\w]+)=\"([\w]+)\"\]$/)
    var attName = attr[1]
    var attval = attr[2]
    if (el.hasAttribute(attName) && el.getAttribute(attName)===attval) result = true
  }
  if (/^\[[\w]+=\'[\w]+\'\]$/.test(att)){
    var attr = att.match(/^\[([\w]+)=\'([\w]+)\'\]$/)
    var attName = attr[1]
    var attval = attr[2]
    if (el.hasAttribute(attName) && el.getAttribute(attName)===attval) result = true
  }
  return result
}
function ( el , att ) { var result = false if ( / ^\.[\w]+ / . test ( att ) ) { var className = att . match ( / ^\.([\w]+) / ) [ 1 ] var gClass = el . className . split ( ' ' ) if ( gClass . indexOf ( className ) > - 1 ) { result = true } } if ( / ^\#[\w]+ / . test ( att ) ) { var idName = att . match ( / ^\#([\w]+) / ) [ 1 ] if ( el . hasAttribute ( 'id' ) && el . getAttribute ( 'id' ) === idName ) result = true } if ( / ^\[[\w]+=\"[\w]+\"\]$ / . test ( att ) ) { var attr = att . match ( / ^\[([\w]+)=\"([\w]+)\"\]$ / ) var attName = attr [ 1 ] var attval = attr [ 2 ] if ( el . hasAttribute ( attName ) && el . getAttribute ( attName ) === attval ) result = true } if ( / ^\[[\w]+=\'[\w]+\'\]$ / . test ( att ) ) { var attr = att . match ( / ^\[([\w]+)=\'([\w]+)\'\]$ / ) var attName = attr [ 1 ] var attval = attr [ 2 ] if ( el . hasAttribute ( attName ) && el . getAttribute ( attName ) === attval ) result = true } return result }
(el → dom, att → string)
return boolen
- check if has attribute
( el → dom att → string ) return boolen - check if has attribute