diff --git a/src/dom_components/config/config.js b/src/dom_components/config/config.js index 9aa765508..a14506818 100644 --- a/src/dom_components/config/config.js +++ b/src/dom_components/config/config.js @@ -35,7 +35,8 @@ export default { */ processor: 0, - // List of void elements + // List of HTML void elements + // https://www.w3.org/TR/2011/WD-html-markup-20110113/syntax.html#void-elements voidElements: [ 'area', 'base', diff --git a/src/parser/model/ParserHtml.js b/src/parser/model/ParserHtml.js index ee9e21ee4..4e04d30a0 100644 --- a/src/parser/model/ParserHtml.js +++ b/src/parser/model/ParserHtml.js @@ -232,6 +232,11 @@ export default config => { } } + // Check for custom void elements (valid in XML) + if (!nodeChild && `${node.outerHTML}`.slice(-2) === '/>') { + model.void = true; + } + // If all children are texts and there is some textnode the parent should // be text too otherwise I'm unable to edit texnodes const comps = model.components;