Skip to content

Commit b6afd5a

Browse files
committed
Remove undocumented support for passing no node
1 parent 1a4f304 commit b6afd5a

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

Diff for: lib/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ import {webNamespaces} from 'web-namespaces'
4040
* Equivalent hast node.
4141
*/
4242
export function fromDom(tree, options) {
43-
const result = tree ? transform(tree, options || {}) : undefined
44-
return result || {type: 'root', children: []}
43+
return transform(tree, options || {}) || {type: 'root', children: []}
4544
}
4645

4746
/**

Diff for: test/index.js

-9
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,6 @@ test('fromDom', async function (t) {
123123
assert.deepEqual(fromDom(frag), {type: 'root', children: []})
124124
})
125125

126-
await t.test('should handle a missing DOM tree', async function () {
127-
assert.deepEqual(
128-
// To do: remove.
129-
// @ts-expect-error runtime.
130-
fromDom(),
131-
{type: 'root', children: []}
132-
)
133-
})
134-
135126
await t.test('should support a text w/o value', async function () {
136127
assert.deepEqual(fromDom(document.createTextNode('')), {
137128
type: 'text',

0 commit comments

Comments
 (0)