Added a quick fix to issue #1262

Better whitespace handling in toNodeList