From 25d703d78c4068387e7f25037cdc3e5a724cc2a5 Mon Sep 17 00:00:00 2001 From: Wesley B <62723358+wesleyboar@users.noreply.github.com> Date: Mon, 8 Jun 2026 14:51:44 -0500 Subject: [PATCH] =?UTF-8?q?Revert=20"feat(generic):=20data-aria-*=20attrs?= =?UTF-8?q?=20=E2=86=92=20aria-*=20attrs=20(#645)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5fe56f0f7bf3f2a8c8a650e2aa5aacb77852fb77. --- .../_utils/js/promote-data-aria-attributes.js | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 src/lib/_utils/js/promote-data-aria-attributes.js diff --git a/src/lib/_utils/js/promote-data-aria-attributes.js b/src/lib/_utils/js/promote-data-aria-attributes.js deleted file mode 100644 index ace70b37a..000000000 --- a/src/lib/_utils/js/promote-data-aria-attributes.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copy `data-aria-*` attributes to matching `aria-*` on the same nodes. - * For HTML saved through WYSIWYG editors that strip unprefixed ARIA on publish. - * - * @param {ParentNode | null | undefined} [root=document] - */ -export default function promoteDataAriaAttributes(root = document) { - if (!root) { - return; - } - - const elements = - root instanceof Document - ? root.querySelectorAll('*') - : root instanceof Element - ? [ root, ...root.querySelectorAll('*') ] - : []; - - for (const el of elements) { - if (!(el instanceof Element)) { - continue; - } - for (const attr of [ ...el.attributes ]) { - if (!attr.name.startsWith('data-aria-')) { - continue; - } - el.setAttribute( - 'aria-' + attr.name.slice('data-aria-'.length), - attr.value - ); - } - } -}