Last change
on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
697 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | const Parser = require('./parser');
|
---|
| 4 | const Serializer = require('./serializer');
|
---|
| 5 |
|
---|
| 6 | // Shorthands
|
---|
| 7 | exports.parse = function parse(html, options) {
|
---|
| 8 | const parser = new Parser(options);
|
---|
| 9 |
|
---|
| 10 | return parser.parse(html);
|
---|
| 11 | };
|
---|
| 12 |
|
---|
| 13 | exports.parseFragment = function parseFragment(fragmentContext, html, options) {
|
---|
| 14 | if (typeof fragmentContext === 'string') {
|
---|
| 15 | options = html;
|
---|
| 16 | html = fragmentContext;
|
---|
| 17 | fragmentContext = null;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | const parser = new Parser(options);
|
---|
| 21 |
|
---|
| 22 | return parser.parseFragment(html, fragmentContext);
|
---|
| 23 | };
|
---|
| 24 |
|
---|
| 25 | exports.serialize = function(node, options) {
|
---|
| 26 | const serializer = new Serializer(node, options);
|
---|
| 27 |
|
---|
| 28 | return serializer.serialize();
|
---|
| 29 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.