Fixed issue with merge of sibling nodes in Formatter.js and added unit test for #6471