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

label-matches.js should return gracefully if no type is present #678

Closed
downzer0 opened this issue Jan 12, 2018 · 1 comment
Closed

label-matches.js should return gracefully if no type is present #678

downzer0 opened this issue Jan 12, 2018 · 1 comment

Comments

@downzer0
Copy link
Contributor

In the label-matches.js file, if no type attribute is present on the element, the results crash. While not common, an <input /> is possible so this should return gracefully in that event.

Suggestion:

if (node.nodeName.toLowerCase() !== 'input') {
  return true;
}
if (!node.getAttribute('type')) {
  return true;
}
var t = node.getAttribute('type').toLowerCase();
var types = [
  'hidden',
  'image',
  'button',
  'submit',
  'reset'
];
if (types.indexOf(t) !== -1) {
  return false;
}
return true;
@marcysutton
Copy link
Contributor

That seems easy enough. Would you be interested in submitting a PR?

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