How to use the html-parse-stringify.parse function in html-parse-stringify

To help you get started, we’ve selected a few html-parse-stringify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ericponto / html2IDOM / light.js View on Github external
function renderToIDom(html) {
	var ast = parse(html);
	
	if (Array.isArray(ast)) {
		ast.forEach(renderAstNode);
	} else {
		renderAstNode(ast);
	}
};
github AmpersandJS / ampersand-virtual-dom-mixin / mixin.js View on Github external
renderWithTemplate: function (data) {
        var newTree = this.renderTemplateToVdom(data);
        var isBackbone = typeof this.setElement === 'function';
        var isFirstRender;

        //view was initialized with an el, not yet rendered
        if (!this.tree && this.el) {
            this.tree = this.astToVdom(parse(this.el.outerHTML));
            isFirstRender = true;
        }

        //first render
        if (!this.el) {
            isFirstRender = true;
            var el = createElement(newTree);
            this.tree = newTree;
            if (isBackbone) {
                this.el.appendChild(el);
                this._backboneEl = el;
            } else {
                this.el = el;
            }
        //subsequent renders
        } else {
github AmpersandJS / ampersand-virtual-dom-mixin / mixin.js View on Github external
renderTemplateToVdom: function (data) {
        var renderedTemplate;

        if (isString(this.template)) {
            renderedTemplate = this.template;
        } else {
            renderedTemplate = this.template(data || this);
        }

        return this.astToVdom(parse(renderedTemplate.trim()));
    },

html-parse-stringify

Parses well-formed HTML (meaning all tags closed) into an AST and back. quickly.

MIT
Latest version published 3 years ago

Package Health Score

74 / 100
Full package analysis

Popular html-parse-stringify functions