|
|
@ -16,11 +16,39 @@ const builder = { |
|
|
|
openedChain: {} |
|
|
|
}, |
|
|
|
|
|
|
|
componentFromHTML: function (htmlText) { |
|
|
|
extended: {}, |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* @param {string} htmlText |
|
|
|
* @param {Modifier} modifier |
|
|
|
* @returns {Component} |
|
|
|
*/ |
|
|
|
componentFromHTML: function (htmlText, modifier = null) { |
|
|
|
/** |
|
|
|
* @type {Component} |
|
|
|
*/ |
|
|
|
let compel = new Component(new DOMParser().parseFromString(htmlText, "text/html")); |
|
|
|
if (modifier) { |
|
|
|
return compel.modifier(modifier); |
|
|
|
} |
|
|
|
return compel; |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* @param {HTMLElement} element |
|
|
|
* @param {Modifier} modifier |
|
|
|
* @returns {Component} |
|
|
|
*/ |
|
|
|
componentFromHTMLElement: function (element, modifier = null) { |
|
|
|
let newCompel = new Component(element); |
|
|
|
if (modifier) { |
|
|
|
return newCompel.modifier(modifier); |
|
|
|
} |
|
|
|
return newCompel; |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* @param {string} tag |
|
|
|