mirror of
https://ghproxy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-07-21 12:16:59 +08:00
* [APP-1923] change remediation management (#411) * [APP-1988] Add tabs * [APP-1988][APP-1989] add tabs, remove menu item * [APP-1988][APP-1989] add tabs, remove menu item * [APP-1992] add empty state and tab navigation * [APP-1993][APP-1994] Change view for manage AI fixes, change delete confirmation modal * [APP-1996] add view for alt text fixes * [APP-1996] add edit for alt text fixes * [APP-1996] add edit for alt text fixes * [APP-1996] add edit for alt text fixes * [APP-1996] add edit for alt text fixes * [APP-1996] add edit for alt text fixes * [APP-1995] Color contrast form * [APP-2001] add global remediation logic (#415) * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2001] add global remediation logic * [APP-2003] add disable across scans (#418) * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * [APP-2003] add disable across scans * add logs * add logs * add logs * remove logs * remove logs * remove logs * remove logs * remove logs * remove logs * remove logs * remove logs * remove logs * remove logs * change to theme value * change to theme value * change to theme value * change to theme value * add edit mode * add edit mode * add edit mode
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
import {
|
||
BACKGROUND_ELEMENT_CLASS,
|
||
COLOR_ELEMENT_CLASS,
|
||
CURRENT_ELEMENT_CLASS,
|
||
} from '@ea11y-apps/scanner/constants';
|
||
import { getElementByXPath } from '@ea11y-apps/scanner/utils/get-element-by-xpath';
|
||
|
||
/**
|
||
* Return outer html for el. Should be used only for global remediation.
|
||
* @param {string|null} xpath
|
||
* @param {string|null} attr
|
||
* @return {string} element outer html with removed classes
|
||
*/
|
||
export const getOuterHtmlByXpath = (xpath, attr = null) => {
|
||
if (!xpath) {
|
||
return '';
|
||
}
|
||
const element = getElementByXPath(xpath);
|
||
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
||
return '';
|
||
}
|
||
|
||
// Define ignored class constants (with dots)
|
||
const ignoredClasses = new Set([
|
||
CURRENT_ELEMENT_CLASS,
|
||
COLOR_ELEMENT_CLASS,
|
||
BACKGROUND_ELEMENT_CLASS,
|
||
]);
|
||
|
||
// Clone the node so we don’t modify the real DOM
|
||
const clone = element.cloneNode(true);
|
||
let html = clone.outerHTML;
|
||
|
||
ignoredClasses.forEach((item) => {
|
||
html = html.replaceAll(` ${item}`, '');
|
||
html = html.replaceAll(item, '');
|
||
html = html.replaceAll('class=""', '');
|
||
if (attr) {
|
||
html = html.replaceAll(attr, '');
|
||
}
|
||
});
|
||
|
||
return html;
|
||
};
|