Demo page cross-browser compatibility

The demo wasn't working in FF, so I added a check for `textContent`