Skip to content

Commit f5abb1a

Browse files
committed
Remove support for non-HTML doctypes
Related to syntax-tree/[email protected]
1 parent ba41ded commit f5abb1a

File tree

6 files changed

+9
-30
lines changed

6 files changed

+9
-30
lines changed

Diff for: lib/index.js

+4-10
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ function transform(node) {
3939
// @ts-ignore TypeScript is wrong.
4040
return comment(node)
4141
case DOCUMENT_TYPE_NODE:
42-
// @ts-ignore TypeScript is wrong.
43-
return doctype(node)
42+
return doctype()
4443
default:
4544
return null
4645
}
@@ -59,16 +58,11 @@ function root(node) {
5958
/**
6059
* Transform a doctype.
6160
*
62-
* @param {DocumentType} node
6361
* @returns {HastDoctype}
6462
*/
65-
function doctype(node) {
66-
return {
67-
type: 'doctype',
68-
name: node.name || '',
69-
public: node.publicId || null,
70-
system: node.systemId || null
71-
}
63+
function doctype() {
64+
// @ts-ignore hast types out of date.
65+
return {type: 'doctype'}
7266
}
7367

7468
/**

Diff for: test/fixtures/doctype-nameless/index.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
"type": "root",
33
"children": [
44
{
5-
"type": "doctype",
6-
"name": "",
7-
"public": null,
8-
"system": null
5+
"type": "doctype"
96
},
107
{
118
"type": "element",

Diff for: test/fixtures/doctype-quirksmode-ibm/index.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
"type": "root",
33
"children": [
44
{
5-
"type": "doctype",
6-
"name": "html",
7-
"public": null,
8-
"system": "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"
5+
"type": "doctype"
96
},
107
{
118
"type": "element",

Diff for: test/fixtures/doctype/index.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
"type": "root",
33
"children": [
44
{
5-
"type": "doctype",
6-
"name": "html",
7-
"public": null,
8-
"system": null
5+
"type": "doctype"
96
},
107
{
118
"type": "element",

Diff for: test/fixtures/simple/index.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
"type": "root",
33
"children": [
44
{
5-
"type": "doctype",
6-
"name": "html",
7-
"public": null,
8-
"system": null
5+
"type": "doctype"
96
},
107
{
118
"type": "element",

Diff for: test/fixtures/template/index.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
"type": "root",
33
"children": [
44
{
5-
"type": "doctype",
6-
"name": "html",
7-
"public": null,
8-
"system": null
5+
"type": "doctype"
96
},
107
{
118
"type": "element",

0 commit comments

Comments
 (0)