How to use the parse5.TreeAdapters function in parse5

To help you get started, we’ve selected a few parse5 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 panacloud / learn-angular / step9_gulp_router / node_modules / angular2 / src / dom / parse5_adapter.js View on Github external
Parse5DomAdapter.prototype.clone = function (node) {
        // e.g. document fragment
        if (node.type === 'root') {
            var serialized = serializer.serialize(node);
            var newParser = new parse5.Parser(parse5.TreeAdapters.htmlparser2);
            return newParser.parseFragment(serialized);
        }
        else {
            var temp = treeAdapter.createElement("template", null, []);
            treeAdapter.appendChild(temp, node);
            var serialized = serializer.serialize(temp);
            var newParser = new parse5.Parser(parse5.TreeAdapters.htmlparser2);
            return newParser.parseFragment(serialized).childNodes[0];
        }
    };
    Parse5DomAdapter.prototype.hasProperty = function (element, name) { return _HTMLElementPropertyList.indexOf(name) > -1; };
github angular / angular / modules / angular2 / src / dom / parse5_adapter.ts View on Github external
clone(node) {
    // e.g. document fragment
    if (node.type === 'root') {
      var serialized = serializer.serialize(node);
      var newParser = new parse5.Parser(parse5.TreeAdapters.htmlparser2);
      return newParser.parseFragment(serialized);
    } else {
      var temp = treeAdapter.createElement("template", null, []);
      treeAdapter.appendChild(temp, node);
      var serialized = serializer.serialize(temp);
      var newParser = new parse5.Parser(parse5.TreeAdapters.htmlparser2);
      return newParser.parseFragment(serialized).childNodes[0];
    }
  }
  getElementsByClassName(element, name: string) {
github angular / angular / modules / angular2 / src / dom / parse5_adapter.ts View on Github external
var parse5 = require('parse5');
var parser = new parse5.Parser(parse5.TreeAdapters.htmlparser2);
var serializer = new parse5.Serializer(parse5.TreeAdapters.htmlparser2);
var treeAdapter = parser.treeAdapter;

var cssParse = require('css').parse;

var url = require('url');

import {List, MapWrapper, ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
import {DomAdapter, setRootDomAdapter} from './dom_adapter';
import {BaseException, isPresent, isBlank, global} from 'angular2/src/facade/lang';
import {SelectorMatcher, CssSelector} from 'angular2/src/render/dom/compiler/selector';

var _attrToPropMap = {
  'innerHtml': 'innerHTML',
  'readonly': 'readOnly',
  'tabindex': 'tabIndex',
github panacloud / learn-angular / step9_gulp_router / node_modules / angular2 / src / dom / parse5_adapter.js View on Github external
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var parse5 = require('parse5');
var parser = new parse5.Parser(parse5.TreeAdapters.htmlparser2);
var serializer = new parse5.Serializer(parse5.TreeAdapters.htmlparser2);
var treeAdapter = parser.treeAdapter;
var cssParse = require('css').parse;
var url = require('url');
var collection_1 = require('angular2/src/facade/collection');
var dom_adapter_1 = require('./dom_adapter');
var lang_1 = require('angular2/src/facade/lang');
var selector_1 = require('angular2/src/render/dom/compiler/selector');
var _attrToPropMap = {
    'innerHtml': 'innerHTML',
    'readonly': 'readOnly',
    'tabindex': 'tabIndex',
};
var defDoc = null;
function _notImplemented(methodName) {
    return new lang_1.BaseException('This method is not implemented in Parse5DomAdapter: ' + methodName);
github Polymer / tools / packages / dom5 / dom5.js View on Github external
function parse(text, options) {
  var parser = new parse5.Parser(parse5.TreeAdapters.default, options);
  return parser.parse(text);
}
github littlstar / starplate / src / parser.js View on Github external
constructor () {
    super(parse5.TreeAdapters.htmlparser2);

    /**
     * Known patches for this parser state.
     *
     * @public
     * @type {Map}
     * @name patches
     */

    this.patches = new Map();
  }