Separate Document#normalize method

It translates different arguments to DOM nodes, this logic is used and
was taken out from extend method
Normalize arguments in Node#replaceContent
Trim null values