Skip to content

Commit

Permalink
refactor(aria.js): improve createDescendantRoles()
Browse files Browse the repository at this point in the history
Remove some unnecessary spread operations.

test.sh run is clean.
  • Loading branch information
pkra committed Dec 15, 2023
1 parent bb33ac0 commit 51e0fde
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions script/aria.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,10 @@ const createDescendantRoles = (subRoles) => {
const getAllSubRoles = function (key) {
const subroleSet = new Set();
if (!subRoles[key]) return subroleSet; // NOTE: recursion end
const childRoles = [...subRoles[key]];
childRoles.forEach(function (childRole) {
subRoles[key].forEach(function (childRole) {
subroleSet.add(childRole);
const descendantRolesSet = getAllSubRoles(childRole);
[...descendantRolesSet].forEach((role) => subroleSet.add(role));
descendantRolesSet.forEach((role) => subroleSet.add(role));
});
return subroleSet;
};
Expand Down

0 comments on commit 51e0fde

Please sign in to comment.