Prevented error in traversing.js

Fix it so we avoid document fragments in traversing() function