Improved collapseWhitespace
Improved parseP to follow the spec when dealing with br or hr elements