JSLint: “‘HTMLElement’ was used before it was defined.”
if (element instanceof HTMLElement)
How do I fix this?
Do I have to add an exception or ignore it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Check “Tolerate misordered definitions”.
This works for me if my entire script is:
and the only checked box is “Tolerate misordered definitions”.
The response I get is:
This checkbox only seems to apply to identifiers used in the global scope. If this is tried within a function body, JSLint will complain about
alertunless you check the box to “Assume console, alert”. However the following trick does satisfy JSLint:This passes with checkboxes “Assume console, alert”, “Tolerate misordered definitions”, and “Tolerate missing use strict.” I get the response:
Definitely a hack;
/*global HTMLElement */is best. Makes sense, though, after reading the JSLint instructions.