fix: avoid problems from element IDs that exist on object prototype#4060
Merged
WilcoFiers merged 3 commits intodevelopfrom Jun 22, 2023
Merged
fix: avoid problems from element IDs that exist on object prototype#4060WilcoFiers merged 3 commits intodevelopfrom
WilcoFiers merged 3 commits intodevelopfrom
Conversation
straker
previously requested changes
Jun 20, 2023
| setLookup({ 'aria-bar': { type: 'idrefs' } }); | ||
| fixture.innerHTML = `<div id="ref" aria-bar="${ids.join( | ||
| ' ' | ||
| )}"></div><i id="${id}"></i></b>`; |
Contributor
There was a problem hiding this comment.
Suggested change
| )}"></div><i id="${id}"></i></b>`; | |
| )}"></div><i id="${id}"></i>`; |
| assert.isUndefined(axe.utils.findBy(null, 'id', 'macaque')); | ||
| }); | ||
|
|
||
| it('ignores any non-object elements in the array', function () { |
Contributor
There was a problem hiding this comment.
This test passes even without your changes, might need a different test / setup.
| assert.equal(axe.utils.findBy(array, 'id', 'monkeys'), array[0]); | ||
| }); | ||
|
|
||
| it('only looks at owned properties', function () { |
Contributor
There was a problem hiding this comment.
This test also passes without your changes. For this test to work you'll need to create an object whos prototype parent defines the property in question. Object properties won't work since you can't find them by value.
Something like this:
const parent = {
value: 'bananas'
}
const child = Object.create(parent);
var array = [
child,
{
id: 'monkeys',
value: 'bananas'
}
];
assert.deepEqual(axe.utils.findBy(array, 'value', 'bananas'), {
id: 'monkeys',
value: 'bananas'
});
Contributor
Author
There was a problem hiding this comment.
Oh wow, yeah that sure wasn't my best work ever!
WilcoFiers
commented
Jun 21, 2023
| 'menuitemcheckbox', | ||
| 'menuitemradio', | ||
| 'meter', | ||
| 'meter', |
Contributor
Author
There was a problem hiding this comment.
??? How the heck did that happen
straker
approved these changes
Jun 21, 2023
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #4000