Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid typeof comparison value in core/xml.js #3095

Open
alexcui03 opened this issue Aug 27, 2023 · 1 comment
Open

Invalid typeof comparison value in core/xml.js #3095

alexcui03 opened this issue Aug 27, 2023 · 1 comment

Comments

@alexcui03
Copy link

if (typeof(type) === undefined || type === null) {

The result of typeof should be a string, which means it won't equals to undefined. (Even typeof undefined is 'undefined')

ESLint will report

error  Invalid typeof comparison value                                            valid-typeof

MDN shows that if the attribute doesn't exist, getAttribute will return null.

Should it be modified to if (typeof type === 'undefined' || type === null) or just if (type === null)?

@eYuM-coder
Copy link

@alexcui03, this statement should be if (typeof type == 'undefined' || type == null) for clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants