axe-core 4.3.5-canary.1fd4b00 → 4.3.5-canary.2ca9fef

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/axe.js CHANGED
@@ -1,5 +1,5 @@
1
- /*! axe v4.3.5-canary.1fd4b00
2
- * Copyright (c) 2021 Deque Systems, Inc.
1
+ /*! axe v4.3.5-canary.2ca9fef
2
+ * Copyright (c) 2022 Deque Systems, Inc.
3
3
  *
4
4
  * Your use of this Source Code Form is subject to the terms of the Mozilla Public
5
5
  * License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -15,19 +15,14 @@
15
15
  'use strict';
16
16
  function _typeof(obj) {
17
17
  '@babel/helpers - typeof';
18
- if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') {
19
- _typeof = function _typeof(obj) {
20
- return typeof obj;
21
- };
22
- } else {
23
- _typeof = function _typeof(obj) {
24
- return obj && typeof Symbol === 'function' && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj;
25
- };
26
- }
27
- return _typeof(obj);
18
+ return _typeof = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function(obj) {
19
+ return typeof obj;
20
+ } : function(obj) {
21
+ return obj && 'function' == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj;
22
+ }, _typeof(obj);
28
23
  }
29
24
  var axe = axe || {};
30
- axe.version = '4.3.5-canary.1fd4b00';
25
+ axe.version = '4.3.5-canary.2ca9fef';
31
26
  if (typeof define === 'function' && define.amd) {
32
27
  define('axe-core', [], function() {
33
28
  return axe;
@@ -79,6 +74,9 @@
79
74
  configurable: true
80
75
  }
81
76
  });
77
+ Object.defineProperty(subClass, 'prototype', {
78
+ writable: false
79
+ });
82
80
  if (superClass) {
83
81
  _setPrototypeOf(subClass, superClass);
84
82
  }
@@ -106,6 +104,8 @@
106
104
  function _possibleConstructorReturn(self, call) {
107
105
  if (call && (_typeof(call) === 'object' || typeof call === 'function')) {
108
106
  return call;
107
+ } else if (call !== void 0) {
108
+ throw new TypeError('Derived constructors may only return object or undefined');
109
109
  }
110
110
  return _assertThisInitialized(self);
111
111
  }
@@ -271,6 +271,9 @@
271
271
  if (staticProps) {
272
272
  _defineProperties(Constructor, staticProps);
273
273
  }
274
+ Object.defineProperty(Constructor, 'prototype', {
275
+ writable: false
276
+ });
274
277
  return Constructor;
275
278
  }
276
279
  function _createForOfIteratorHelper(o, allowArrayLike) {
@@ -359,16 +362,11 @@
359
362
  }
360
363
  function _typeof(obj) {
361
364
  '@babel/helpers - typeof';
362
- if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') {
363
- _typeof = function _typeof(obj) {
364
- return typeof obj;
365
- };
366
- } else {
367
- _typeof = function _typeof(obj) {
368
- return obj && typeof Symbol === 'function' && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj;
369
- };
370
- }
371
- return _typeof(obj);
365
+ return _typeof = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function(obj) {
366
+ return typeof obj;
367
+ } : function(obj) {
368
+ return obj && 'function' == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj;
369
+ }, _typeof(obj);
372
370
  }
373
371
  (function() {
374
372
  var __create = Object.create;
@@ -4640,7 +4638,7 @@
4640
4638
  }
4641
4639
  };
4642
4640
  _ctor.prototype.subarray = function(start, end) {
4643
- function clamp(v, min2, max) {
4641
+ function clamp2(v, min2, max) {
4644
4642
  return v < min2 ? min2 : v > max ? max : v;
4645
4643
  }
4646
4644
  start = ECMAScript.ToInt32(start);
@@ -4657,8 +4655,8 @@
4657
4655
  if (end < 0) {
4658
4656
  end = this.length + end;
4659
4657
  }
4660
- start = clamp(start, 0, this.length);
4661
- end = clamp(end, 0, this.length);
4658
+ start = clamp2(start, 0, this.length);
4659
+ end = clamp2(end, 0, this.length);
4662
4660
  var len = end - start;
4663
4661
  if (len < 0) {
4664
4662
  len = 0;
@@ -5002,7 +5000,7 @@
5002
5000
  return _collectResultsFromFrames;
5003
5001
  },
5004
5002
  contains: function contains() {
5005
- return contains_default;
5003
+ return _contains;
5006
5004
  },
5007
5005
  convertSelector: function convertSelector() {
5008
5006
  return _convertSelector;
@@ -5071,7 +5069,7 @@
5071
5069
  return get_rule_default;
5072
5070
  },
5073
5071
  getScroll: function getScroll() {
5074
- return get_scroll_default;
5072
+ return _getScroll;
5075
5073
  },
5076
5074
  getScrollState: function getScrollState() {
5077
5075
  return get_scroll_state_default;
@@ -6952,33 +6950,30 @@
6952
6950
  resolve(merge_results_default(data2, options));
6953
6951
  })['catch'](reject);
6954
6952
  }
6955
- function contains(vNode, otherVNode) {
6956
- function containsShadowChild(vNode2, otherVNode2) {
6957
- if (vNode2.shadowId === otherVNode2.shadowId) {
6958
- return true;
6959
- }
6960
- return !!vNode2.children.find(function(child) {
6961
- return containsShadowChild(child, otherVNode2);
6962
- });
6963
- }
6953
+ function _contains(vNode, otherVNode) {
6964
6954
  if (vNode.shadowId || otherVNode.shadowId) {
6965
- return containsShadowChild(vNode, otherVNode);
6955
+ do {
6956
+ if (vNode.shadowId === otherVNode.shadowId) {
6957
+ return true;
6958
+ }
6959
+ otherVNode = otherVNode.parent;
6960
+ } while (otherVNode);
6961
+ return false;
6966
6962
  }
6967
- if (vNode.actualNode) {
6968
- if (typeof vNode.actualNode.contains === 'function') {
6969
- return vNode.actualNode.contains(otherVNode.actualNode);
6970
- }
6971
- return !!(vNode.actualNode.compareDocumentPosition(otherVNode.actualNode) & 16);
6972
- } else {
6963
+ if (!vNode.actualNode) {
6973
6964
  do {
6974
6965
  if (otherVNode === vNode) {
6975
6966
  return true;
6976
6967
  }
6977
- } while (otherVNode = otherVNode && otherVNode.parent);
6968
+ otherVNode = otherVNode.parent;
6969
+ } while (otherVNode);
6978
6970
  }
6979
- return false;
6971
+ if (typeof vNode.actualNode.contains !== 'function') {
6972
+ var position = vNode.actualNode.compareDocumentPosition(otherVNode.actualNode);
6973
+ return !!(position & 16);
6974
+ }
6975
+ return vNode.actualNode.contains(otherVNode.actualNode);
6980
6976
  }
6981
- var contains_default = contains;
6982
6977
  function deepMerge() {
6983
6978
  var target = {};
6984
6979
  for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -7399,7 +7394,7 @@
7399
7394
  }
7400
7395
  var elHeight = parseInt(style.getPropertyValue('height'));
7401
7396
  var elWidth = parseInt(style.getPropertyValue('width'));
7402
- var scroll = get_scroll_default(el);
7397
+ var scroll = _getScroll(el);
7403
7398
  var scrollableWithZeroHeight = scroll && elHeight === 0;
7404
7399
  var scrollableWithZeroWidth = scroll && elWidth === 0;
7405
7400
  var posAbsoluteOverflowHiddenAndSmall = style.getPropertyValue('position') === 'absolute' && (elHeight < 2 || elWidth < 2) && style.getPropertyValue('overflow') === 'hidden';
@@ -7435,7 +7430,7 @@
7435
7430
  }
7436
7431
  vNode._stackingOrder = [ 0 ];
7437
7432
  addNodeToGrid(rootGrid, vNode);
7438
- if (get_scroll_default(vNode.actualNode)) {
7433
+ if (_getScroll(vNode.actualNode)) {
7439
7434
  var subGrid = {
7440
7435
  container: vNode,
7441
7436
  cells: []
@@ -7458,7 +7453,7 @@
7458
7453
  _vNode._stackingOrder = getStackingOrder(_vNode, parentVNode);
7459
7454
  var scrollRegionParent = findScrollRegionParent(_vNode, parentVNode);
7460
7455
  var grid = scrollRegionParent ? scrollRegionParent._subGrid : rootGrid;
7461
- if (get_scroll_default(_vNode.actualNode)) {
7456
+ if (_getScroll(_vNode.actualNode)) {
7462
7457
  var _subGrid = {
7463
7458
  container: _vNode,
7464
7459
  cells: []
@@ -7674,7 +7669,7 @@
7674
7669
  var scrollRegionParent = null;
7675
7670
  var checkedNodes = [ vNode ];
7676
7671
  while (parentVNode) {
7677
- if (get_scroll_default(parentVNode.actualNode)) {
7672
+ if (_getScroll(parentVNode.actualNode)) {
7678
7673
  scrollRegionParent = parentVNode;
7679
7674
  break;
7680
7675
  }
@@ -9482,7 +9477,7 @@
9482
9477
  }, {
9483
9478
  hasAccessibleName: true
9484
9479
  } ],
9485
- allowedRoles: [ 'button', 'checkbox', 'link', 'menuitem', 'menuitemcheckbox', 'menuitemradio', 'option', 'progressbar', 'scrollbar', 'separator', 'slider', 'switch', 'tab', 'treeitem', 'doc-cover' ]
9480
+ allowedRoles: [ 'button', 'checkbox', 'link', 'menuitem', 'menuitemcheckbox', 'menuitemradio', 'option', 'progressbar', 'radio', 'scrollbar', 'separator', 'slider', 'switch', 'tab', 'treeitem', 'doc-cover' ]
9486
9481
  },
9487
9482
  usemap: {
9488
9483
  matches: '[usemap]',
@@ -10286,7 +10281,7 @@
10286
10281
  var vNode = get_node_from_tree_default(node);
10287
10282
  var ancestor = vNode.parent;
10288
10283
  while (ancestor) {
10289
- if (get_scroll_default(ancestor.actualNode)) {
10284
+ if (_getScroll(ancestor.actualNode)) {
10290
10285
  return ancestor.actualNode;
10291
10286
  }
10292
10287
  ancestor = ancestor.parent;
@@ -10669,9 +10664,15 @@
10669
10664
  }
10670
10665
  var failure_summary_default = failureSummary;
10671
10666
  function incompleteFallbackMessage() {
10672
- return typeof axe._audit.data.incompleteFallbackMessage === 'function' ? axe._audit.data.incompleteFallbackMessage() : axe._audit.data.incompleteFallbackMessage;
10667
+ var incompleteFallbackMessage2 = axe._audit.data.incompleteFallbackMessage;
10668
+ if (typeof incompleteFallbackMessage2 === 'function') {
10669
+ incompleteFallbackMessage2 = incompleteFallbackMessage2();
10670
+ }
10671
+ if (typeof incompleteFallbackMessage2 !== 'string') {
10672
+ return '';
10673
+ }
10674
+ return incompleteFallbackMessage2;
10673
10675
  }
10674
- var incomplete_fallback_msg_default = incompleteFallbackMessage;
10675
10676
  function normalizeRelatedNodes(node, options) {
10676
10677
  [ 'any', 'all', 'none' ].forEach(function(type) {
10677
10678
  if (!Array.isArray(node[type])) {
@@ -10751,7 +10752,7 @@
10751
10752
  axe._thisWillBeDeletedDoNotUse = axe._thisWillBeDeletedDoNotUse || {};
10752
10753
  axe._thisWillBeDeletedDoNotUse.helpers = {
10753
10754
  failureSummary: failure_summary_default,
10754
- incompleteFallbackMessage: incomplete_fallback_msg_default,
10755
+ incompleteFallbackMessage: incompleteFallbackMessage,
10755
10756
  processAggregate: process_aggregate_default
10756
10757
  };
10757
10758
  var dataRegex = /\$\{\s?data\s?\}/g;
@@ -10787,7 +10788,7 @@
10787
10788
  var _str = message[data2];
10788
10789
  return substitute(_str, data2);
10789
10790
  }
10790
- var str = message['default'] || incomplete_fallback_msg_default();
10791
+ var str = message['default'] || incompleteFallbackMessage();
10791
10792
  if (data2 && data2.messageKey && message[data2.messageKey]) {
10792
10793
  str = message[data2.messageKey];
10793
10794
  }
@@ -11087,7 +11088,7 @@
11087
11088
  return rule3;
11088
11089
  }
11089
11090
  var get_rule_default = getRule;
11090
- function getScroll(elm) {
11091
+ function _getScroll(elm) {
11091
11092
  var buffer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
11092
11093
  var overflowX = elm.scrollWidth > elm.clientWidth + buffer;
11093
11094
  var overflowY = elm.scrollHeight > elm.clientHeight + buffer;
@@ -11095,10 +11096,8 @@
11095
11096
  return;
11096
11097
  }
11097
11098
  var style = window.getComputedStyle(elm);
11098
- var overflowXStyle = style.getPropertyValue('overflow-x');
11099
- var overflowYStyle = style.getPropertyValue('overflow-y');
11100
- var scrollableX = overflowXStyle !== 'visible' && overflowXStyle !== 'hidden';
11101
- var scrollableY = overflowYStyle !== 'visible' && overflowYStyle !== 'hidden';
11099
+ var scrollableX = isScrollable(style, 'overflow-x');
11100
+ var scrollableY = isScrollable(style, 'overflow-y');
11102
11101
  if (overflowX && scrollableX || overflowY && scrollableY) {
11103
11102
  return {
11104
11103
  elm: elm,
@@ -11107,10 +11106,13 @@
11107
11106
  };
11108
11107
  }
11109
11108
  }
11110
- var get_scroll_default = getScroll;
11109
+ function isScrollable(style, prop) {
11110
+ var overflowProp = style.getPropertyValue(prop);
11111
+ return [ 'scroll', 'auto' ].includes(overflowProp);
11112
+ }
11111
11113
  function getElmScrollRecursive(root) {
11112
11114
  return Array.from(root.children || root.childNodes || []).reduce(function(scrolls, elm) {
11113
- var scroll = get_scroll_default(elm);
11115
+ var scroll = _getScroll(elm);
11114
11116
  if (scroll) {
11115
11117
  scrolls.push(scroll);
11116
11118
  }
@@ -11218,7 +11220,7 @@
11218
11220
  var is_html_element_default = isHtmlElement;
11219
11221
  function getDeepest(collection) {
11220
11222
  return collection.sort(function(a, b) {
11221
- if (contains_default(a, b)) {
11223
+ if (_contains(a, b)) {
11222
11224
  return 1;
11223
11225
  }
11224
11226
  return -1;
@@ -11226,12 +11228,12 @@
11226
11228
  }
11227
11229
  function isNodeInContext(node, context5) {
11228
11230
  var include = context5.include && getDeepest(context5.include.filter(function(candidate) {
11229
- return contains_default(candidate, node);
11231
+ return _contains(candidate, node);
11230
11232
  }));
11231
11233
  var exclude = context5.exclude && getDeepest(context5.exclude.filter(function(candidate) {
11232
- return contains_default(candidate, node);
11234
+ return _contains(candidate, node);
11233
11235
  }));
11234
- if (!exclude && include || exclude && contains_default(exclude, include)) {
11236
+ if (!exclude && include || exclude && _contains(exclude, include)) {
11235
11237
  return true;
11236
11238
  }
11237
11239
  return false;
@@ -11972,7 +11974,7 @@
11972
11974
  if (messages2.incomplete && messages2.incomplete['default']) {
11973
11975
  return messages2.incomplete['default'];
11974
11976
  } else {
11975
- return incomplete_fallback_msg_default();
11977
+ return incompleteFallbackMessage();
11976
11978
  }
11977
11979
  }
11978
11980
  if (checkData && checkData.missingData) {
@@ -12130,9 +12132,9 @@
12130
12132
  }
12131
12133
  return result;
12132
12134
  }
12133
- function reduceIncludes(includes) {
12135
+ function getOuterIncludes(includes) {
12134
12136
  return includes.reduce(function(res, el) {
12135
- if (!res.length || !contains_default(res[res.length - 1], el)) {
12137
+ if (!res.length || !_contains(res[res.length - 1], el)) {
12136
12138
  res.push(el);
12137
12139
  }
12138
12140
  return res;
@@ -12149,15 +12151,12 @@
12149
12151
  }
12150
12152
  }
12151
12153
  }
12152
- var curried = function(context6) {
12153
- return function(node) {
12154
- return is_node_in_context_default(node, context6);
12155
- };
12156
- }(context5);
12157
- var reducedIncludes = reduceIncludes(context5.include);
12158
- for (var _i10 = 0; _i10 < reducedIncludes.length; _i10++) {
12159
- candidate = reducedIncludes[_i10];
12160
- result = pushNode(result, query_selector_all_filter_default(candidate, selector, curried));
12154
+ var outerIncludes = getOuterIncludes(context5.include);
12155
+ var isInContext = getContextFilter(context5);
12156
+ for (var _i10 = 0; _i10 < outerIncludes.length; _i10++) {
12157
+ candidate = outerIncludes[_i10];
12158
+ var nodes = query_selector_all_filter_default(candidate, selector, isInContext);
12159
+ result = pushNode(result, nodes);
12161
12160
  }
12162
12161
  if (axe._selectCache) {
12163
12162
  axe._selectCache.push({
@@ -12168,6 +12167,14 @@
12168
12167
  return result;
12169
12168
  }
12170
12169
  var select_default = select;
12170
+ function getContextFilter(context5) {
12171
+ if (!context5.exclude || context5.exclude.length === 0) {
12172
+ return null;
12173
+ }
12174
+ return function(node) {
12175
+ return is_node_in_context_default(node, context5);
12176
+ };
12177
+ }
12171
12178
  function setScroll(elm, top, left) {
12172
12179
  if (elm === window) {
12173
12180
  return elm.scroll(left, top);
@@ -13792,8 +13799,10 @@
13792
13799
  }
13793
13800
  }
13794
13801
  }
13795
- for (var _i14 = 0; _i14 < node.children.length; _i14++) {
13796
- cacheIdRefs(node.children[_i14], idRefs, refAttrs);
13802
+ for (var _i14 = 0; _i14 < node.childNodes.length; _i14++) {
13803
+ if (node.childNodes[_i14].nodeType === 1) {
13804
+ cacheIdRefs(node.childNodes[_i14], idRefs, refAttrs);
13805
+ }
13797
13806
  }
13798
13807
  }
13799
13808
  function getAccessibleRefs(node) {
@@ -16229,9 +16238,9 @@
16229
16238
  function ariaValidAttrEvaluate(node, options, virtualNode) {
16230
16239
  options = Array.isArray(options.value) ? options.value : [];
16231
16240
  var invalid = [];
16232
- var aria47 = /^aria-/;
16241
+ var aria48 = /^aria-/;
16233
16242
  virtualNode.attrNames.forEach(function(attr) {
16234
- if (options.indexOf(attr) === -1 && aria47.test(attr) && !validate_attr_default(attr)) {
16243
+ if (options.indexOf(attr) === -1 && aria48.test(attr) && !validate_attr_default(attr)) {
16235
16244
  invalid.push(attr);
16236
16245
  }
16237
16246
  });
@@ -16247,7 +16256,7 @@
16247
16256
  var needsReview = '';
16248
16257
  var messageKey = '';
16249
16258
  var invalid = [];
16250
- var aria47 = /^aria-/;
16259
+ var aria48 = /^aria-/;
16251
16260
  var skipAttrs = [ 'aria-errormessage' ];
16252
16261
  var preChecks = {
16253
16262
  'aria-controls': function ariaControls() {
@@ -16278,7 +16287,7 @@
16278
16287
  }
16279
16288
  };
16280
16289
  virtualNode.attrNames.forEach(function(attrName) {
16281
- if (skipAttrs.includes(attrName) || options.includes(attrName) || !aria47.test(attrName)) {
16290
+ if (skipAttrs.includes(attrName) || options.includes(attrName) || !aria48.test(attrName)) {
16282
16291
  return;
16283
16292
  }
16284
16293
  var validValue;
@@ -17024,21 +17033,65 @@
17024
17033
  return null;
17025
17034
  }
17026
17035
  var filtered_rect_stack_default = filteredRectStack;
17036
+ function clamp(value, min, max) {
17037
+ return Math.min(Math.max(min, value), max);
17038
+ }
17027
17039
  var blendFunctions = {
17028
17040
  normal: function normal(Cb, Cs) {
17029
17041
  return Cs;
17042
+ },
17043
+ multiply: function multiply(Cb, Cs) {
17044
+ return Cs * Cb;
17045
+ },
17046
+ screen: function screen(Cb, Cs) {
17047
+ return Cb + Cs - Cb * Cs;
17048
+ },
17049
+ overlay: function overlay(Cb, Cs) {
17050
+ return this['hard-light'](Cs, Cb);
17051
+ },
17052
+ darken: function darken(Cb, Cs) {
17053
+ return Math.min(Cb, Cs);
17054
+ },
17055
+ lighten: function lighten(Cb, Cs) {
17056
+ return Math.max(Cb, Cs);
17057
+ },
17058
+ 'color-dodge': function colorDodge(Cb, Cs) {
17059
+ return Cb === 0 ? 0 : Cs === 1 ? 1 : Math.min(1, Cb / (1 - Cs));
17060
+ },
17061
+ 'color-burn': function colorBurn(Cb, Cs) {
17062
+ return Cb === 1 ? 1 : Cs === 0 ? 0 : 1 - Math.min(1, (1 - Cb) / Cs);
17063
+ },
17064
+ 'hard-light': function hardLight(Cb, Cs) {
17065
+ return Cs <= .5 ? this.multiply(Cb, 2 * Cs) : this.screen(Cb, 2 * Cs - 1);
17066
+ },
17067
+ 'soft-light': function softLight(Cb, Cs) {
17068
+ if (Cs <= .5) {
17069
+ return Cb - (1 - 2 * Cs) * Cb * (1 - Cb);
17070
+ } else {
17071
+ var D = Cb <= .25 ? ((16 * Cb - 12) * Cb + 4) * Cb : Math.sqrt(Cb);
17072
+ return Cb + (2 * Cs - 1) * (D - Cb);
17073
+ }
17074
+ },
17075
+ difference: function difference(Cb, Cs) {
17076
+ return Math.abs(Cb - Cs);
17077
+ },
17078
+ exclusion: function exclusion(Cb, Cs) {
17079
+ return Cb + Cs - 2 * Cb * Cs;
17030
17080
  }
17031
17081
  };
17032
17082
  function simpleAlphaCompositing(Cs, \u03b1s, Cb, \u03b1b, blendMode) {
17033
- return Math.round(\u03b1s * (1 - \u03b1b) * Cs + \u03b1s * \u03b1b * blendFunctions[blendMode](Cb, Cs) + (1 - \u03b1s) * \u03b1b * Cb);
17083
+ return \u03b1s * (1 - \u03b1b) * Cs + \u03b1s * \u03b1b * blendFunctions[blendMode](Cb / 255, Cs / 255) * 255 + (1 - \u03b1s) * \u03b1b * Cb;
17034
17084
  }
17035
17085
  function flattenColors(fgColor, bgColor) {
17036
17086
  var blendMode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'normal';
17037
17087
  var r = simpleAlphaCompositing(fgColor.red, fgColor.alpha, bgColor.red, bgColor.alpha, blendMode);
17038
17088
  var g = simpleAlphaCompositing(fgColor.green, fgColor.alpha, bgColor.green, bgColor.alpha, blendMode);
17039
17089
  var b = simpleAlphaCompositing(fgColor.blue, fgColor.alpha, bgColor.blue, bgColor.alpha, blendMode);
17040
- var a = Math.max(0, Math.min(fgColor.alpha + bgColor.alpha * (1 - fgColor.alpha), 1));
17041
- return new color_default(r, g, b, a);
17090
+ var \u03b1o = clamp(fgColor.alpha + bgColor.alpha * (1 - fgColor.alpha), 0, 1);
17091
+ var Cr = Math.round(r / \u03b1o);
17092
+ var Cg = Math.round(g / \u03b1o);
17093
+ var Cb = Math.round(b / \u03b1o);
17094
+ return new color_default(Cr, Cg, Cb, \u03b1o);
17042
17095
  }
17043
17096
  var flatten_colors_default = flattenColors;
17044
17097
  function flattenColors2(fgColor, bgColor) {
@@ -17050,28 +17103,25 @@
17050
17103
  return new color_default(r, g, b, a);
17051
17104
  }
17052
17105
  var flatten_shadow_colors_default = flattenColors2;
17053
- function contentOverlapping(targetElement, bgNode) {
17054
- var targetRect = targetElement.getClientRects()[0];
17055
- var obscuringElements = shadow_elements_from_point_default(targetRect.left, targetRect.top);
17056
- if (obscuringElements) {
17057
- for (var i = 0; i < obscuringElements.length; i++) {
17058
- if (obscuringElements[i] !== targetElement && obscuringElements[i] === bgNode) {
17059
- return true;
17060
- }
17061
- }
17106
+ function isInlineDescendant(node, descendant) {
17107
+ var CONTAINED_BY = Node.DOCUMENT_POSITION_CONTAINED_BY;
17108
+ if (!(node.compareDocumentPosition(descendant) & CONTAINED_BY)) {
17109
+ return false;
17062
17110
  }
17063
- return false;
17111
+ var style = window.getComputedStyle(descendant);
17112
+ var display = style.getPropertyValue('display');
17113
+ if (!display.includes('inline')) {
17114
+ return false;
17115
+ }
17116
+ var position = style.getPropertyValue('position');
17117
+ return position === 'static';
17064
17118
  }
17065
17119
  function calculateObscuringElement(elmIndex, elmStack, originalElm) {
17066
- if (elmIndex > 0) {
17067
- for (var i = elmIndex - 1; i >= 0; i--) {
17068
- var bgElm = elmStack[i];
17069
- if (contentOverlapping(originalElm, bgElm)) {
17070
- return true;
17071
- } else {
17072
- elmStack.splice(i, 1);
17073
- }
17120
+ for (var _i20 = elmIndex - 1; _i20 >= 0; _i20--) {
17121
+ if (!isInlineDescendant(originalElm, elmStack[_i20])) {
17122
+ return true;
17074
17123
  }
17124
+ elmStack.splice(_i20, 1);
17075
17125
  }
17076
17126
  return false;
17077
17127
  }
@@ -17196,7 +17246,9 @@
17196
17246
  minRatio: shadowOutlineEmMax
17197
17247
  });
17198
17248
  if (bgColors.length) {
17199
- bgColors = [ bgColors.reduce(flatten_shadow_colors_default) ];
17249
+ bgColors = [ {
17250
+ color: bgColors.reduce(flatten_shadow_colors_default)
17251
+ } ];
17200
17252
  }
17201
17253
  var elmStack = get_background_stack_default(elm);
17202
17254
  (elmStack || []).some(function(bgElm) {
@@ -17209,7 +17261,11 @@
17209
17261
  }
17210
17262
  if (bgColor.alpha !== 0) {
17211
17263
  bgElms.push(bgElm);
17212
- bgColors.unshift(bgColor);
17264
+ var blendMode = bgElmStyle.getPropertyValue('mix-blend-mode');
17265
+ bgColors.unshift({
17266
+ color: bgColor,
17267
+ blendMode: normalizeBlendMode(blendMode)
17268
+ });
17213
17269
  return bgColor.alpha === 1;
17214
17270
  } else {
17215
17271
  return false;
@@ -17220,10 +17276,13 @@
17220
17276
  }
17221
17277
  var pageBgs = getPageBackgroundColors(elm, elmStack.includes(document.body));
17222
17278
  (_bgColors = bgColors).unshift.apply(_bgColors, _toConsumableArray(pageBgs));
17223
- var colors = bgColors.reduce(function(bgColor, fgColor) {
17224
- return flatten_colors_default(fgColor, bgColor);
17279
+ if (bgColors.length === 0) {
17280
+ return new color_default(255, 255, 255, 1);
17281
+ }
17282
+ var blendedColor = bgColors.reduce(function(bgColor, fgColor) {
17283
+ return flatten_colors_default(fgColor.color, bgColor.color instanceof color_default ? bgColor.color : bgColor, fgColor.blendMode);
17225
17284
  });
17226
- return colors;
17285
+ return flatten_colors_default(blendedColor.color instanceof color_default ? blendedColor.color : blendedColor, new color_default(255, 255, 255, 1));
17227
17286
  }
17228
17287
  function elmPartiallyObscured(elm, bgElm, bgColor) {
17229
17288
  var obscured = elm !== bgElm && !_visuallyContains(elm, bgElm) && bgColor.alpha !== 0;
@@ -17232,6 +17291,9 @@
17232
17291
  }
17233
17292
  return obscured;
17234
17293
  }
17294
+ function normalizeBlendMode(blendmode) {
17295
+ return !!blendmode ? blendmode : void 0;
17296
+ }
17235
17297
  function getPageBackgroundColors(elm, stackContainsBody) {
17236
17298
  var pageColors = [];
17237
17299
  if (!stackContainsBody) {
@@ -17243,13 +17305,18 @@
17243
17305
  var bodyBgColor = get_own_background_color_default(bodyStyle);
17244
17306
  var bodyBgColorApplies = bodyBgColor.alpha !== 0 && _visuallyContains(elm, body);
17245
17307
  if (bodyBgColor.alpha !== 0 && htmlBgColor.alpha === 0 || bodyBgColorApplies && bodyBgColor.alpha !== 1) {
17246
- pageColors.unshift(bodyBgColor);
17308
+ pageColors.unshift({
17309
+ color: bodyBgColor,
17310
+ blendMode: normalizeBlendMode(bodyStyle.getPropertyValue('mix-blend-mode'))
17311
+ });
17247
17312
  }
17248
17313
  if (htmlBgColor.alpha !== 0 && (!bodyBgColorApplies || bodyBgColorApplies && bodyBgColor.alpha !== 1)) {
17249
- pageColors.unshift(htmlBgColor);
17314
+ pageColors.unshift({
17315
+ color: htmlBgColor,
17316
+ blendMode: normalizeBlendMode(htmlStyle.getPropertyValue('mix-blend-mode'))
17317
+ });
17250
17318
  }
17251
17319
  }
17252
- pageColors.unshift(new color_default(255, 255, 255, 1));
17253
17320
  return pageColors;
17254
17321
  }
17255
17322
  function getContrast(bgColor, fgColor) {
@@ -17994,16 +18061,16 @@
17994
18061
  var outerText = elm.textContent.trim();
17995
18062
  var innerText = outerText;
17996
18063
  while (innerText === outerText && nextNode !== void 0) {
17997
- var _i20 = -1;
18064
+ var _i21 = -1;
17998
18065
  elm = nextNode;
17999
18066
  if (elm.children.length === 0) {
18000
18067
  return elm;
18001
18068
  }
18002
18069
  do {
18003
- _i20++;
18004
- innerText = elm.children[_i20].textContent.trim();
18005
- } while (innerText === '' && _i20 + 1 < elm.children.length);
18006
- nextNode = elm.children[_i20];
18070
+ _i21++;
18071
+ innerText = elm.children[_i21].textContent.trim();
18072
+ } while (innerText === '' && _i21 + 1 < elm.children.length);
18073
+ nextNode = elm.children[_i21];
18007
18074
  }
18008
18075
  return elm;
18009
18076
  }
@@ -18306,7 +18373,7 @@
18306
18373
  var relatedElements = [];
18307
18374
  var rulesGroupByDocumentFragment = groupCssomByDocument(cssom);
18308
18375
  var _loop6 = function _loop6() {
18309
- var key = _Object$keys2[_i21];
18376
+ var key = _Object$keys2[_i22];
18310
18377
  var _rulesGroupByDocument = rulesGroupByDocumentFragment[key], root = _rulesGroupByDocument.root, rules = _rulesGroupByDocument.rules;
18311
18378
  var orientationRules = rules.filter(isMediaRuleWithOrientation);
18312
18379
  if (!orientationRules.length) {
@@ -18324,7 +18391,7 @@
18324
18391
  });
18325
18392
  });
18326
18393
  };
18327
- for (var _i21 = 0, _Object$keys2 = Object.keys(rulesGroupByDocumentFragment); _i21 < _Object$keys2.length; _i21++) {
18394
+ for (var _i22 = 0, _Object$keys2 = Object.keys(rulesGroupByDocumentFragment); _i22 < _Object$keys2.length; _i22++) {
18328
18395
  var _ret3 = _loop6();
18329
18396
  if (_ret3 === 'continue') {
18330
18397
  continue;
@@ -18742,7 +18809,8 @@
18742
18809
  }
18743
18810
  var retVal = [];
18744
18811
  vNode.children.forEach(function(child) {
18745
- if (is_focusable_default(child)) {
18812
+ var role = get_role_default(child);
18813
+ if (get_role_type_default(role) === 'widget' && is_focusable_default(child)) {
18746
18814
  retVal.push(child);
18747
18815
  } else {
18748
18816
  retVal.push.apply(retVal, _toConsumableArray(getFocusableDescendants(child)));
@@ -19034,13 +19102,13 @@
19034
19102
  return false;
19035
19103
  }
19036
19104
  var dlitem_evaluate_default = dlitemEvaluate;
19037
- function listitemEvaluate(node) {
19038
- var parent = get_composed_parent_default(node);
19105
+ function listitemEvaluate(node, options, virtualNode) {
19106
+ var parent = virtualNode.parent;
19039
19107
  if (!parent) {
19040
19108
  return void 0;
19041
19109
  }
19042
- var parentTagName = parent.nodeName.toUpperCase();
19043
- var parentRole = (parent.getAttribute('role') || '').toLowerCase();
19110
+ var parentNodeName = parent.props.nodeName;
19111
+ var parentRole = get_explicit_role_default(parent);
19044
19112
  if ([ 'presentation', 'none', 'list' ].includes(parentRole)) {
19045
19113
  return true;
19046
19114
  }
@@ -19050,9 +19118,8 @@
19050
19118
  });
19051
19119
  return false;
19052
19120
  }
19053
- return [ 'UL', 'OL' ].includes(parentTagName);
19121
+ return [ 'ul', 'ol', 'menu' ].includes(parentNodeName);
19054
19122
  }
19055
- var listitem_evaluate_default = listitemEvaluate;
19056
19123
  function onlyDlitemsEvaluate(node, options, virtualNode) {
19057
19124
  var ALLOWED_ROLES = [ 'definition', 'term', 'list' ];
19058
19125
  var base = {
@@ -19240,11 +19307,11 @@
19240
19307
  }
19241
19308
  var no_autoplay_audio_evaluate_default = noAutoplayAudioEvaluate;
19242
19309
  function ariaAllowedAttrMatches(node, virtualNode) {
19243
- var aria47 = /^aria-/;
19310
+ var aria48 = /^aria-/;
19244
19311
  var attrs = virtualNode.attrNames;
19245
19312
  if (attrs.length) {
19246
- for (var _i22 = 0, l = attrs.length; _i22 < l; _i22++) {
19247
- if (aria47.test(attrs[_i22])) {
19313
+ for (var _i23 = 0, l = attrs.length; _i23 < l; _i23++) {
19314
+ if (aria48.test(attrs[_i23])) {
19248
19315
  return true;
19249
19316
  }
19250
19317
  }
@@ -19260,9 +19327,9 @@
19260
19327
  }
19261
19328
  var aria_allowed_role_matches_default = ariaAllowedRoleMatches;
19262
19329
  function ariaHasAttrMatches(node, virtualNode) {
19263
- var aria47 = /^aria-/;
19330
+ var aria48 = /^aria-/;
19264
19331
  return virtualNode.attrNames.some(function(attr) {
19265
- return aria47.test(attr);
19332
+ return aria48.test(attr);
19266
19333
  });
19267
19334
  }
19268
19335
  var aria_has_attr_matches_default = ariaHasAttrMatches;
@@ -19665,7 +19732,7 @@
19665
19732
  }
19666
19733
  var p_as_heading_matches_default = pAsHeadingMatches;
19667
19734
  function scrollableRegionFocusableMatches(node, virtualNode) {
19668
- if (!!get_scroll_default(node, 13) === false) {
19735
+ if (!!_getScroll(node, 13) === false) {
19669
19736
  return false;
19670
19737
  }
19671
19738
  var role = get_explicit_role_default(virtualNode);
@@ -19807,7 +19874,7 @@
19807
19874
  'valid-lang-evaluate': valid_lang_evaluate_default,
19808
19875
  'xml-lang-mismatch-evaluate': xml_lang_mismatch_evaluate_default,
19809
19876
  'dlitem-evaluate': dlitem_evaluate_default,
19810
- 'listitem-evaluate': listitem_evaluate_default,
19877
+ 'listitem-evaluate': listitemEvaluate,
19811
19878
  'only-dlitems-evaluate': only_dlitems_evaluate_default,
19812
19879
  'only-listitems-evaluate': only_listitems_evaluate_default,
19813
19880
  'structured-dlitems-evaluate': structured_dlitems_evaluate_default,
@@ -20442,8 +20509,8 @@
20442
20509
  lang: this.lang
20443
20510
  };
20444
20511
  var checkIDs = Object.keys(this.data.checks);
20445
- for (var _i23 = 0; _i23 < checkIDs.length; _i23++) {
20446
- var id = checkIDs[_i23];
20512
+ for (var _i24 = 0; _i24 < checkIDs.length; _i24++) {
20513
+ var id = checkIDs[_i24];
20447
20514
  var check4 = this.data.checks[id];
20448
20515
  var _check4$messages = check4.messages, pass = _check4$messages.pass, fail = _check4$messages.fail, incomplete = _check4$messages.incomplete;
20449
20516
  locale.checks[id] = {
@@ -20453,8 +20520,8 @@
20453
20520
  };
20454
20521
  }
20455
20522
  var ruleIDs = Object.keys(this.data.rules);
20456
- for (var _i24 = 0; _i24 < ruleIDs.length; _i24++) {
20457
- var _id = ruleIDs[_i24];
20523
+ for (var _i25 = 0; _i25 < ruleIDs.length; _i25++) {
20524
+ var _id = ruleIDs[_i25];
20458
20525
  var rule3 = this.data.rules[_id];
20459
20526
  var description = rule3.description, help = rule3.help;
20460
20527
  locale.rules[_id] = {
@@ -20463,8 +20530,8 @@
20463
20530
  };
20464
20531
  }
20465
20532
  var failureSummaries = Object.keys(this.data.failureSummaries);
20466
- for (var _i25 = 0; _i25 < failureSummaries.length; _i25++) {
20467
- var type = failureSummaries[_i25];
20533
+ for (var _i26 = 0; _i26 < failureSummaries.length; _i26++) {
20534
+ var type = failureSummaries[_i26];
20468
20535
  var failureSummary2 = this.data.failureSummaries[type];
20469
20536
  var failureMessage = failureSummary2.failureMessage;
20470
20537
  locale.failureSummaries[type] = {
@@ -20487,8 +20554,8 @@
20487
20554
  key: '_applyCheckLocale',
20488
20555
  value: function _applyCheckLocale(checks) {
20489
20556
  var keys = Object.keys(checks);
20490
- for (var _i26 = 0; _i26 < keys.length; _i26++) {
20491
- var id = keys[_i26];
20557
+ for (var _i27 = 0; _i27 < keys.length; _i27++) {
20558
+ var id = keys[_i27];
20492
20559
  if (!this.data.checks[id]) {
20493
20560
  throw new Error('Locale provided for unknown check: "'.concat(id, '"'));
20494
20561
  }
@@ -20499,8 +20566,8 @@
20499
20566
  key: '_applyRuleLocale',
20500
20567
  value: function _applyRuleLocale(rules) {
20501
20568
  var keys = Object.keys(rules);
20502
- for (var _i27 = 0; _i27 < keys.length; _i27++) {
20503
- var id = keys[_i27];
20569
+ for (var _i28 = 0; _i28 < keys.length; _i28++) {
20570
+ var id = keys[_i28];
20504
20571
  if (!this.data.rules[id]) {
20505
20572
  throw new Error('Locale provided for unknown rule: "'.concat(id, '"'));
20506
20573
  }
@@ -20511,8 +20578,8 @@
20511
20578
  key: '_applyFailureSummaries',
20512
20579
  value: function _applyFailureSummaries(messages) {
20513
20580
  var keys = Object.keys(messages);
20514
- for (var _i28 = 0; _i28 < keys.length; _i28++) {
20515
- var key = keys[_i28];
20581
+ for (var _i29 = 0; _i29 < keys.length; _i29++) {
20582
+ var key = keys[_i29];
20516
20583
  if (!this.data.failureSummaries[key]) {
20517
20584
  throw new Error('Locale provided for unknown failureMessage: "'.concat(key, '"'));
20518
20585
  }
@@ -21451,8 +21518,8 @@
21451
21518
  function serializeNode(_ref92) {
21452
21519
  var node = _ref92.node, nodeResult = _objectWithoutProperties(_ref92, _excluded9);
21453
21520
  nodeResult.node = node.toJSON();
21454
- for (var _i29 = 0, _arr2 = [ 'any', 'all', 'none' ]; _i29 < _arr2.length; _i29++) {
21455
- var type = _arr2[_i29];
21521
+ for (var _i30 = 0, _arr2 = [ 'any', 'all', 'none' ]; _i30 < _arr2.length; _i30++) {
21522
+ var type = _arr2[_i30];
21456
21523
  nodeResult[type] = nodeResult[type].map(function(_ref93) {
21457
21524
  var relatedNodes = _ref93.relatedNodes, checkResult = _objectWithoutProperties(_ref93, _excluded10);
21458
21525
  return _extends({}, checkResult, {
@@ -21563,8 +21630,8 @@
21563
21630
  var transformedResults = results.map(function(result) {
21564
21631
  var transformedResult = _extends({}, result);
21565
21632
  var types = [ 'passes', 'violations', 'incomplete', 'inapplicable' ];
21566
- for (var _i30 = 0, _types = types; _i30 < _types.length; _i30++) {
21567
- var type = _types[_i30];
21633
+ for (var _i31 = 0, _types = types; _i31 < _types.length; _i31++) {
21634
+ var type = _types[_i31];
21568
21635
  if (transformedResult[type] && Array.isArray(transformedResult[type])) {
21569
21636
  transformedResult[type] = transformedResult[type].map(function(_ref97) {
21570
21637
  var _node;
@@ -21791,6 +21858,10 @@
21791
21858
  description: 'Ensures each page has at least one mechanism for a user to bypass navigation and jump straight to the content',
21792
21859
  help: 'Page must have means to bypass repeated blocks'
21793
21860
  },
21861
+ 'color-contrast-enhanced': {
21862
+ description: 'Ensures the contrast between foreground and background colors meets WCAG 2 AAA contrast ratio thresholds',
21863
+ help: 'Elements must have sufficient color contrast'
21864
+ },
21794
21865
  'color-contrast': {
21795
21866
  description: 'Ensures the contrast between foreground and background colors meets WCAG 2 AA contrast ratio thresholds',
21796
21867
  help: 'Elements must have sufficient color contrast'
@@ -22281,6 +22352,32 @@
22281
22352
  fail: 'Element has invalid semantics for an element in the focus order.'
22282
22353
  }
22283
22354
  },
22355
+ 'color-contrast-enhanced': {
22356
+ impact: 'serious',
22357
+ messages: {
22358
+ pass: 'Element has sufficient color contrast of ${data.contrastRatio}',
22359
+ fail: {
22360
+ default: 'Element has insufficient color contrast of ${data.contrastRatio} (foreground color: ${data.fgColor}, background color: ${data.bgColor}, font size: ${data.fontSize}, font weight: ${data.fontWeight}). Expected contrast ratio of ${data.expectedContrastRatio}',
22361
+ fgOnShadowColor: 'Element has insufficient color contrast of ${data.contrastRatio} between the foreground and shadow color (foreground color: ${data.fgColor}, text-shadow color: ${data.shadowColor}, font size: ${data.fontSize}, font weight: ${data.fontWeight}). Expected contrast ratio of ${data.expectedContrastRatio}',
22362
+ shadowOnBgColor: 'Element has insufficient color contrast of ${data.contrastRatio} between the shadow color and background color (text-shadow color: ${data.shadowColor}, background color: ${data.bgColor}, font size: ${data.fontSize}, font weight: ${data.fontWeight}). Expected contrast ratio of ${data.expectedContrastRatio}'
22363
+ },
22364
+ incomplete: {
22365
+ default: 'Unable to determine contrast ratio',
22366
+ bgImage: 'Element\'s background color could not be determined due to a background image',
22367
+ bgGradient: 'Element\'s background color could not be determined due to a background gradient',
22368
+ imgNode: 'Element\'s background color could not be determined because element contains an image node',
22369
+ bgOverlap: 'Element\'s background color could not be determined because it is overlapped by another element',
22370
+ fgAlpha: 'Element\'s foreground color could not be determined because of alpha transparency',
22371
+ elmPartiallyObscured: 'Element\'s background color could not be determined because it\'s partially obscured by another element',
22372
+ elmPartiallyObscuring: 'Element\'s background color could not be determined because it partially overlaps other elements',
22373
+ outsideViewport: 'Element\'s background color could not be determined because it\'s outside the viewport',
22374
+ equalRatio: 'Element has a 1:1 contrast ratio with the background',
22375
+ shortTextContent: 'Element content is too short to determine if it is actual text content',
22376
+ nonBmp: 'Element content contains only non-text characters',
22377
+ pseudoContent: 'Element\'s background color could not be determined due to a pseudo element'
22378
+ }
22379
+ }
22380
+ },
22284
22381
  'color-contrast': {
22285
22382
  impact: 'serious',
22286
22383
  messages: {
@@ -22977,7 +23074,7 @@
22977
23074
  }
22978
23075
  }
22979
23076
  },
22980
- incompleteFallbackMessage: {}
23077
+ incompleteFallbackMessage: 'axe couldn\'t tell the reason. Time to break out the element inspector!'
22981
23078
  },
22982
23079
  rules: [ {
22983
23080
  id: 'accesskeys',
@@ -23324,6 +23421,35 @@
23324
23421
  id: 'landmark'
23325
23422
  } ],
23326
23423
  none: []
23424
+ }, {
23425
+ id: 'color-contrast-enhanced',
23426
+ matches: 'color-contrast-matches',
23427
+ excludeHidden: false,
23428
+ enabled: false,
23429
+ tags: [ 'cat.color', 'wcag2aaa', 'wcag146' ],
23430
+ all: [],
23431
+ any: [ {
23432
+ options: {
23433
+ ignoreUnicode: true,
23434
+ ignoreLength: false,
23435
+ ignorePseudo: false,
23436
+ boldValue: 700,
23437
+ boldTextPt: 14,
23438
+ largeTextPt: 18,
23439
+ contrastRatio: {
23440
+ normal: {
23441
+ expected: 7
23442
+ },
23443
+ large: {
23444
+ expected: 4.5
23445
+ }
23446
+ },
23447
+ pseudoSizeThreshold: .25,
23448
+ shadowOutlineEmMax: .1
23449
+ },
23450
+ id: 'color-contrast-enhanced'
23451
+ } ],
23452
+ none: []
23327
23453
  }, {
23328
23454
  id: 'color-contrast',
23329
23455
  matches: 'color-contrast-matches',
@@ -24179,6 +24305,27 @@
24179
24305
  options: {
24180
24306
  roles: [ 'tooltip' ]
24181
24307
  }
24308
+ }, {
24309
+ id: 'color-contrast-enhanced',
24310
+ evaluate: 'color-contrast-evaluate',
24311
+ options: {
24312
+ ignoreUnicode: true,
24313
+ ignoreLength: false,
24314
+ ignorePseudo: false,
24315
+ boldValue: 700,
24316
+ boldTextPt: 14,
24317
+ largeTextPt: 18,
24318
+ contrastRatio: {
24319
+ normal: {
24320
+ expected: 7
24321
+ },
24322
+ large: {
24323
+ expected: 4.5
24324
+ }
24325
+ },
24326
+ pseudoSizeThreshold: .25,
24327
+ shadowOutlineEmMax: .1
24328
+ }
24182
24329
  }, {
24183
24330
  id: 'color-contrast',
24184
24331
  evaluate: 'color-contrast-evaluate',