lib/HTMLParser.js
function handleSimpleAttribute() {
    SIMPLEATTR.lastIndex = nextchar-1;
    var matched = SIMPLEATTR.exec(chars);
    if (!matched) throw new Error("should never happen");
    var name = matched[1];
    if (!name) return false;
    var value = matched[2];
    var len = value.length;
    switch(value[0]) {
    case '"':
    case "'":
      value = value.substring(1, len-1);
      nextchar += (matched[0].length-1);
      tokenizer = after_attribute_value_quoted_state;
      break;
    default:
      tokenizer = before_attribute_name_state;
      nextchar += (matched[0].length-1);
      value = value.substring(0, len-1);
      break;
    }

    // Make sure there isn't already an attribute with this name
    // If there is, ignore this one.
    for(var i = 0; i < attributes.length; i++) {
      if (attributes[i][0] === name) return true;
    }

    attributes.push([name, value]);
    return true;
  }
function handleSimpleAttribute() {
    SIMPLEATTR.lastIndex = nextchar-1;
    var matched = SIMPLEATTR.exec(chars);
    if (!matched) throw new Error("should never happen");
    var name = matched[1];
    if (!name) return false;
    var value = matched[2];
    var len = value.length;
    switch(value[0]) {
    case '"':
    case "'":
      value = value.substring(1, len-1);
      nextchar += (matched[0].length-1);
      tokenizer = after_attribute_value_quoted_state;
      break;
    default:
      tokenizer = before_attribute_name_state;
      nextchar += (matched[0].length-1);
      value = value.substring(0, len-1);
      break;
    }

    // Make sure there isn't already an attribute with this name
    // If there is, ignore this one.
    for(var i = 0; i < attributes.length; i++) {
      if (attributes[i][0] === name) return true;
    }

    attributes.push([name, value]);
    return true;
  }
function handleSimpleAttribute ( ) { SIMPLEATTR . lastIndex = nextchar - 1 ; var matched = SIMPLEATTR . exec ( chars ) ; if ( ! matched ) throw new Error ( "should never happen" ) ; var name = matched [ 1 ] ; if ( ! name ) return false ; var value = matched [ 2 ] ; var len = value . length ; switch ( value [ 0 ] ) { case '"' : case "'" : value = value . substring ( 1 , len - 1 ) ; nextchar += ( matched [ 0 ] . length - 1 ) ; tokenizer = after_attribute_value_quoted_state ; break ; default : tokenizer = before_attribute_name_state ; nextchar += ( matched [ 0 ] . length - 1 ) ; value = value . substring ( 0 , len - 1 ) ; break ; } // Make sure there isn't already an attribute with this name // If there is, ignore this one. for ( var i = 0 ; i < attributes . length ; i ++ ) { if ( attributes [ i ] [ 0 ] === name ) return true ; } attributes . push ( [ name , value ] ) ; return true ; }
Shortcut for simple attributes
Shortcut for simple attributes