Skip to content

Commit 3aaf176

Browse files
committed
Merge branch 'release/v0.15.0'
2 parents a04f49b + 4b6cd1e commit 3aaf176

File tree

13 files changed

+67
-38
lines changed

13 files changed

+67
-38
lines changed

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "zeed-dom",
33
"type": "module",
4-
"version": "0.14.0",
4+
"version": "0.15.0",
55
"description": "🌱 Lightweight offline DOM",
66
"author": {
77
"name": "Dirk Holtwick",
@@ -71,17 +71,17 @@
7171
"entities": "^5.0.0"
7272
},
7373
"devDependencies": {
74-
"@antfu/eslint-config": "^3.0.0",
74+
"@antfu/eslint-config": "^3.7.1",
7575
"@antfu/ni": "^0.23.0",
76-
"@types/node": "^22.5.1",
77-
"@vitest/coverage-v8": "^2.0.5",
76+
"@types/node": "^22.5.5",
77+
"@vitest/coverage-v8": "^2.1.1",
7878
"c8": "^10.1.2",
79-
"eslint": "^9.9.1",
80-
"tsup": "^8.2.4",
81-
"typedoc": "^0.26.6",
82-
"typescript": "^5.5.4",
83-
"vite": "^5.4.2",
84-
"vitest": "^2.0.5",
85-
"zeed": "^0.24.13"
79+
"eslint": "^9.11.0",
80+
"tsup": "^8.3.0",
81+
"typedoc": "^0.26.7",
82+
"typescript": "^5.6.2",
83+
"vite": "^5.4.7",
84+
"vitest": "^2.1.1",
85+
"zeed": "^0.24.21"
8686
}
8787
}

src/html.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// 2. Attribute name '__' gets transformed to ':' for namespace emulation
44
// 3. Emulate CDATA by <cdata> element
55

6-
import { hArgumentParser } from './h'
76
import { escapeHTML } from './encoding'
7+
import { hArgumentParser } from './h'
88
import { hasOwn } from './utils'
99

1010
export const SELF_CLOSING_TAGS = [
@@ -43,9 +43,9 @@ export function markup(
4343
const hasChildren = !(
4444
(typeof children === 'string' && children === '')
4545
|| (Array.isArray(children)
46-
&& (children.length === 0
47-
|| (children.length === 1 && children[0] === '')))
48-
|| children == null
46+
&& (children.length === 0
47+
|| (children.length === 1 && children[0] === '')))
48+
|| children == null
4949
)
5050

5151
const parts: string[] = []

src/htmlparser.spec.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { VHTMLDocument } from './vdom'
2-
import { VTextNode, createHTMLDocument } from './vdom'
2+
import { createHTMLDocument, VTextNode } from './vdom'
33
import { parseHTML } from './vdomparser'
44

55
describe('htmlparser', () => {
@@ -64,6 +64,19 @@ height: 100px;">Test</div>`) as VHTMLDocument
6464
`)
6565
})
6666

67+
it('should handle dataset', () => {
68+
const dom = parseHTML(`<div id="elem" data-id="123" data-feel-good="yeah">Test</div>`) as VHTMLDocument
69+
const node = dom.querySelector('#elem')
70+
expect(node).not.toBeNull()
71+
expect(node?.dataset).toMatchInlineSnapshot(`
72+
{
73+
"feel-good": "yeah",
74+
"feelGood": "yeah",
75+
"id": "123",
76+
}
77+
`)
78+
})
79+
6780
it('should ignore escape for script etc.', () => {
6881
const html = `<script>
6982
var x = 1 & 4
@@ -113,7 +126,6 @@ if (x<1)
113126
"_nodeName": "SCRIPT",
114127
"_originalTagName": "script",
115128
"_parentNode": [Circular],
116-
"_styles": null,
117129
"append": [Function],
118130
},
119131
],

src/index.browser.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
export * from './vdom'
2-
export * from './h'
3-
export * from './utils'
4-
5-
export { vdom, parseHTML } from './vdomparser'
61
export { escapeHTML, unescapeHTML } from './encoding'
7-
export { tidyDOM } from './tidy'
2+
export * from './h'
83
export { CDATA, html } from './html'
9-
export { xml } from './xml'
4+
105
export { handleHTML } from './manipulate'
116
export { serializeMarkdown } from './serialize-markdown'
127
export { serializePlaintext } from './serialize-plaintext'
13-
export { serializeSafeHTML, safeHTML } from './serialize-safehtml'
8+
export { safeHTML, serializeSafeHTML } from './serialize-safehtml'
9+
export { tidyDOM } from './tidy'
10+
export * from './utils'
11+
export * from './vdom'
12+
export { parseHTML, vdom } from './vdomparser'
13+
export { xml } from './xml'

src/node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { readFileSync, writeFileSync } from 'node:fs'
21
import type { VHTMLDocument } from './vdom'
2+
import { readFileSync, writeFileSync } from 'node:fs'
33
import { parseHTML } from './vdomparser'
44

55
/** Manipulate HTMl file directly on disk. Only writes back if there were significant changes. */

src/serialize-markdown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { VElement } from './vdom'
2-
import { VNode, isVElement } from './vdom'
2+
import { isVElement, VNode } from './vdom'
33

44
interface SerializeContext {
55
level: number

src/serialize-plaintext.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { SELECTOR_BLOCK_ELEMENTS } from './tidy'
21
import type { VElement } from './vdom'
3-
import { VNode, isVElement } from './vdom'
2+
import { SELECTOR_BLOCK_ELEMENTS } from './tidy'
3+
import { isVElement, VNode } from './vdom'
44

55
interface SerializeContext {
66
level: number

src/serialize-safehtml.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { escapeHTML } from './encoding'
2-
import { VNode, isVElement } from './vdom'
2+
import { isVElement, VNode } from './vdom'
33
import { parseHTML } from './vdomparser'
44

55
export const SELECTOR_BLOCK_ELEMENTS = 'p,h1,h2,h3,h4,h5,h6,blockquote,div,ul,ol,li,article,section,footer,nav,hr,form'

src/vcss.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { parse } from 'css-what'
21
import type { VElement } from './vdom'
2+
import { parse } from 'css-what'
33

44
function log(..._args: any) {}
55

src/vdom.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// import Sizzle from './sizzle'
2-
import { VDocument, VDocumentFragment, VElement, createHTMLDocument, h } from './vdom'
2+
import { createHTMLDocument, h, VDocument, VDocumentFragment, VElement } from './vdom'
33
import { parseHTML } from './vdomparser'
44
import { xml } from './xml'
55

0 commit comments

Comments
 (0)