Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

if (document.querySelector('h1').innerHTML.match(/^Is .*\?$/)) { console.log('Probably not.') }


TypeError: Cannot read property 'innerHTML' of null

You should use UA sniffing to fix this bug.


Harr. :)


Fixed:

if (document.querySelector('.title a').innerHTML.match(/^Is .*\?$/)) { console.log('Probably not.') }

(HN's markup is terrible, it doesn't use headers)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: