axe-core
Advanced tools
Comparing version 3.2.2-canary.577a1f9 to 3.2.2-canary.98646e5
{ | ||
"name": "axe-core", | ||
"version": "3.2.2-canary.577a1f9", | ||
"version": "3.2.2-canary.98646e5", | ||
"contributors": [ | ||
@@ -5,0 +5,0 @@ { |
@@ -5,3 +5,3 @@ # Change Log | ||
## [3.2.2-canary.577a1f9](https://github.com/dequelabs/axe-core/compare/v3.2.2...v3.2.2-canary.577a1f9) (2019-04-10) | ||
## [3.2.2-canary.98646e5](https://github.com/dequelabs/axe-core/compare/v3.2.2...v3.2.2-canary.98646e5) (2019-04-11) | ||
@@ -21,3 +21,8 @@ | ||
### Features | ||
* **rule:** add more perf timing metrics to rules ([#1472](https://github.com/dequelabs/axe-core/issues/1472)) ([98646e5](https://github.com/dequelabs/axe-core/commit/98646e5)) | ||
## [3.2.2](https://github.com/dequelabs/axe-core/compare/v3.2.0...v3.2.2) (2019-03-07) | ||
@@ -24,0 +29,0 @@ |
@@ -341,15 +341,16 @@ # aXe Javascript Accessibility API | ||
| Property | Default | Description | | ||
| --------------- | :------ | :-------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `runOnly` | n/a | Limit which rules are executed, based on names or tags | | ||
| `rules` | n/a | Allow customizing a rule's properties (including { enable: false }) | | ||
| `reporter` | `v1` | Which reporter to use (see [Configuration](#api-name-axeconfigure)) | | ||
| `resultTypes` | n/a | Limit which result types are processed and aggregated | | ||
| `xpath` | `false` | Return xpath selectors for elements | | ||
| `absolutePaths` | `false` | Use absolute paths when creating element selectors | | ||
| `iframes` | `true` | Tell axe to run inside iframes | | ||
| `elementRef` | `false` | Return element references in addition to the target | | ||
| `restoreScroll` | `false` | Scrolls elements back to before axe started | | ||
| `frameWaitTime` | `60000` | How long (in milliseconds) axe waits for a response from embedded frames before timing out | | ||
| `preload` | `false` | Any additional assets (eg: cssom) to preload before running rules. [See here for configuration details](#preload-configuration-details) | | ||
| Property | Default | Description | | ||
| ------------------ | :------ | :-------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `runOnly` | n/a | Limit which rules are executed, based on names or tags | | ||
| `rules` | n/a | Allow customizing a rule's properties (including { enable: false }) | | ||
| `reporter` | `v1` | Which reporter to use (see [Configuration](#api-name-axeconfigure)) | | ||
| `resultTypes` | n/a | Limit which result types are processed and aggregated | | ||
| `xpath` | `false` | Return xpath selectors for elements | | ||
| `absolutePaths` | `false` | Use absolute paths when creating element selectors | | ||
| `iframes` | `true` | Tell axe to run inside iframes | | ||
| `elementRef` | `false` | Return element references in addition to the target | | ||
| `restoreScroll` | `false` | Scrolls elements back to before axe started | | ||
| `frameWaitTime` | `60000` | How long (in milliseconds) axe waits for a response from embedded frames before timing out | | ||
| `preload` | `false` | Any additional assets (eg: cssom) to preload before running rules. [See here for configuration details](#preload-configuration-details) | | ||
| `performanceTimer` | `false` | Log rule performance metrics to the console | | ||
@@ -356,0 +357,0 @@ ###### Options Parameter Examples |
@@ -20,4 +20,4 @@ { | ||
"babel-preset-react": "^6.24.1", | ||
"enzyme": "^3.5.0", | ||
"enzyme-adapter-react-16": "^1.3.0", | ||
"enzyme": "^3.9.0", | ||
"enzyme-adapter-react-16": "^1.12.1", | ||
"jest": "^22.4.0", | ||
@@ -24,0 +24,0 @@ "jest-cli": "^23.0.1", |
@@ -92,12 +92,44 @@ /*global RuleResult, createExecutionContext, SupportError */ | ||
* @param {Context} context The resolved Context object | ||
* @param {Mixed} options Options specific to this rule | ||
* @return {Array} All matching `HTMLElement`s | ||
*/ | ||
Rule.prototype.gather = function(context) { | ||
'use strict'; | ||
Rule.prototype.gather = function(context, options = {}) { | ||
const markStart = 'mark_gather_start_' + this.id; | ||
const markEnd = 'mark_gather_end_' + this.id; | ||
const markHiddenStart = 'mark_isHidden_start_' + this.id; | ||
const markHiddenEnd = 'mark_isHidden_end_' + this.id; | ||
if (options.performanceTimer) { | ||
axe.utils.performanceTimer.mark(markStart); | ||
} | ||
var elements = axe.utils.select(this.selector, context); | ||
if (this.excludeHidden) { | ||
return elements.filter(function(element) { | ||
if (options.performanceTimer) { | ||
axe.utils.performanceTimer.mark(markHiddenStart); | ||
} | ||
elements = elements.filter(function(element) { | ||
return !axe.utils.isHidden(element.actualNode); | ||
}); | ||
if (options.performanceTimer) { | ||
axe.utils.performanceTimer.mark(markHiddenEnd); | ||
axe.utils.performanceTimer.measure( | ||
'rule_' + this.id + '#gather_axe.utils.isHidden', | ||
markHiddenStart, | ||
markHiddenEnd | ||
); | ||
} | ||
} | ||
if (options.performanceTimer) { | ||
axe.utils.performanceTimer.mark(markEnd); | ||
axe.utils.performanceTimer.measure( | ||
'rule_' + this.id + '#gather', | ||
markStart, | ||
markEnd | ||
); | ||
} | ||
return elements; | ||
@@ -156,5 +188,3 @@ }; | ||
// Matches throws an error when it lacks support for document methods | ||
nodes = this.gather(context).filter(node => | ||
this.matches(node.actualNode, node, context) | ||
); | ||
nodes = this.gatherAndMatchNodes(context, options); | ||
} catch (error) { | ||
@@ -168,2 +198,3 @@ // Exit the rule execution if matches fails | ||
axe.log( | ||
this.id, | ||
'gather (', | ||
@@ -220,3 +251,3 @@ nodes.length, | ||
axe.utils.performanceTimer.measure( | ||
'runchecks_' + this.id, | ||
'rule_' + this.id + '#runchecks', | ||
markChecksStart, | ||
@@ -233,2 +264,34 @@ markChecksEnd | ||
/** | ||
* Selects `HTMLElement`s based on configured selector and filters them based on | ||
* the rules matches function | ||
* @param {Rule} rule The rule to check for after checks | ||
* @param {Context} context The resolved Context object | ||
* @param {Mixed} options Options specific to this rule | ||
* @return {Array} All matching `HTMLElement`s | ||
*/ | ||
Rule.prototype.gatherAndMatchNodes = function(context, options) { | ||
const markMatchesStart = 'mark_matches_start_' + this.id; | ||
const markMatchesEnd = 'mark_matches_end_' + this.id; | ||
let nodes = this.gather(context, options); | ||
if (options.performanceTimer) { | ||
axe.utils.performanceTimer.mark(markMatchesStart); | ||
} | ||
nodes = nodes.filter(node => this.matches(node.actualNode, node, context)); | ||
if (options.performanceTimer) { | ||
axe.utils.performanceTimer.mark(markMatchesEnd); | ||
axe.utils.performanceTimer.measure( | ||
'rule_' + this.id + '#matches', | ||
markMatchesStart, | ||
markMatchesEnd | ||
); | ||
} | ||
return nodes; | ||
}; | ||
/** | ||
* Iterates the rule's Checks looking for ones that have an after function | ||
@@ -235,0 +298,0 @@ * @private |
@@ -93,3 +93,8 @@ /*global utils, axe */ | ||
) { | ||
var measures = window.performance.getEntriesByType('measure'); | ||
// only output measures that were started after axe started, otherwise | ||
// we get measures made by the page before axe ran (which is confusing) | ||
var axeStart = window.performance.getEntriesByName('mark_axe_start')[0]; | ||
var measures = window.performance | ||
.getEntriesByType('measure') | ||
.filter(measure => measure.startTime >= axeStart.startTime); | ||
for (var i = 0; i < measures.length; ++i) { | ||
@@ -96,0 +101,0 @@ var req = measures[i]; |
{ | ||
"name": "axe-core", | ||
"description": "Accessibility engine for automated Web UI testing", | ||
"version": "3.2.2-canary.577a1f9", | ||
"version": "3.2.2-canary.98646e5", | ||
"license": "MPL-2.0", | ||
@@ -6,0 +6,0 @@ "engines": { |
@@ -77,2 +77,4 @@ # axe-core | ||
We can only support environments where features are either natively supported or polyfilled correctly. | ||
## The Accessibility Rules | ||
@@ -79,0 +81,0 @@ |
@@ -138,6 +138,6 @@ { | ||
}, | ||
"3.2.2-canary.577a1f9": { | ||
"axe.js": "sha256-DIuipJMGeH59/oQisM6/5PWYZXBiTuPxZjcHMYGV6D0=", | ||
"axe.min.js": "sha256-PonWx/UofjRtlueaE52FWC12V17ADRS3qL9Pv8sWgoo=" | ||
"3.2.2-canary.98646e5": { | ||
"axe.js": "sha256-IPCzmXiE+YS1oc8JPu9sRoe/wvX3rJq9gwNURjuoNK4=", | ||
"axe.min.js": "sha256-pskwPNMmlpQe98b2A7DBGMZylrAjXkSbA+Fls947SJk=" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1830611
44198
150