Skip to content

Commit 9f7e456

Browse files
committed
Remove support for non-HTML doctypes
Related to syntax-tree/hast@2.4.0
1 parent 837fdad commit 9f7e456

File tree

3 files changed

+7
-17
lines changed

3 files changed

+7
-17
lines changed

lib/index.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,12 @@ function root(node, ctx) {
100100
/**
101101
* Create a `doctype`.
102102
*
103-
* @param {HastDoctype} node
103+
* @param {HastDoctype} _
104104
* @param {Context} ctx
105105
* @returns {DocumentType}
106106
*/
107-
function doctype(node, {doc}) {
108-
return doc.implementation.createDocumentType(
109-
node.name || 'html',
110-
node.public || '',
111-
node.system || ''
112-
)
107+
function doctype(_, {doc}) {
108+
return doc.implementation.createDocumentType('html', '', '')
113109
}
114110

115111
/**
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html SYSTEM "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"><html><head></head><body></body></html>
1+
<!DOCTYPE html><html><head></head><body></body></html>

test/index.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,9 @@ test('hast-util-to-dom', (t) => {
165165
)
166166

167167
t.equal(
168-
serializeNodeToHtmlString(
169-
toDom({
170-
type: 'doctype',
171-
name: 'html',
172-
public: null,
173-
system: 'http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd'
174-
})
175-
),
176-
'<!DOCTYPE html SYSTEM "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd">',
168+
// @ts-ignore hast types out of date.
169+
serializeNodeToHtmlString(toDom({type: 'doctype'})),
170+
'<!DOCTYPE html>',
177171
'creates a doctype node'
178172
)
179173

0 commit comments

Comments
 (0)