Skip to content

Commit 554ba6f

Browse files
committed
Update dev-dependencies
1 parent 6cc98a4 commit 554ba6f

File tree

4 files changed

+88
-85
lines changed

4 files changed

+88
-85
lines changed

Diff for: lib/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ function comment(node) {
172172
*/
173173
function element(node, options) {
174174
const space = node.namespaceURI
175-
const fn = space === webNamespaces.svg ? s : h
175+
const x = space === webNamespaces.svg ? s : h
176176
const tagName =
177177
space === webNamespaces.html ? node.tagName.toLowerCase() : node.tagName
178178
/** @type {DocumentFragment | Element} */
@@ -181,14 +181,14 @@ function element(node, options) {
181181
space === webNamespaces.html && tagName === 'template' ? node.content : node
182182
const attributes = node.getAttributeNames()
183183
/** @type {Record<string, string>} */
184-
const props = {}
184+
const properties = {}
185185
let index = -1
186186

187187
while (++index < attributes.length) {
188-
props[attributes[index]] = node.getAttribute(attributes[index]) || ''
188+
properties[attributes[index]] = node.getAttribute(attributes[index]) || ''
189189
}
190190

191-
return fn(tagName, props, all(content, options))
191+
return x(tagName, properties, all(content, options))
192192
}
193193

194194
/**

Diff for: package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@
3939
},
4040
"devDependencies": {
4141
"@types/jsdom": "^21.0.0",
42-
"@types/node": "^20.0.0",
43-
"c8": "^8.0.0",
44-
"jsdom": "^22.0.0",
42+
"@types/node": "^22.0.0",
43+
"c8": "^10.0.0",
44+
"jsdom": "^25.0.0",
4545
"prettier": "^3.0.0",
46-
"remark-cli": "^11.0.0",
47-
"remark-preset-wooorm": "^9.0.0",
46+
"remark-cli": "^12.0.0",
47+
"remark-preset-wooorm": "^10.0.0",
4848
"type-coverage": "^2.0.0",
4949
"typescript": "^5.0.0",
50-
"xo": "^0.55.0"
50+
"xo": "^0.59.0"
5151
},
5252
"scripts": {
5353
"prepack": "npm run build && npm run format",

Diff for: readme.md

+35-35
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@
1212

1313
## Contents
1414

15-
* [What is this?](#what-is-this)
16-
* [When should I use this?](#when-should-i-use-this)
17-
* [Install](#install)
18-
* [Use](#use)
19-
* [API](#api)
20-
* [`fromDom(tree, options?)`](#fromdomtree-options)
21-
* [`AfterTransform`](#aftertransform)
22-
* [`Options`](#options)
23-
* [Types](#types)
24-
* [Compatibility](#compatibility)
25-
* [Security](#security)
26-
* [Contribute](#contribute)
27-
* [Related](#related)
28-
* [License](#license)
15+
* [What is this?](#what-is-this)
16+
* [When should I use this?](#when-should-i-use-this)
17+
* [Install](#install)
18+
* [Use](#use)
19+
* [API](#api)
20+
* [`fromDom(tree, options?)`](#fromdomtree-options)
21+
* [`AfterTransform`](#aftertransform)
22+
* [`Options`](#options)
23+
* [Types](#types)
24+
* [Compatibility](#compatibility)
25+
* [Security](#security)
26+
* [Contribute](#contribute)
27+
* [Related](#related)
28+
* [License](#license)
2929

3030
## What is this?
3131

@@ -38,9 +38,9 @@ syntax tree.
3838
You can use this project when you want to use hast in browsers.
3939
This package is very small, but it does so by:
4040

41-
* …not providing positional information
42-
* …potentially yielding varying results in different (especially older)
43-
browsers
41+
* …not providing positional information
42+
* …potentially yielding varying results in different (especially older)
43+
browsers
4444

4545
The hast utility [`hast-util-to-dom`][hast-util-to-dom] does the inverse of this
4646
utility.
@@ -110,10 +110,10 @@ Transform a DOM tree to a hast tree.
110110

111111
###### Parameters
112112

113-
* `tree` ([`DomNode`][dom-node])
114-
— DOM tree to transform
115-
* `options` ([`Options`][api-options], optional)
116-
— configuration
113+
* `tree` ([`DomNode`][dom-node])
114+
— DOM tree to transform
115+
* `options` ([`Options`][api-options], optional)
116+
— configuration
117117

118118
###### Returns
119119

@@ -125,10 +125,10 @@ Callback called when each node is transformed (TypeScript type).
125125

126126
###### Parameters
127127

128-
* `domNode` ([`DomNode`][dom-node])
129-
— DOM node that was handled
130-
* `hastNode` ([`HastNode`][hast-node])
131-
— corresponding hast node
128+
* `domNode` ([`DomNode`][dom-node])
129+
— DOM node that was handled
130+
* `hastNode` ([`HastNode`][hast-node])
131+
— corresponding hast node
132132

133133
###### Returns
134134

@@ -140,8 +140,8 @@ Configuration (TypeScript type).
140140

141141
##### Fields
142142

143-
* `afterTransform` ([`AfterTransform`][api-after-transform], optional)
144-
— callback called when each node is transformed
143+
* `afterTransform` ([`AfterTransform`][api-after-transform], optional)
144+
— callback called when each node is transformed
145145

146146
##### Returns
147147

@@ -180,14 +180,14 @@ abide by its terms.
180180

181181
## Related
182182

183-
* [`hast-util-from-html`][hast-util-from-html]
184-
— parse hast from a string of HTML
185-
* [`hast-util-sanitize`](https://github.com/syntax-tree/hast-util-sanitize)
186-
— sanitize hast nodes
187-
* [`hast-util-to-html`](https://github.com/syntax-tree/hast-util-to-html)
188-
— serialize hast as HTML
189-
* [`hast-util-to-dom`](https://github.com/syntax-tree/hast-util-to-dom)
190-
— create DOM trees from hast
183+
* [`hast-util-from-html`][hast-util-from-html]
184+
— parse hast from a string of HTML
185+
* [`hast-util-sanitize`](https://github.com/syntax-tree/hast-util-sanitize)
186+
— sanitize hast nodes
187+
* [`hast-util-to-html`](https://github.com/syntax-tree/hast-util-to-html)
188+
— serialize hast as HTML
189+
* [`hast-util-to-dom`](https://github.com/syntax-tree/hast-util-to-dom)
190+
— create DOM trees from hast
191191

192192
## License
193193

Diff for: test/index.js

+43-40
Original file line numberDiff line numberDiff line change
@@ -22,44 +22,47 @@ test('fromDom', async function (t) {
2222
})
2323

2424
await t.test('should transform a complete document', async function () {
25-
assert.deepEqual(fromDom(doc('<title>Hello!</title><h1>World!')), {
26-
type: 'root',
27-
children: [
28-
{
29-
type: 'element',
30-
tagName: 'html',
31-
properties: {},
32-
children: [
33-
{
34-
type: 'element',
35-
tagName: 'head',
36-
properties: {},
37-
children: [
38-
{
39-
type: 'element',
40-
tagName: 'title',
41-
properties: {},
42-
children: [{type: 'text', value: 'Hello!'}]
43-
}
44-
]
45-
},
46-
{
47-
type: 'element',
48-
tagName: 'body',
49-
properties: {},
50-
children: [
51-
{
52-
type: 'element',
53-
tagName: 'h1',
54-
properties: {},
55-
children: [{type: 'text', value: 'World!'}]
56-
}
57-
]
58-
}
59-
]
60-
}
61-
]
62-
})
25+
assert.deepEqual(
26+
fromDom(parseDocument('<title>Hello!</title><h1>World!')),
27+
{
28+
type: 'root',
29+
children: [
30+
{
31+
type: 'element',
32+
tagName: 'html',
33+
properties: {},
34+
children: [
35+
{
36+
type: 'element',
37+
tagName: 'head',
38+
properties: {},
39+
children: [
40+
{
41+
type: 'element',
42+
tagName: 'title',
43+
properties: {},
44+
children: [{type: 'text', value: 'Hello!'}]
45+
}
46+
]
47+
},
48+
{
49+
type: 'element',
50+
tagName: 'body',
51+
properties: {},
52+
children: [
53+
{
54+
type: 'element',
55+
tagName: 'h1',
56+
properties: {},
57+
children: [{type: 'text', value: 'World!'}]
58+
}
59+
]
60+
}
61+
]
62+
}
63+
]
64+
}
65+
)
6366
})
6467

6568
await t.test('should transform a fragment', async function () {
@@ -192,7 +195,7 @@ test('fixtures', async function (t) {
192195
const treeUrl = new URL(folder + '/index.json', base)
193196
const fixtureUrl = new URL(folder + '/index.html', base)
194197
const input = String(await fs.readFile(fixtureUrl))
195-
const actual = fromDom(doc(input))
198+
const actual = fromDom(parseDocument(input))
196199
/** @type {HastNodes} */
197200
let expected
198201

@@ -237,6 +240,6 @@ function fragment(value) {
237240
* @param {string} value
238241
* @returns {Document}
239242
*/
240-
function doc(value) {
243+
function parseDocument(value) {
241244
return new JSDOM(value).window.document
242245
}

0 commit comments

Comments
 (0)