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

chore(has-alt): use virtualNode instead of node #1923

Merged
merged 2 commits into from
Dec 4, 2019
Merged

Conversation

WilcoFiers
Copy link
Contributor

@WilcoFiers WilcoFiers commented Nov 28, 2019

Stop using DOM node in has-alt check.

Reviewer checks

Required fields, to be filled out by PR reviewer(s)

  • Follows the commit message policy, appropriate for next version
  • Code is reviewed for security

@WilcoFiers WilcoFiers requested a review from a team as a code owner November 28, 2019 16:25
straker
straker previously requested changes Dec 3, 2019
return false;
}

return typeof virtualNode.attr('alt') === 'string';
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right you are!

node.hasAttribute('alt') && (nn === 'img' || nn === 'input' || nn === 'area')
);
const { nodeName } = virtualNode.props;
if (['img', 'input', 'area'].includes(nodeName) === false) {
Copy link
Contributor

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)?

Copy link
Contributor Author

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.

@WilcoFiers WilcoFiers merged commit a9506a0 into develop Dec 4, 2019
@WilcoFiers WilcoFiers deleted the has-alt-vnode branch December 4, 2019 16:04
straker pushed a commit that referenced this pull request Dec 11, 2019
* chore(has-alt): use virtualNode instead of node

* chore(has-alt): ignore null alt
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

Successfully merging this pull request may close these issues.

2 participants