Letters are cheap

This commit is contained in:
Jordan Eldredge 2019-08-25 22:22:14 -07:00
parent ea3fce138b
commit 09f5415df4

View file

@ -158,13 +158,13 @@ export function findDescendantByTypeAndId(node, type, id) {
return null;
}
const idLC = id.toLowerCase();
const lowerCaseId = id.toLowerCase();
for (let i = 0; i < node.children.length; i++) {
const child = node.children[i];
if (
(!type || child.name === type) &&
(child.attributes.id !== undefined &&
child.attributes.id.toLowerCase() === idLC)
child.attributes.id.toLowerCase() === lowerCaseId)
) {
return child;
}