babelacc

compare different implementations of the text alternative computation  https://p.ce9e.org/babelacc/
git clone https://git.ce9e.org/babelacc.git

commit
21d44eb11d6be49c544a8716de439d3bd7fae5b4
parent
b7717ad7b73c3c5357b272c987b9999c9466f897
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2022-10-04 19:00
update packages

Diffstat

M babel.js 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------
M fuzz.js 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++--------
M package.json 2 +-
M src/babel.js 4 ++--

4 files changed, 157 insertions, 27 deletions


diff --git a/babel.js b/babel.js

@@ -4989,12 +4989,12 @@ var _getParentNode = function(node) {
 4989  4989 };
 4990  4990 
 4991  4991 var detectLoop = function(node) {
 4992    -1 	var tmp = _getParentNode(node);
 4993    -1 	while (tmp) {
 4994    -1 		if (tmp === node) {
   -1  4992 	var seen = [node]
   -1  4993 	while ((node = _getParentNode(node))) {
   -1  4994 		if (seen.includes(node)) {
 4995  4995 			return true;
 4996  4996 		}
 4997    -1 		tmp = _getParentNode(tmp);
   -1  4997 		seen.push(node)
 4998  4998 	}
 4999  4999 };
 5000  5000 
@@ -5117,6 +5117,9 @@ var getAttribute = function(el, key) {
 5117  5117 		if (el.matches('noscript')) {
 5118  5118 			return true;
 5119  5119 		}
   -1  5120 		if (el.matches('details:not([open]) :not(summary)')) {
   -1  5121 			return true;
   -1  5122 		}
 5120  5123 		var style = window.getComputedStyle(el);
 5121  5124 		if (style.display === 'none' || style.visibility === 'hidden') {
 5122  5125 			return true;
@@ -32184,7 +32187,7 @@ Distributed under the terms of the Open Source Initiative OSI - MIT License
32184 32187     window[nameSpace] = {};
32185 32188     nameSpace = window[nameSpace];
32186 32189   }
32187    -1   nameSpace.getAccNameVersion = "2.59";
   -1 32190   nameSpace.getAccNameVersion = "2.61";
32188 32191   // AccName Computation Prototype
32189 32192   nameSpace.getAccName = nameSpace.calcNames = function(
32190 32193     node,
@@ -32542,6 +32545,16 @@ Plus roles extended for the Role Parity project.
32542 32545                 return result;
32543 32546               }
32544 32547 
   -1 32548               // Added to prevent name on roles that do not support a name.
   -1 32549               // https://www.w3.org/TR/wai-aria-1.2/#namefromprohibited
   -1 32550               var isProhibited =
   -1 32551                 node === rootNode &&
   -1 32552                 (nameProhibitedRoles.indexOf(nRole) !== -1 ||
   -1 32553                   (!nRole && nameProhibitedElements.indexOf(nTag) !== -1));
   -1 32554               if (isProhibited) {
   -1 32555                 return result;
   -1 32556               }
   -1 32557 
32545 32558               var isNativeFormField = nativeFormFields.indexOf(nTag) !== -1;
32546 32559               var isNativeButton = ["input"].indexOf(nTag) !== -1;
32547 32560               var isRangeWidgetRole = rangeWidgetRoles.indexOf(nRole) !== -1;
@@ -33311,11 +33324,66 @@ Plus roles extended for the Role Parity project.
33311 33324       // Subsequent roles added as part of the Role Parity project for ARIA 1.2.
33312 33325       // Tracks roles that don't specifically belong within the prior process lists.
33313 33326       var list4 = {
33314    -1         roles: ["legend", "caption"],
33315    -1         tags: ["legend", "caption", "figcaption"]
   -1 33327         roles: [
   -1 33328           "legend",
   -1 33329           "caption",
   -1 33330           "code",
   -1 33331           "deletion",
   -1 33332           "emphasis",
   -1 33333           "generic",
   -1 33334           "insertion",
   -1 33335           "paragraph",
   -1 33336           "strong",
   -1 33337           "subscript",
   -1 33338           "superscript"
   -1 33339         ],
   -1 33340         tags: [
   -1 33341           "legend",
   -1 33342           "caption",
   -1 33343           "figcaption",
   -1 33344           "code",
   -1 33345           "del",
   -1 33346           "em",
   -1 33347           "div",
   -1 33348           "span",
   -1 33349           "ins",
   -1 33350           "p",
   -1 33351           "strong",
   -1 33352           "sub",
   -1 33353           "sup"
   -1 33354         ]
33316 33355       };
33317 33356 
33318 33357       var genericElements = ["div", "span"];
   -1 33358       var nameProhibitedRoles = [
   -1 33359         "caption",
   -1 33360         "code",
   -1 33361         "deletion",
   -1 33362         "emphasis",
   -1 33363         "generic",
   -1 33364         "insertion",
   -1 33365         "none",
   -1 33366         "paragraph",
   -1 33367         "presentation",
   -1 33368         "strong",
   -1 33369         "subscript",
   -1 33370         "superscript"
   -1 33371       ];
   -1 33372       var nameProhibitedElements = [
   -1 33373         "caption",
   -1 33374         "figcaption",
   -1 33375         "code",
   -1 33376         "del",
   -1 33377         "em",
   -1 33378         "div",
   -1 33379         "span",
   -1 33380         "ins",
   -1 33381         "p",
   -1 33382         "strong",
   -1 33383         "sub",
   -1 33384         "sup"
   -1 33385       ];
   -1 33386 
33319 33387       var nativeFormFields = ["button", "input", "select", "textarea"];
33320 33388       var rangeWidgetRoles = ["scrollbar", "slider", "spinbutton"];
33321 33389       var editWidgetRoles = ["searchbox", "textbox"];
@@ -33427,10 +33495,7 @@ Plus roles extended for the Role Parity project.
33427 33495             s = s.replace(m[i], b);
33428 33496           }
33429 33497         }
33430    -1         s = s
33431    -1           .replace(/url\((.*?)\)\s+\/|url\((.*?)\)/g, "")
33432    -1           .replace(/^\s+|\s+$/g, "")
33433    -1           .replace(/\"/g, "");
   -1 33498         s = s.replace(/url\((.*?)\)\s+\/|url\((.*?)\)/g, "").replace(/\"/g, "");
33434 33499         return s;
33435 33500       };
33436 33501 
@@ -33844,7 +33909,7 @@ var ex = function(fn, args, _this) {
33844 33909 };
33845 33910 
33846 33911 var implementations = [{
33847    -1 	name: 'aria-api (0.4.2)',
   -1 33912 	name: 'aria-api (0.4.3)',
33848 33913 	url: 'https://github.com/xi/aria-api',
33849 33914 	fn: function(el) {
33850 33915 		return {
@@ -33854,7 +33919,7 @@ var implementations = [{
33854 33919 		};
33855 33920 	},
33856 33921 }, {
33857    -1 	name: 'accdc (2.59)',
   -1 33922 	name: 'accdc (2.61)',
33858 33923 	url: 'https://github.com/accdc/w3c-alternative-text-computation',
33859 33924 	fn: accdc.calcNames,
33860 33925 }, {

diff --git a/fuzz.js b/fuzz.js

@@ -305,12 +305,12 @@ var _getParentNode = function(node) {
  305   305 };
  306   306 
  307   307 var detectLoop = function(node) {
  308    -1 	var tmp = _getParentNode(node);
  309    -1 	while (tmp) {
  310    -1 		if (tmp === node) {
   -1   308 	var seen = [node]
   -1   309 	while ((node = _getParentNode(node))) {
   -1   310 		if (seen.includes(node)) {
  311   311 			return true;
  312   312 		}
  313    -1 		tmp = _getParentNode(tmp);
   -1   313 		seen.push(node)
  314   314 	}
  315   315 };
  316   316 
@@ -433,6 +433,9 @@ var getAttribute = function(el, key) {
  433   433 		if (el.matches('noscript')) {
  434   434 			return true;
  435   435 		}
   -1   436 		if (el.matches('details:not([open]) :not(summary)')) {
   -1   437 			return true;
   -1   438 		}
  436   439 		var style = window.getComputedStyle(el);
  437   440 		if (style.display === 'none' || style.visibility === 'hidden') {
  438   441 			return true;
@@ -1158,7 +1161,7 @@ Distributed under the terms of the Open Source Initiative OSI - MIT License
 1158  1161     window[nameSpace] = {};
 1159  1162     nameSpace = window[nameSpace];
 1160  1163   }
 1161    -1   nameSpace.getAccNameVersion = "2.59";
   -1  1164   nameSpace.getAccNameVersion = "2.61";
 1162  1165   // AccName Computation Prototype
 1163  1166   nameSpace.getAccName = nameSpace.calcNames = function(
 1164  1167     node,
@@ -1516,6 +1519,16 @@ Plus roles extended for the Role Parity project.
 1516  1519                 return result;
 1517  1520               }
 1518  1521 
   -1  1522               // Added to prevent name on roles that do not support a name.
   -1  1523               // https://www.w3.org/TR/wai-aria-1.2/#namefromprohibited
   -1  1524               var isProhibited =
   -1  1525                 node === rootNode &&
   -1  1526                 (nameProhibitedRoles.indexOf(nRole) !== -1 ||
   -1  1527                   (!nRole && nameProhibitedElements.indexOf(nTag) !== -1));
   -1  1528               if (isProhibited) {
   -1  1529                 return result;
   -1  1530               }
   -1  1531 
 1519  1532               var isNativeFormField = nativeFormFields.indexOf(nTag) !== -1;
 1520  1533               var isNativeButton = ["input"].indexOf(nTag) !== -1;
 1521  1534               var isRangeWidgetRole = rangeWidgetRoles.indexOf(nRole) !== -1;
@@ -2285,11 +2298,66 @@ Plus roles extended for the Role Parity project.
 2285  2298       // Subsequent roles added as part of the Role Parity project for ARIA 1.2.
 2286  2299       // Tracks roles that don't specifically belong within the prior process lists.
 2287  2300       var list4 = {
 2288    -1         roles: ["legend", "caption"],
 2289    -1         tags: ["legend", "caption", "figcaption"]
   -1  2301         roles: [
   -1  2302           "legend",
   -1  2303           "caption",
   -1  2304           "code",
   -1  2305           "deletion",
   -1  2306           "emphasis",
   -1  2307           "generic",
   -1  2308           "insertion",
   -1  2309           "paragraph",
   -1  2310           "strong",
   -1  2311           "subscript",
   -1  2312           "superscript"
   -1  2313         ],
   -1  2314         tags: [
   -1  2315           "legend",
   -1  2316           "caption",
   -1  2317           "figcaption",
   -1  2318           "code",
   -1  2319           "del",
   -1  2320           "em",
   -1  2321           "div",
   -1  2322           "span",
   -1  2323           "ins",
   -1  2324           "p",
   -1  2325           "strong",
   -1  2326           "sub",
   -1  2327           "sup"
   -1  2328         ]
 2290  2329       };
 2291  2330 
 2292  2331       var genericElements = ["div", "span"];
   -1  2332       var nameProhibitedRoles = [
   -1  2333         "caption",
   -1  2334         "code",
   -1  2335         "deletion",
   -1  2336         "emphasis",
   -1  2337         "generic",
   -1  2338         "insertion",
   -1  2339         "none",
   -1  2340         "paragraph",
   -1  2341         "presentation",
   -1  2342         "strong",
   -1  2343         "subscript",
   -1  2344         "superscript"
   -1  2345       ];
   -1  2346       var nameProhibitedElements = [
   -1  2347         "caption",
   -1  2348         "figcaption",
   -1  2349         "code",
   -1  2350         "del",
   -1  2351         "em",
   -1  2352         "div",
   -1  2353         "span",
   -1  2354         "ins",
   -1  2355         "p",
   -1  2356         "strong",
   -1  2357         "sub",
   -1  2358         "sup"
   -1  2359       ];
   -1  2360 
 2293  2361       var nativeFormFields = ["button", "input", "select", "textarea"];
 2294  2362       var rangeWidgetRoles = ["scrollbar", "slider", "spinbutton"];
 2295  2363       var editWidgetRoles = ["searchbox", "textbox"];
@@ -2401,10 +2469,7 @@ Plus roles extended for the Role Parity project.
 2401  2469             s = s.replace(m[i], b);
 2402  2470           }
 2403  2471         }
 2404    -1         s = s
 2405    -1           .replace(/url\((.*?)\)\s+\/|url\((.*?)\)/g, "")
 2406    -1           .replace(/^\s+|\s+$/g, "")
 2407    -1           .replace(/\"/g, "");
   -1  2472         s = s.replace(/url\((.*?)\)\s+\/|url\((.*?)\)/g, "").replace(/\"/g, "");
 2408  2473         return s;
 2409  2474       };
 2410  2475 

diff --git a/package.json b/package.json

@@ -4,7 +4,7 @@
    4     4   "description": "compare different implementations of accname",
    5     5   "devDependencies": {
    6     6     "accessibility-developer-tools": "2.12.0",
    7    -1     "aria-api": "0.4.2",
   -1     7     "aria-api": "0.4.3",
    8     8     "axe-core": "4.4.3",
    9     9     "dom-accessibility-api": "0.5.14",
   10    10     "nyc": "^15.1.0",

diff --git a/src/babel.js b/src/babel.js

@@ -17,7 +17,7 @@ var ex = function(fn, args, _this) {
   17    17 };
   18    18 
   19    19 var implementations = [{
   20    -1 	name: 'aria-api (0.4.2)',
   -1    20 	name: 'aria-api (0.4.3)',
   21    21 	url: 'https://github.com/xi/aria-api',
   22    22 	fn: function(el) {
   23    23 		return {
@@ -27,7 +27,7 @@ var implementations = [{
   27    27 		};
   28    28 	},
   29    29 }, {
   30    -1 	name: 'accdc (2.59)',
   -1    30 	name: 'accdc (2.61)',
   31    31 	url: 'https://github.com/accdc/w3c-alternative-text-computation',
   32    32 	fn: accdc.calcNames,
   33    33 }, {