Skip to content

Commit

Permalink
$.axs -> axs
Browse files Browse the repository at this point in the history
  • Loading branch information
jdan committed Oct 3, 2015
1 parent 048c873 commit 845fe51
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 16 deletions.
3 changes: 0 additions & 3 deletions index.js
Expand Up @@ -112,9 +112,6 @@ class Toolbar {
}

$(function() {
// Attach the global `axs` object from Accessibility Developer Tools to $
$.axs = axs;

var bar = new Toolbar();

// TODO: Make this customizable
Expand Down
2 changes: 1 addition & 1 deletion plugins/a11y-text-wand/index.js
Expand Up @@ -25,7 +25,7 @@ class A11yTextWand extends Plugin {
$(document).on("mousemove.wand", function(e) {
let element = document.elementFromPoint(e.clientX, e.clientY);

let textAlternative = $.axs.properties.findTextAlternatives(
let textAlternative = axs.properties.findTextAlternatives(
element, {});

$(".tota11y-outlined").removeClass("tota11y-outlined");
Expand Down
2 changes: 1 addition & 1 deletion plugins/link-text/index.js
Expand Up @@ -75,7 +75,7 @@ class LinkTextPlugin extends Plugin {
// TODO: Read from `alts` to determine where the text is coming
// from (for tailored error messages)
let alts = {};
let extractedText = $.axs.properties.findTextAlternatives(
let extractedText = axs.properties.findTextAlternatives(
el, alts);

if (!this.isDescriptiveText(extractedText)) {
Expand Down
16 changes: 8 additions & 8 deletions plugins/shared/audit.js
Expand Up @@ -5,13 +5,13 @@
let $ = require("jquery");

function allRuleNames() {
return $.axs.AuditRules.getRules().map(rule => rule.name);
return axs.AuditRules.getRules().map(rule => rule.name);
}

// Creates an audit configuration that whitelists a single rule and limits the
// amount of tests to run
function createWhitelist(ruleName) {
var config = new $.axs.AuditConfiguration();
var config = new axs.AuditConfiguration();
config.showUnsupportedRulesWarning = false;

// Ignore elements that are part of the toolbar
Expand Down Expand Up @@ -41,7 +41,7 @@ function patchCollectMatchingElements() {
* @param {Array.<Element>} collection
* @param {ShadowRoot=} opt_shadowRoot The nearest ShadowRoot ancestor, if any.
*/
$.axs.AuditRule.collectMatchingElements = function(node, matcher, collection,
axs.AuditRule.collectMatchingElements = function(node, matcher, collection,
opt_shadowRoot) {
if (node.nodeType === Node.ELEMENT_NODE)
var element = /** @type {Element} */ (node);
Expand All @@ -58,7 +58,7 @@ function patchCollectMatchingElements() {
// code, be sure to run the tests in the browser before committing.
var shadowRoot = element.shadowRoot || element.webkitShadowRoot;
if (shadowRoot) {
$.axs.AuditRule.collectMatchingElements(shadowRoot,
axs.AuditRule.collectMatchingElements(shadowRoot,
matcher,
collection,
shadowRoot);
Expand All @@ -73,7 +73,7 @@ function patchCollectMatchingElements() {
var content = /** @type {HTMLContentElement} */ (element);
var distributedNodes = content.getDistributedNodes();
for (var i = 0; i < distributedNodes.length; i++) {
$.axs.AuditRule.collectMatchingElements(distributedNodes[i],
axs.AuditRule.collectMatchingElements(distributedNodes[i],
matcher,
collection,
opt_shadowRoot);
Expand All @@ -90,7 +90,7 @@ function patchCollectMatchingElements() {
} else {
var distributedNodes = shadow.getDistributedNodes();
for (var i = 0; i < distributedNodes.length; i++) {
$.axs.AuditRule.collectMatchingElements(distributedNodes[i],
axs.AuditRule.collectMatchingElements(distributedNodes[i],
matcher,
collection,
opt_shadowRoot);
Expand All @@ -102,7 +102,7 @@ function patchCollectMatchingElements() {
// a <shadow> element recurse normally.
var child = node.firstChild;
while (child != null) {
$.axs.AuditRule.collectMatchingElements(child,
axs.AuditRule.collectMatchingElements(child,
matcher,
collection,
opt_shadowRoot);
Expand All @@ -119,7 +119,7 @@ function audit(ruleName) {

patchCollectMatchingElements();

return $.axs.Audit.run(whitelist)
return axs.Audit.run(whitelist)
.filter(result => result.rule.name === ruleName)[0];
}

Expand Down
3 changes: 0 additions & 3 deletions test/mock-dom/jquery-extensions.js
Expand Up @@ -20,6 +20,3 @@ $.fn.labelText = function() {
$.fn.expandedText = function() {
return $(this).data("expanded-text");
};

// Bind the global `axs` object from Accessibility Developer Tools to jQuery
$.axs = window.axs;

1 comment on commit 845fe51

@rileyjshaw
Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect commit message 👍

Please sign in to comment.