babelacc

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

commit
044343248283fb6884d4095c5cd9b378900014a3
parent
94253c7746b36034990e83dde119b91c48bd3fd5
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2018-02-03 15:13
consistently use first child

Diffstat

M index.html 4 +++-
M src/babel.js 8 ++++----

2 files changed, 7 insertions, 5 deletions


diff --git a/index.html b/index.html

@@ -10,7 +10,9 @@
   10    10 <body>
   11    11 	<h1>Babelacc</h1>
   12    12 
   13    -1 	<p>Enter some HTML to compare different implementations of the text alternative computation.</p>
   -1    13 	<p>Enter some HTML to compare different implementations of the text
   -1    14 	alternative computation. Only the first element and its contents are
   -1    15 	considered.</p>
   14    16 	<p>Inline CSS is supported, but no javascript or external CSS.</p>
   15    17 
   16    18 	<form id="ba-form" method="GET">

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

@@ -20,7 +20,7 @@ var implementations = {
   20    20 		return {
   21    21 			name: ex(ariaApi.getName, [el]),
   22    22 			desc: ex(ariaApi.getDescription, [el]),
   23    -1 			role: ex(ariaApi.getRole, [el.children[0]]),
   -1    23 			role: ex(ariaApi.getRole, [el]),
   24    24 		};
   25    25 	},
   26    26 	'accdc': accdc.calcNames,
@@ -28,7 +28,7 @@ var implementations = {
   28    28 		return {
   29    29 			name: ex(axe.commons.text.accessibleText, [el]),
   30    30 			desc: '-',
   31    -1 			role: el.children[0].getAttribute('role') || ex(axe.commons.aria.implicitRole, [el.children[0]]),
   -1    31 			role: el.getAttribute('role') || ex(axe.commons.aria.implicitRole, [el]),
   32    32 		};
   33    33 	},
   34    34 	'axs': function(el) {
@@ -36,7 +36,7 @@ var implementations = {
   36    36 			name: ex(axs.properties.findTextAlternatives, [el, {}]),
   37    37 			desc: '-',
   38    38 			role: ex(function() {
   39    -1 				var roles = axs.utils.getRoles(el.children[0], true);
   -1    39 				var roles = axs.utils.getRoles(el, true);
   40    40 				if (roles) {
   41    41 					return roles.roles.map(x => x.name).join(' ');
   42    42 				}
@@ -56,7 +56,7 @@ var run = function(html) {
   56    56 	results.innerHTML = '';
   57    57 
   58    58 	return Promise.all(Object.keys(implementations).map(function(key) {
   59    -1 		var p = implementations[key](preview);
   -1    59 		var p = implementations[key](preview.children[0] || preview);
   60    60 
   61    61 		return Promise.resolve(p).then(function(result) {
   62    62 			var tr = document.createElement('tr');