source: trip-planner-front/node_modules/dom-serializer/README.md@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.1 KB
Line 
1# dom-serializer [![Build Status](https://travis-ci.com/cheeriojs/dom-serializer.svg?branch=master)](https://travis-ci.com/cheeriojs/dom-serializer)
2
3Renders a [domhandler](https://github.com/fb55/domhandler) DOM node or an array of domhandler DOM nodes to a string.
4
5```js
6import render from "dom-serializer";
7
8// OR
9
10const render = require("dom-serializer").default;
11```
12
13# API
14
15## `render`
16
17▸ **render**(`node`: Node \| Node[], `options?`: [_Options_](#Options)): _string_
18
19Renders a DOM node or an array of DOM nodes to a string.
20
21Can be thought of as the equivalent of the `outerHTML` of the passed node(s).
22
23#### Parameters:
24
25| Name | Type | Default value | Description |
26| :-------- | :--------------------------------- | :------------ | :----------------------------- |
27| `node` | Node \| Node[] | - | Node to be rendered. |
28| `options` | [_DomSerializerOptions_](#Options) | {} | Changes serialization behavior |
29
30**Returns:** _string_
31
32## Options
33
34### `decodeEntities`
35
36• `Optional` **decodeEntities**: _boolean_
37
38Encode characters that are either reserved in HTML or XML, or are outside of the ASCII range.
39
40**`default`** true
41
42---
43
44### `emptyAttrs`
45
46• `Optional` **emptyAttrs**: _boolean_
47
48Print an empty attribute's value.
49
50**`default`** xmlMode
51
52**`example`** With <code>emptyAttrs: false</code>: <code>&lt;input checked&gt;</code>
53
54**`example`** With <code>emptyAttrs: true</code>: <code>&lt;input checked=""&gt;</code>
55
56---
57
58### `selfClosingTags`
59
60• `Optional` **selfClosingTags**: _boolean_
61
62Print self-closing tags for tags without contents.
63
64**`default`** xmlMode
65
66**`example`** With <code>selfClosingTags: false</code>: <code>&lt;foo&gt;&lt;/foo&gt;</code>
67
68**`example`** With <code>selfClosingTags: true</code>: <code>&lt;foo /&gt;</code>
69
70---
71
72### `xmlMode`
73
74• `Optional` **xmlMode**: _boolean_ \| _"foreign"_
75
76Treat the input as an XML document; enables the `emptyAttrs` and `selfClosingTags` options.
77
78If the value is `"foreign"`, it will try to correct mixed-case attribute names.
79
80**`default`** false
81
82---
83
84## Ecosystem
85
86| Name | Description |
87| ------------------------------------------------------------- | ------------------------------------------------------- |
88| [htmlparser2](https://github.com/fb55/htmlparser2) | Fast & forgiving HTML/XML parser |
89| [domhandler](https://github.com/fb55/domhandler) | Handler for htmlparser2 that turns documents into a DOM |
90| [domutils](https://github.com/fb55/domutils) | Utilities for working with domhandler's DOM |
91| [css-select](https://github.com/fb55/css-select) | CSS selector engine, compatible with domhandler's DOM |
92| [cheerio](https://github.com/cheeriojs/cheerio) | The jQuery API for domhandler's DOM |
93| [dom-serializer](https://github.com/cheeriojs/dom-serializer) | Serializer for domhandler's DOM |
94
95---
96
97LICENSE: MIT
Note: See TracBrowser for help on using the repository browser.