Using document.title instead of the DOM. Thanks @cheeaun