Move Parser creation to its own function (issue #849).

This is the first step to implement innerHTML, as we need a way
create and initialize a parser object while setting the received
DOMString (which may be either text/html/whatever).
Merge pull request #2901 from Adenilson/innerHTML-step01b

Move Parser creation to its own function (issue #849).