-
Notifications
You must be signed in to change notification settings - Fork 799
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
chore(has-alt): use virtualNode instead of node #1923
Conversation
lib/checks/shared/has-alt.js
Outdated
return false; | ||
} | ||
|
||
return typeof virtualNode.attr('alt') === 'string'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VirtualNode has a hasAttr
function, any reason why you're not using it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right you are!
lib/checks/shared/has-alt.js
Outdated
node.hasAttribute('alt') && (nn === 'img' || nn === 'input' || nn === 'area') | ||
); | ||
const { nodeName } = virtualNode.props; | ||
if (['img', 'input', 'area'].includes(nodeName) === false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not !['img', 'input', 'area'].includes(nodeName)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Easier to spot the negation this way. Doesn't really matter I guess.
* chore(has-alt): use virtualNode instead of node * chore(has-alt): ignore null alt
Stop using DOM node in has-alt check.
Reviewer checks
Required fields, to be filled out by PR reviewer(s)