Fix CR handling in optimized attribute handling.

The `scanChars` function preprocesses \r to \n.  When we use the optimized
attribute handling regexp we are bypassing this conversion, so be careful.
Our regexps can't include \r, and don't try to start matching when we're
pointing at a \n, since it could be a \r in disguise.
Performance: parse tag names in bulk.

Use the same technique as in 18128ee7779f4f13db61cf0171fe2404022aff08
to parse tag names.  The performance improvement is likely to due the
fact that we can reuse substrings of the original source string instead
of creating new strings for each tag name.