Clipper/joplin-webclipper/content_scripts/JSDOMParser.js
function (retPair) {
      var c = this.nextChar();

      // Read the Element tag name
      var strBuf = this.strBuf;
      strBuf.length = 0;
      while (whitespace.indexOf(c) == -1 && c !== ">" && c !== "/") {
        if (c === undefined)
          return false;
        strBuf.push(c);
        c = this.nextChar();
      }
      var tag = strBuf.join('');

      if (!tag)
        return false;

      var node = new Element(tag);

      // Read Element attributes
      while (c !== "/" && c !== ">") {
        if (c === undefined)
          return false;
        while (whitespace.indexOf(this.html[this.currentChar++]) != -1);
        this.currentChar--;
        c = this.nextChar();
        if (c !== "/" && c !== ">") {
          --this.currentChar;
          this.readAttribute(node);
        }
      }

      // If this is a self-closing tag, read '/>'
      var closed = false;
      if (c === "/") {
        closed = true;
        c = this.nextChar();
        if (c !== ">") {
          this.error("expected '>' to close " + tag);
          return false;
        }
      }

      retPair[0] = node;
      retPair[1] = closed;
      return true;
    }
function (retPair) {
      var c = this.nextChar();

      // Read the Element tag name
      var strBuf = this.strBuf;
      strBuf.length = 0;
      while (whitespace.indexOf(c) == -1 && c !== ">" && c !== "/") {
        if (c === undefined)
          return false;
        strBuf.push(c);
        c = this.nextChar();
      }
      var tag = strBuf.join('');

      if (!tag)
        return false;

      var node = new Element(tag);

      // Read Element attributes
      while (c !== "/" && c !== ">") {
        if (c === undefined)
          return false;
        while (whitespace.indexOf(this.html[this.currentChar++]) != -1);
        this.currentChar--;
        c = this.nextChar();
        if (c !== "/" && c !== ">") {
          --this.currentChar;
          this.readAttribute(node);
        }
      }

      // If this is a self-closing tag, read '/>'
      var closed = false;
      if (c === "/") {
        closed = true;
        c = this.nextChar();
        if (c !== ">") {
          this.error("expected '>' to close " + tag);
          return false;
        }
      }

      retPair[0] = node;
      retPair[1] = closed;
      return true;
    }
function ( retPair ) { var c = this . nextChar ( ) ; // Read the Element tag name var strBuf = this . strBuf ; strBuf . length = 0 ; while ( whitespace . indexOf ( c ) == - 1 && c !== ">" && c !== "/" ) { if ( c === undefined ) return false ; strBuf . push ( c ) ; c = this . nextChar ( ) ; } var tag = strBuf . join ( '' ) ; if ( ! tag ) return false ; var node = new Element ( tag ) ; // Read Element attributes while ( c !== "/" && c !== ">" ) { if ( c === undefined ) return false ; while ( whitespace . indexOf ( this . html [ this . currentChar ++ ] ) != - 1 ) ; this . currentChar -- ; c = this . nextChar ( ) ; if ( c !== "/" && c !== ">" ) { -- this . currentChar ; this . readAttribute ( node ) ; } } // If this is a self-closing tag, read '/>' var closed = false ; if ( c === "/" ) { closed = true ; c = this . nextChar ( ) ; if ( c !== ">" ) { this . error ( "expected '>' to close " + tag ) ; return false ; } } retPair [ 0 ] = node ; retPair [ 1 ] = closed ; return true ; }
Parses and returns an Element node. This is called after a '<' has been
read.

@returns an array; the first index of the array is the parsed node;
the second index is a boolean indicating whether this is a void
Element
Parses and returns an Element node . This is called after a < has been read .