diff --git a/accname/name/comp_text_node.html b/accname/name/comp_text_node.html index b9b26e6673915c..4542bd1589419c 100644 --- a/accname/name/comp_text_node.html +++ b/accname/name/comp_text_node.html @@ -17,9 +17,9 @@

text/element/text nodes, no space

- -

headinglabel

-linklabel + +

headinglabel

+linklabel

text/comment/text nodes, no space

diff --git a/wai-aria/scripts/aria-utils.js b/wai-aria/scripts/aria-utils.js index feb71b8398454f..2b790b44bf8e48 100644 --- a/wai-aria/scripts/aria-utils.js +++ b/wai-aria/scripts/aria-utils.js @@ -136,10 +136,17 @@ const AriaUtils = { let label = el.getAttribute("data-expectedlabel"); let testName = el.getAttribute("data-testname") || label; // data-testname optional if label is unique per test file promise_test(async t => { - const expectedLabel = el.getAttribute("data-expectedlabel"); + let expectedLabel = el.getAttribute("data-expectedlabel"); let computedLabel = await test_driver.get_computed_label(el); - // Todo: Remove whitespace normalization after https://github.com/w3c/accname/issues/192 is addressed. Change prior line back to `const`, too. - computedLabel = computedLabel.trim() + + // See: https://github.com/w3c/accname/issues/192 and https://github.com/w3c/accname/issues/208 + // + // HTML/JS whitespace matches regular space, formfeed (\f), newline (\n), return (\r), tab (\t), vertical tab (\v), + // non-breaking space (\xA0), and a few more Unicode whitespace characters: \u00A0, \u2028, and \u2029. + const whitespace = /\s+/g; + expectedLabel = expectedLabel.replace(whitespace, ' ').trim(); + computedLabel = computedLabel.replace(whitespace, ' ').trim(); + assert_equals(computedLabel, expectedLabel, el.outerHTML); }, `${testName}`); }