Skip to content

Commit

Permalink
Add outerHTML option to serializer. Resolves inikulin#230.
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldenning committed Jun 21, 2021
1 parent 9c683e1 commit e43077d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/parse5/lib/serializer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const NS = HTML.NAMESPACES;

//Default serializer options
const DEFAULT_OPTIONS = {
treeAdapter: defaultTreeAdapter
treeAdapter: defaultTreeAdapter,
outerHTML: false
};

//Escaping regexes
Expand All @@ -33,7 +34,11 @@ class Serializer {

//API
serialize() {
this._serializeChildNodes(this.startNode);
if (this.options.outerHTML) {
this._serializeElement(this.startNode);
} else {
this._serializeChildNodes(this.startNode);
}

return this.html;
}
Expand Down

0 comments on commit e43077d

Please sign in to comment.