Browse Source

Detect when the node has already a type defined

pull/1229/head
Artur Arseniev 8 years ago
parent
commit
6dc37f652a
  1. 21
      src/parser/model/ParserHtml.js

21
src/parser/model/ParserHtml.js

@ -71,15 +71,22 @@ module.exports = config => {
// Start with understanding what kind of component it is // Start with understanding what kind of component it is
if (ct) { if (ct) {
let obj = ''; let obj = '';
let type =
node.getAttribute && node.getAttribute(`${modelAttrStart}type`);
// Iterate over all available Component Types and // If the type is already defined, use it
// the first with a valid result will be that component if (type) {
for (let it = 0; it < ct.length; it++) { model = { type };
obj = ct[it].model.isComponent(node); } else {
if (obj) break; // Iterate over all available Component Types and
} // the first with a valid result will be that component
for (let it = 0; it < ct.length; it++) {
obj = ct[it].model.isComponent(node);
if (obj) break;
}
model = obj; model = obj;
}
} }
// Set tag name if not yet done // Set tag name if not yet done

Loading…
Cancel
Save