Updated check for extraneous textNodes (contains only with whitespaces).