axe-core 4.11.0-canary.853f043 → 4.11.0-canary.8f249fd

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
@@ -16416,6 +16416,7 @@
16416
16416
  this.b = _color2.b;
16417
16417
  this.alpha = +_color2.alpha;
16418
16418
  } catch (_unused2) {
16419
+ incomplete_data_default.set('colorParse', colorString);
16419
16420
  throw new Error('Unable to parse color "'.concat(colorString, '"'));
16420
16421
  }
16421
16422
  return this;
@@ -24184,9 +24185,17 @@
24184
24185
  bgElms.push(bgElm);
24185
24186
  return null;
24186
24187
  }
24187
- var bgColor = get_own_background_color_default(bgElmStyle);
24188
- if (bgColor.alpha === 0) {
24189
- continue;
24188
+ var bgColor = void 0;
24189
+ try {
24190
+ bgColor = get_own_background_color_default(bgElmStyle);
24191
+ if (bgColor.alpha === 0) {
24192
+ continue;
24193
+ }
24194
+ } catch (error) {
24195
+ if (error && incomplete_data_default.get('colorParse')) {
24196
+ return null;
24197
+ }
24198
+ throw error;
24190
24199
  }
24191
24200
  if (bgElmStyle.getPropertyValue('display') !== 'inline' && !fullyEncompasses(bgElm, textRects)) {
24192
24201
  bgElms.push(bgElm);
@@ -24277,16 +24286,23 @@
24277
24286
  });
24278
24287
  } ];
24279
24288
  var fgColors = [];
24280
- for (var _i24 = 0, _colorStack = colorStack; _i24 < _colorStack.length; _i24++) {
24281
- var colorFn = _colorStack[_i24];
24282
- var _color4 = colorFn();
24283
- if (!_color4) {
24284
- continue;
24289
+ try {
24290
+ for (var _i24 = 0, _colorStack = colorStack; _i24 < _colorStack.length; _i24++) {
24291
+ var colorFn = _colorStack[_i24];
24292
+ var _color4 = colorFn();
24293
+ if (!_color4) {
24294
+ continue;
24295
+ }
24296
+ fgColors = fgColors.concat(_color4);
24297
+ if (_color4.alpha === 1) {
24298
+ break;
24299
+ }
24285
24300
  }
24286
- fgColors = fgColors.concat(_color4);
24287
- if (_color4.alpha === 1) {
24288
- break;
24301
+ } catch (error) {
24302
+ if (error && incomplete_data_default.get('colorParse')) {
24303
+ return null;
24289
24304
  }
24305
+ throw error;
24290
24306
  }
24291
24307
  var fgColor = fgColors.reduce(function(source, backdrop) {
24292
24308
  return _flattenColors(source, backdrop);
@@ -26219,11 +26235,21 @@
26219
26235
  }
26220
26236
  var truncatedResult = Math.floor(contrast2 * 100) / 100;
26221
26237
  var missing;
26238
+ var colorParse;
26222
26239
  if (bgColor === null) {
26223
- missing = incomplete_data_default.get('bgColor');
26240
+ if (incomplete_data_default.get('colorParse')) {
26241
+ missing = 'colorParse';
26242
+ colorParse = incomplete_data_default.get('colorParse');
26243
+ } else {
26244
+ missing = incomplete_data_default.get('bgColor');
26245
+ }
26224
26246
  } else if (!isValid) {
26225
26247
  missing = contrastContributor;
26226
26248
  }
26249
+ if (fgColor === null && incomplete_data_default.get('colorParse')) {
26250
+ missing = 'colorParse';
26251
+ colorParse = incomplete_data_default.get('colorParse');
26252
+ }
26227
26253
  var equalRatio = truncatedResult === 1;
26228
26254
  var shortTextContent = visibleText.length === 1;
26229
26255
  if (equalRatio) {
@@ -26239,7 +26265,8 @@
26239
26265
  fontWeight: bold ? 'bold' : 'normal',
26240
26266
  messageKey: missing,
26241
26267
  expectedContrastRatio: expected + ':1',
26242
- shadowColor: shadowColor ? shadowColor.toHexString() : void 0
26268
+ shadowColor: shadowColor ? shadowColor.toHexString() : void 0,
26269
+ colorParse: colorParse
26243
26270
  });
26244
26271
  if (fgColor === null || bgColor === null || equalRatio || shortTextContent && !ignoreLength && !isValid) {
26245
26272
  missing = null;
@@ -30189,7 +30216,8 @@
30189
30216
  equalRatio: 'Element has a 1:1 contrast ratio with the background',
30190
30217
  shortTextContent: 'Element content is too short to determine if it is actual text content',
30191
30218
  nonBmp: 'Element content contains only non-text characters',
30192
- pseudoContent: 'Element\'s background color could not be determined due to a pseudo element'
30219
+ pseudoContent: 'Element\'s background color could not be determined due to a pseudo element',
30220
+ colorParse: 'Could not parse color string ${data.colorParse}'
30193
30221
  }
30194
30222
  }
30195
30223
  },
@@ -30219,7 +30247,8 @@
30219
30247
  equalRatio: 'Element has a 1:1 contrast ratio with the background',
30220
30248
  shortTextContent: 'Element content is too short to determine if it is actual text content',
30221
30249
  nonBmp: 'Element content contains only non-text characters',
30222
- pseudoContent: 'Element\'s background color could not be determined due to a pseudo element'
30250
+ pseudoContent: 'Element\'s background color could not be determined due to a pseudo element',
30251
+ colorParse: 'Could not parse color string ${data.colorParse}'
30223
30252
  }
30224
30253
  }
30225
30254
  },