mirror of
https://github.com/ankitects/anki.git
synced 2025-12-11 13:56:55 -05:00
Avoid using outerHTML + Fix regression
This commit is contained in:
parent
f9259621a6
commit
861c723ec0
1 changed files with 3 additions and 3 deletions
|
|
@ -36,7 +36,7 @@ const allow = (attrs: string[]): FilterMethod => (element: Element): void =>
|
||||||
);
|
);
|
||||||
|
|
||||||
function unwrapElement(element: Element): void {
|
function unwrapElement(element: Element): void {
|
||||||
element.outerHTML = element.innerHTML;
|
element.replaceWith(...element.childNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterSpan(element: Element): void {
|
function filterSpan(element: Element): void {
|
||||||
|
|
@ -96,9 +96,9 @@ const filterElementTagsAllowed = (tagsAllowed: TagsAllowed) => (
|
||||||
if (Object.prototype.hasOwnProperty.call(tagsAllowed, tagName)) {
|
if (Object.prototype.hasOwnProperty.call(tagsAllowed, tagName)) {
|
||||||
tagsAllowed[tagName](element);
|
tagsAllowed[tagName](element);
|
||||||
} else if (element.innerHTML) {
|
} else if (element.innerHTML) {
|
||||||
removeElement(element);
|
|
||||||
} else {
|
|
||||||
unwrapElement(element);
|
unwrapElement(element);
|
||||||
|
} else {
|
||||||
|
removeElement(element);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue