code: function splitCharRef (string, inAttribute, nextChar) {
  
  	// A semicolon terminated, known charref
  	if (PREFIXED.test (string))
  		return [[T.namedCharRef, string]]
  
  	// Test 'special' charrefs (terminated or nonterminated)
  	var r = SPECIALS.exec (string)
    var terminated = string[string.length-1] === ';'
  
  	// Not a special charref, nor one with trailing alphanums
  	if (!r) return (terminated // TODO check this
        ? [['unresolvedNamedCharRef', string]]
        : [[inAttribute ? T.attributeData : 'data', string]])
  
    // A semicolon terminated special charref
    if (r[2] === ';')
  		return [[T.namedCharRef, '&'+r[1]+';']]
  
  	// A nonterminated special charref (exact match)
  	if (r[2] === '')
      return (!inAttribute || nextChar !== '=')
  		  ? [[T.legacyCharRef, string]] // And also a parse error
  		  : [[T.attributeData, string]]
  
  	// A nonterminated special charref with trailing alphanums
    // NB Splitting should always produce a parse error
    else return (!inAttribute)
  		? [[T.legacyCharRef, '&'+r[1]], ['data', r[2]]]
  		: [[T.attributeData, string]]
  
  }
docs: TODO clean this up a bit