- commit
- e52d8dca8f76f0235b8cce156a52df8e41572060
- parent
- ae46457df52900a932a4c44a1e5f3f54cf3c8488
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2024-06-21 15:56
name: use xlink:title
Diffstat
| M | lib/constants.js | 6 | +++--- |
| M | lib/name.js | 6 | ++++++ |
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/constants.js b/lib/constants.js
@@ -253,8 +253,8 @@ exports.roles = {
253 253 },
254 254 generic: {
255 255 selectors: [
256 -1 'a:not([href])',
257 -1 'area:not([href])',
-1 256 'a:not([*|href])',
-1 257 'area:not([*|href])',
258 258 `aside:not(${scoped}):not([aria-label]):not([aria-labelledby]):not([title])`,
259 259 'b',
260 260 'bdi',
@@ -378,7 +378,7 @@ exports.roles = {
378 378 ],
379 379 },
380 380 link: {
381 -1 selectors: ['a[href]', 'area[href]', 'a[xlink\\:href]'],
-1 381 selectors: ['a[*|href]', 'area[href]'],
382 382 childRoles: ['doc-backlink', 'doc-biblioref', 'doc-glossref', 'doc-noteref'],
383 383 nameFromContents: true,
384 384 },
diff --git a/lib/name.js b/lib/name.js
@@ -130,6 +130,9 @@ const getName = function(el, recursive, visited, directReference) {
130 130 ret = svgTitle.textContent;
131 131 }
132 132 }
-1 133 if (!ret.trim() && el.matches('a')) {
-1 134 ret = el.getAttribute('xlink:title') || '';
-1 135 }
133 136
134 137 // F
135 138 // FIXME: menu is not mentioned in the spec
@@ -196,6 +199,9 @@ const getDescription = function(el) {
196 199 } else if (el.title) {
197 200 ret = el.title;
198 201 }
-1 202 if (!ret.trim() && el.matches('a')) {
-1 203 ret = el.getAttribute('xlink:title') || '';
-1 204 }
199 205
200 206 ret = (ret || '').trim().replace(/\s+/g, ' ');
201 207