2da9c37bf75ccf13a3f6af9b7df86b75a2990d9a486fba4183b0db69c70660f6e01cd5ebe798be25979f5a55f07f0e9c4ce52f2bdea8ee0319636fc1c2a921 697 B

1234567891011121314151617181920212223242526272829
  1. 'use strict';
  2. const Parser = require('./parser');
  3. const Serializer = require('./serializer');
  4. // Shorthands
  5. exports.parse = function parse(html, options) {
  6. const parser = new Parser(options);
  7. return parser.parse(html);
  8. };
  9. exports.parseFragment = function parseFragment(fragmentContext, html, options) {
  10. if (typeof fragmentContext === 'string') {
  11. options = html;
  12. html = fragmentContext;
  13. fragmentContext = null;
  14. }
  15. const parser = new Parser(options);
  16. return parser.parseFragment(html, fragmentContext);
  17. };
  18. exports.serialize = function(node, options) {
  19. const serializer = new Serializer(node, options);
  20. return serializer.serialize();
  21. };