Skip to content

Commit 3eb520f

Browse files
committed
Change doctype to lowercase
Previously, The `DOCTYPE`, `SYSTEM`, and `PUBLIC` parts of the doctype were uppercased, however, since the rest of HTML is typically written lowercase, in my opinion it doesn’t make sense to use uppercase for only this exception where lowercase works perfectly fine.
1 parent 3e56862 commit 3eb520f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/doctype.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = doctype
66
function doctype(ctx, node) {
77
var pub = node.public
88
var sys = node.system
9-
var val = '<!DOCTYPE'
9+
var val = '<!doctype'
1010

1111
if (!node.name) {
1212
return val + '>'
@@ -15,9 +15,9 @@ function doctype(ctx, node) {
1515
val += ' ' + node.name
1616

1717
if (pub != null) {
18-
val += ' PUBLIC ' + smart(pub)
18+
val += ' public ' + smart(pub)
1919
} else if (sys != null) {
20-
val += ' SYSTEM'
20+
val += ' system'
2121
}
2222

2323
if (sys != null) {

test/doctype.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ var to = require('..')
77
test('`text`', function(t) {
88
t.deepEqual(
99
to(u('doctype')),
10-
'<!DOCTYPE>',
10+
'<!doctype>',
1111
'should stringify doctypes without `name`'
1212
)
1313

1414
t.deepEqual(
1515
to(u('doctype', {name: 'html'})),
16-
'<!DOCTYPE html>',
16+
'<!doctype html>',
1717
'should stringify doctypes with `name`'
1818
)
1919

@@ -24,7 +24,7 @@ test('`text`', function(t) {
2424
public: '-//W3C//DTD XHTML 1.0 Transitional//EN'
2525
})
2626
),
27-
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">',
27+
'<!doctype html public "-//W3C//DTD XHTML 1.0 Transitional//EN">',
2828
'should stringify doctypes with a public identifier'
2929
)
3030

@@ -35,7 +35,7 @@ test('`text`', function(t) {
3535
system: 'about:legacy-compat'
3636
})
3737
),
38-
'<!DOCTYPE html SYSTEM "about:legacy-compat">',
38+
'<!doctype html system "about:legacy-compat">',
3939
'should stringify doctypes with a system identifier'
4040
)
4141

@@ -47,7 +47,7 @@ test('`text`', function(t) {
4747
system: 'http://www.w3.org/TR/html4/strict.dtd'
4848
})
4949
),
50-
'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//" "http://www.w3.org/TR/html4/strict.dtd">',
50+
'<!doctype html public "-//W3C//DTD HTML 4.01//" "http://www.w3.org/TR/html4/strict.dtd">',
5151
'should stringify doctypes with both identifiers'
5252
)
5353

@@ -58,7 +58,7 @@ test('`text`', function(t) {
5858
system: 'taco"'
5959
})
6060
),
61-
"<!DOCTYPE html SYSTEM 'taco\"'>",
61+
"<!doctype html system 'taco\"'>",
6262
'should quote smartly'
6363
)
6464

0 commit comments

Comments
 (0)