Skip to content

Commit 95e546e

Browse files
committed
Remove short circuits
More minimal change to control flow
1 parent 1eb9627 commit 95e546e

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

src/role-helpers.js

-8
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ function buildElementRoleList(elementRolesMap) {
106106

107107
function match(element) {
108108
let {attributes = []} = element
109-
const {name} = element
110-
const upperCasedTagName = name && name.toUpperCase()
111109

112110
// https://github.com/testing-library/dom-testing-library/issues/814
113111
const typeTextIndex = attributes.findIndex(
@@ -128,12 +126,6 @@ function buildElementRoleList(elementRolesMap) {
128126
const selector = makeElementSelector({...element, attributes})
129127

130128
return node => {
131-
if (upperCasedTagName && node.tagName !== upperCasedTagName) {
132-
// Short-circuit if tag name does not match,
133-
// because this code runs in a tight loop over many nodes and many roles.
134-
return false
135-
}
136-
137129
if (typeTextIndex >= 0 && node.type !== 'text') {
138130
return false
139131
}

0 commit comments

Comments
 (0)