Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Closes issue #141 - only audit IDs in IDREFs #221

Merged
merged 8 commits into from
Sep 24, 2015

Conversation

ricksbrown
Copy link
Collaborator

Implements the decision in #141
@alice PTAL

@@ -54,7 +54,7 @@ axs.AuditRules.addRule({
}
// If we made it this far then no DOM ancestor has a required scope role.
// Now we need to check if anything aria-owns this element.
var owners = axs.utils.getIdReferrers('aria-owns', element); // there can only be ONE explicit owner but that's a different test
var owners = axs.utils.getAriaIdReferrers(element, 'aria-owns'); // there can only be ONE explicit owner but that's a different test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the API:

  1. axs.utils.getIdReferrers now returns both HTML and ARIA IDREFs
  2. The old "just return ARIA IDREFs" function is renamed to getAriaIdReferrers
  3. I had to reverse the arguments because arg attributeName is now optional opt_attributeName - I'm operating on the practice of always putting optional arguments last. We could leave it the other way and pass it null if you prefer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, got it, thanks!

if (!id)
return null;
id = id.replace(/'/g, "\\'"); // make it safe to use in a selector
var selectorTemplates = ['[contextmenu=\'{id}\']', '[itemref~=\'{id}\']', 'button[form=\'{id}\']',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, got distracted halfway through reviewing this! Could you make these one per line? I realise it'll be a lot of lines (20 or so?), but it's pretty hard to read like this (plus it'll make it easier to add any new ones if we realise something's missing).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will do.

return null;
id = id.replace(/'/g, "\\'"); // make it safe to use in a selector
var selectorTemplates = [
'[contextmenu=\'{id}\']',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to comment the source of this list so we can periodically check that it's up to date.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alice sorry I got sidetracked on other work.
Sorry there is no definitive list I can find for this.

@ricksbrown
Copy link
Collaborator Author

@alice I've addressed your feedback and this should hopefully be good to go?

@alice
Copy link
Contributor

alice commented Sep 23, 2015

👍 Go ahead and merge 😄

ricksbrown added a commit that referenced this pull request Sep 24, 2015
Closes issue #141 - only audit IDs in IDREFs
@ricksbrown ricksbrown merged commit c492e0b into GoogleChrome:master Sep 24, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants