Socket
Socket
Sign inDemoInstall

axe-core

Package Overview
Dependencies
Maintainers
4
Versions
1362
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axe-core - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

.github/ISSUE_TEMPLATE.md

4

.retireignore.json

@@ -15,2 +15,6 @@ [

{
"path": "node_modules/sshpk",
"justification" : "A dependency of retirejs/request"
},
{
"path": "node_modules/grunt-mocha",

@@ -17,0 +21,0 @@ "justification" : "Used only for testing"

16

axe.d.ts

@@ -1,2 +0,2 @@

// Type definitions for axe-core 3.0.1
// Type definitions for axe-core 3.0.2
// Project: https://github.com/dequelabs/axe-core

@@ -16,4 +16,4 @@ // Definitions by: Marcy Sutton <https://github.com/marcysutton>

type RunOnlyObject = {
include?: string[],
exclude?: string[]
include?: string[] | string[][],
exclude?: string[] | string[][]
}

@@ -23,8 +23,4 @@

interface ElementContext {
node?: Object,
selector?: string,
include?: any[],
exclude?: any[]
}
type ElementContext = Node | string | RunOnlyObject;
interface RunOnly {

@@ -137,3 +133,3 @@ type: RunOnlyType,

*/
function run(context: ElementContext): Promise<AxeResults>
function run(context?: ElementContext): Promise<AxeResults>
function run(options: RunOptions): Promise<AxeResults>

@@ -140,0 +136,0 @@ function run(callback: (error: Error, results:AxeResults) => void): void

{
"name": "axe-core",
"version": "3.0.1",
"version": "3.0.2",
"contributors": [

@@ -5,0 +5,0 @@ {

@@ -6,2 +6,17 @@ # Change Log

<a name="3.0.2"></a>
## [3.0.2](https://github.com/dequelabs/axe-core/compare/v3.0.0-beta.2...v3.0.2) (2018-04-24)
### Bug Fixes
* **rule:** Allow empty aria-labelledby values ([#829](https://github.com/dequelabs/axe-core/issues/829)) ([d280c5f](https://github.com/dequelabs/axe-core/commit/d280c5f))
* Prevent color rules from crashing Chrome 66+ [#856](https://github.com/dequelabs/axe-core/issues/856) ([#861](https://github.com/dequelabs/axe-core/issues/861)) ([147b665](https://github.com/dequelabs/axe-core/commit/147b665))
* **respondable:** Identify the current axe instance by its application name when it exists ([affd75c](https://github.com/dequelabs/axe-core/commit/affd75c))
* **respondable:** Use the hard-coded axe.application name as default ([ab4a49f](https://github.com/dequelabs/axe-core/commit/ab4a49f))
* **rule:** Ignore hashbang URLs for skiplinks ([#827](https://github.com/dequelabs/axe-core/issues/827)) ([e1f0c57](https://github.com/dequelabs/axe-core/commit/e1f0c57))
* **rule:** Tag video-caption only as SC 1.2.2 ([87818e7](https://github.com/dequelabs/axe-core/commit/87818e7))
<a name="3.0.1"></a>

@@ -8,0 +23,0 @@ ## [3.0.1](https://github.com/dequelabs/axe-core/compare/v3.0.0...v3.0.1) (2018-04-03)

@@ -18,3 +18,3 @@ | Rule ID | Description | Tags | Enabled by default |

| bypass | Ensures each page has at least one mechanism for a user to bypass navigation and jump straight to the content | cat.keyboard, wcag2a, wcag241, section508, section508.22.o | true |
| checkboxgroup | Ensures related &lt;input type=&quot;checkbox&quot;&gt; elements have a group and that that group designation is consistent | cat.forms, best-practice | true |
| checkboxgroup | Ensures related &lt;input type=&quot;checkbox&quot;&gt; elements have a group and that the group designation is consistent | cat.forms, best-practice | true |
| color-contrast | Ensures the contrast between foreground and background colors meets WCAG 2 AA contrast ratio thresholds | cat.color, wcag2aa, wcag143 | true |

@@ -69,3 +69,3 @@ | definition-list | Ensures &lt;dl&gt; elements are structured correctly | cat.structure, wcag2a, wcag131 | true |

| valid-lang | Ensures lang attributes have valid values | cat.language, wcag2aa, wcag312 | true |
| video-caption | Ensures &lt;video&gt; elements have captions | cat.text-alternatives, wcag2a, wcag122, wcag123, section508, section508.22.a | true |
| video-caption | Ensures &lt;video&gt; elements have captions | cat.text-alternatives, wcag2a, wcag122, section508, section508.22.a | true |
| video-description | Ensures &lt;video&gt; elements have audio descriptions | cat.text-alternatives, wcag2aa, wcag125, section508, section508.22.b | true |

@@ -20,2 +20,3 @@ /*eslint complexity: ["error",12], max-statements: ["error", 30],

grunt.loadNpmTasks('grunt-parallel');
grunt.loadNpmTasks('grunt-markdownlint');

@@ -338,2 +339,14 @@ var langs;

}
},
markdownlint: {
all: {
options: {
config: grunt.file.readJSON('.markdownlint.json')
},
src: [
'README.md',
'.github/*.md',
'doc/**/*.md'
]
}
}

@@ -348,3 +361,3 @@ });

grunt.registerTask('test', ['build', 'retire', 'testconfig', 'fixture', 'connect',
'mocha', 'parallel', 'eslint']);
'mocha', 'parallel', 'eslint', 'markdownlint']);

@@ -351,0 +364,0 @@ grunt.registerTask('ci-build', ['build', 'retire', 'testconfig', 'fixture', 'connect',

const links = axe.utils.querySelectorAll(virtualNode, 'a[href]');
return links.some(vLink => vLink.actualNode.getAttribute('href')[0] === '#');
return links.some(vLink => {
return /^#[^/!]/.test(vLink.actualNode.getAttribute('href'))
});

@@ -58,3 +58,3 @@ /* global aria, axe, dom */

aria.validateAttrValue = function (node, attr) {
/*eslint complexity: ["error",15]*/
/*eslint complexity: ["error",17]*/
'use strict';

@@ -88,2 +88,6 @@ var matches, list,

case 'idrefs':
// exempt attributes that allow empty strings
if ((attrInfo.values && attrInfo.values.indexOf('') !== -1) && value.trim().length === 0) {
return true;
}
list = axe.utils.tokenList(value);

@@ -90,0 +94,0 @@ // Check if any value isn't in the list of values

@@ -90,3 +90,4 @@ /**

'aria-labelledby': {
type: 'idrefs'
type: 'idrefs',
values: ['']
},

@@ -93,0 +94,0 @@ 'aria-level': {

@@ -12,7 +12,13 @@ /* global axe, dom */

*/
dom.shadowElementsFromPoint = function(nodeX, nodeY, root = document) {
return root.elementsFromPoint(nodeX, nodeY)
dom.shadowElementsFromPoint = function(nodeX, nodeY, root = document, i=0) {
if (i > 999) {
throw new Error('Infinite loop detected');
}
return Array.from(root.elementsFromPoint(nodeX, nodeY))
// As of Chrome 66, elementFromPoint will return elements from parent trees.
// We only want to touch each tree once, so we're filtering out nodes on other trees.
.filter(nodes => dom.getRootNode(nodes) === root)
.reduce((stack, elm) => {
if (axe.utils.isShadowRoot(elm)) {
const shadowStack = dom.shadowElementsFromPoint(nodeX, nodeY, elm.shadowRoot);
const shadowStack = dom.shadowElementsFromPoint(nodeX, nodeY, elm.shadowRoot, i+1);
stack = stack.concat(shadowStack);

@@ -19,0 +25,0 @@ // filter host nodes which get included regardless of overlap

@@ -14,4 +14,4 @@ /*global uuid, utils, axe */

function _getSource() {
var application = 'axe', version = '', src;
if (typeof axe !== 'undefined' && axe._audit && !axe._audit.application) {
var application = 'axeAPI', version = '', src;
if (typeof axe !== 'undefined' && axe._audit && axe._audit.application) {
application = axe._audit.application;

@@ -41,4 +41,4 @@ }

// Allow free communication with axe test
postedMessage._source === 'axe.x.y.z' ||
messageSource === 'axe.x.y.z'
postedMessage._source === 'axeAPI.x.y.z' ||
messageSource === 'axeAPI.x.y.z'
);

@@ -140,7 +140,7 @@ }

* @private
* @param {Event} event The event object of the postMessage
* @param {Object} data The data sent with the message
* @param {Boolean} keepalive Whether to allow multiple responses - default is false
* @param {Window} source The window from which the message originated
* @param {Object} data The data sent with the message
* @param {Boolean} keepalive Whether to allow multiple responses - default is false
*/
function publish(target, data, keepalive) {
function publish(source, data, keepalive) {
var topic = data.topic;

@@ -150,3 +150,3 @@ var subscriber = subscribers[topic];

if (subscriber) {
var responder = createResponder(target, null, data.uuid);
var responder = createResponder(source, null, data.uuid);
subscriber(data.message, keepalive, responder);

@@ -153,0 +153,0 @@ }

@@ -9,3 +9,3 @@ {

"metadata": {
"description": "Ensures related <input type=\"checkbox\"> elements have a group and that that group designation is consistent",
"description": "Ensures related <input type=\"checkbox\"> elements have a group and that the group designation is consistent",
"help": "Checkbox inputs with the same name attribute value must be part of a group"

@@ -12,0 +12,0 @@ },

@@ -1,1 +0,5 @@

return !axe.commons.table.isDataTable(node);
var role = (node.getAttribute('role') || '').toLowerCase();
return !((role === 'presentation' || role === 'none') &&
!axe.commons.dom.isFocusable(node)) &&
!axe.commons.table.isDataTable(node);

@@ -1,2 +0,1 @@

const href = node.getAttribute('href');
return (href[0] === '#' && href.length > 1);
return /^#[^/!]/.test(node.getAttribute('href'));

@@ -9,3 +9,2 @@ {

"wcag122",
"wcag123",
"section508",

@@ -12,0 +11,0 @@ "section508.22.a"

{
"name": "axe-core",
"description": "Accessibility engine for automated Web UI testing",
"version": "3.0.1",
"version": "3.0.2",
"license": "MPL-2.0",

@@ -81,2 +81,3 @@ "engines": {

"grunt-eslint": "^20.1.0",
"grunt-markdownlint": "^1.1.2",
"grunt-mocha": "^1.0.4",

@@ -83,0 +84,0 @@ "grunt-parallel": "^0.5.1",

@@ -66,9 +66,14 @@ # axe-core

The [aXe API](doc/API.md) supports the following browsers:
The [aXe API](doc/API.md) fully supports the following browsers:
* Internet Explorer v9, 10, 11
* Microsoft Edge v40 and above
* Google Chrome v42 and above
* Mozilla Firefox v38 and above
* Apple Safari v7 and above
* Internet Explorer v9, 10, 11
Support means that we will fix bugs and attempt to test each browser regularly. Only Firefox and Chrome are currently tested on every pull request.
There is limited support for JSDOM. We will attempt to make all rules compatible with JSDOM but where this is not possible, we recommend turning those rules off. Currently the `color-contrast` rule is known not to work with JSDOM.
## The Accessibility Rules

@@ -99,3 +104,3 @@

Read the [Proposing Axe-core Rules guide ](./doc/rule-proposal.md)
Read the [Proposing Axe-core Rules guide](./doc/rule-proposal.md)

@@ -102,0 +107,0 @@ Read the [documentation on the architecture](./doc/developer-guide.md)

@@ -105,3 +105,7 @@ {

"axe.min.js": "sha256-vMPyo7vifw5RTaVEAlnfwGFa9VyHymsNqanCsHh3Q8c="
},
"3.0.2": {
"axe.js": "sha256-D24i3Yy35gMxOZNTNZyQLAyL3W3wVvW1wUYakK5v1VI=",
"axe.min.js": "sha256-Hsc1oDUNhkVBP4gVUaC9jNm9t0qmLpTJzXW4uzx10bo="
}
}

@@ -6,2 +6,3 @@ describe('aria-valid-attr-value', function () {

var checkContext = axe.testUtils.MockCheckContext();
var fixtureSetup = axe.testUtils.fixtureSetup;

@@ -93,2 +94,13 @@ afterEach(function () {

it('should allow empty strings rather than idrefs for specific attributes', function () {
fixtureSetup(
'<button aria-labelledby="">Button</button>' +
'<div aria-owns=""></div>'
);
var passing = fixture.querySelector('button');
var failing = fixture.querySelector('div');
assert.isTrue(checks['aria-valid-attr-value'].evaluate.call(checkContext, passing));
assert.isFalse(checks['aria-valid-attr-value'].evaluate.call(checkContext, failing));
});
describe('options', function () {

@@ -95,0 +107,0 @@ it('should exclude supplied attributes', function () {

describe('frame-tested', function () {
'use strict';
var checkContext = axe.testUtils.MockCheckContext();
var __respondable;
var respondableCalls = [];
var checkEvaluate = checks['frame-tested'].evaluate.bind(checkContext);
var iframe;
var checkContext, __respondable, respondableCalls, iframe;
var checkEvaluate = checks['frame-tested'].evaluate

@@ -19,5 +16,7 @@ before(function () {

afterEach(function () {
beforeEach(function () {
respondableCalls = [];
checkContext.reset();
checkContext = axe.testUtils.MockCheckContext();
// Don't throw on async
checkContext._onAsync = function () {};
})

@@ -30,3 +29,3 @@

it('correctly calls axe.utils.respondable', function () {
checkEvaluate(iframe);
checkEvaluate.call(checkContext, iframe);

@@ -40,3 +39,2 @@ assert.lengthOf(respondableCalls, 1);

it('passes if the iframe contains axe-core', function (done) {
checkEvaluate(iframe, { timeout: 20 });
checkContext._onAsync = function (result) {

@@ -46,2 +44,3 @@ assert.isTrue(result);

}
checkEvaluate.call(checkContext, iframe, { timeout: 20 });
// Respond to the ping

@@ -52,4 +51,2 @@ respondableCalls[0][4]();

it('fails if the iframe does not contain axe-core, and isViolation is true', function (done) {
checkEvaluate(iframe, { timeout: 10, isViolation: true });
// Timeout after 10ms
checkContext._onAsync = function (result) {

@@ -59,7 +56,7 @@ assert.isFalse(result);

}
// Timeout after 10ms
checkEvaluate.call(checkContext, iframe, { timeout: 10, isViolation: true });
});
it('is incomplete if the iframe does not contain axe-core', function (done) {
checkEvaluate(iframe, { timeout: 10 });
// Timeout after 10ms
checkContext._onAsync = function (result) {

@@ -69,3 +66,5 @@ assert.isUndefined(result);

}
// Timeout after 10ms
checkEvaluate.call(checkContext, iframe, { timeout: 10 });
});
});

@@ -12,3 +12,3 @@ describe('internal-link-present', function () {

fixture.innerHTML = '';
axe._tree = undefined;
axe._tree = undefined;
checkContext.reset();

@@ -22,2 +22,17 @@ });

it('should return false when a hashbang URL was used', function () {
var params = checkSetup('<div id="target"><a href="#!foo">hi</a></div>');
assert.isFalse(checks['internal-link-present'].evaluate.apply(checkContext, params));
});
it('should return false when a hash route URL was used', function () {
var params = checkSetup('<div id="target"><a href="#/home">hi</a></div>');
assert.isFalse(checks['internal-link-present'].evaluate.apply(checkContext, params));
});
it('should return false when a hashbang + slash route URL was used', function () {
var params = checkSetup('<div id="target"><a href="#!/home">hi</a></div>');
assert.isFalse(checks['internal-link-present'].evaluate.apply(checkContext, params));
});
it('should otherwise return false', function () {

@@ -24,0 +39,0 @@ var params = checkSetup('<div id="target"><a href="http://www.deque.com/#haha">hi</a></div>');

@@ -121,3 +121,3 @@ describe('axe.utils.respondable', function () {

_respondable: true,
_source: 'axe.2.0.0',
_source: 'axeAPI.2.0.0',
topic: 'Death star',

@@ -137,3 +137,3 @@ message: 'Help us Obi-Wan',

it('should allow messages with _source axe.x.y.z', function () {
it('should allow messages with _source axeAPI.x.y.z', function () {
var success = false;

@@ -145,3 +145,3 @@ var event = document.createEvent('Event');

_respondable: true,
_source: 'axe.x.y.z',
_source: 'axeAPI.x.y.z',
topic: 'Death star',

@@ -170,3 +170,3 @@ message: 'Help us Obi-Wan',

_respondable: true,
_source: 'axe.2.0.0',
_source: 'axeAPI.2.0.0',
topic: 'Death star',

@@ -196,3 +196,3 @@ message: 'Help us Obi-Wan',

_respondable: true,
_source: 'axe.2.0.0',
_source: 'axeAPI.2.0.0',
topic: 'Death star',

@@ -319,3 +319,3 @@ message: 'Help us Obi-Wan',

_respondable: true,
_source: 'axe.2.0.0',
_source: 'axeAPI.2.0.0',
topic: 'Death star',

@@ -349,3 +349,3 @@ error: {

_respondable: true,
_source: 'axe.2.0.0',
_source: 'axeAPI.2.0.0',
topic: 'Death star',

@@ -352,0 +352,0 @@ error: {

@@ -32,3 +32,3 @@ import * as axe from '../../axe'

// additional configuration options
axe.run(context, {iframes: false, selectors: false, elementRef: false},
axe.run(context, {iframes: false, selectors: false, elementRef: false},
(error: Error, results: axe.AxeResults) => {

@@ -49,3 +49,3 @@ console.log(error || results.passes.length);

type: 'tags',
value: {
values: {
include: ['wcag2a', 'wcag2aa'],

@@ -52,0 +52,0 @@ exclude: ['experimental']

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc