var q = document.querySelector;
TypeError: Illegal Invocation exception. Why is that?
because the querySelector method requires an instance of document to work on. you can call
Which says run the method, with this = document
To elaborate, the reason you are getting the error is because if you don't use the above syntax 'this' inside that function will refer to 'window'. The function must have some form of checking to ensure that 'this' is of type document.