Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public get outerHTML(): string {
/*
* Until parse5 support outerHTML
* (https://github.com/inikulin/parse5/issues/230)
* we need to use this workaround.
* https://github.com/inikulin/parse5/issues/118
*
* The problem with this workaround will modify the
* parentElement and parentNode of the element, so we
* need to restore it before return the outerHTML.
*/
const fragment = htmlparser2Adapter.createDocumentFragment();
const { parent, next, prev } = this._element;
htmlparser2Adapter.appendChild(fragment, this._element);
const result = parse5.serialize(fragment, { treeAdapter: htmlparser2Adapter });
this._element.parent = parent;
this._element.next = next;
this._element.prev = prev;
/* istanbul ignore else */
if (next) {
next.prev = this._element;
}
/* istanbul ignore else */
if (prev) {
prev.next = this._element;
}
public get outerHTML(): string {
/*
* Until parse5 support outerHTML
* (https://github.com/inikulin/parse5/issues/230)
* we need to use this workaround.
* https://github.com/inikulin/parse5/issues/118
*
* The problem with this workaround will modify the
* parentElement and parentNode of the element, so we
* need to restore it before return the outerHTML.
*/
const fragment = htmlparser2Adapter.createDocumentFragment();
const { parent, next, prev } = this._element;
htmlparser2Adapter.appendChild(fragment, this._element);
const result = parse5.serialize(fragment, { treeAdapter: htmlparser2Adapter });
this._element.parent = parent;
this._element.next = next;
this._element.prev = prev;
/* istanbul ignore else */
if (next) {
next.prev = this._element;
}
/* istanbul ignore else */
public get outerHTML(): string {
/*
* Until parse5 support outerHTML
* (https://github.com/inikulin/parse5/issues/230)
* we need to use this workaround.
* https://github.com/inikulin/parse5/issues/118
*
* The problem with this workaround will modify the
* parentElement and parentNode of the element, so we
* need to restore it before return the outerHTML.
*/
const fragment = htmlparser2Adapter.createDocumentFragment();
const { parent, next, prev } = this._element;
htmlparser2Adapter.appendChild(fragment, this._element);
const result = parse5.serialize(fragment, { treeAdapter: htmlparser2Adapter });
this._element.parent = parent;
this._element.next = next;
this._element.prev = prev;
if (next) {
next.prev = this._element;
}
if (prev) {
prev.next = this._element;
}
return result;
public get outerHTML(): string {
/*
* Until parse5 support outerHTML
* (https://github.com/inikulin/parse5/issues/230)
* we need to use this workaround.
* https://github.com/inikulin/parse5/issues/118
*
* The problem with this workaround will modify the
* parentElement and parentNode of the element, so we
* need to restore it before return the outerHTML.
*/
const fragment = htmlparser2Adapter.createDocumentFragment();
const { parent, next, prev } = this._element;
htmlparser2Adapter.appendChild(fragment, this._element);
const result = parse5.serialize(fragment, { treeAdapter: htmlparser2Adapter });
this._element.parent = parent;
this._element.next = next;
this._element.prev = prev;
if (next) {
next.prev = this._element;
}
if (prev) {
prev.next = this._element;