Skip to content

Commit a5fb5e6

Browse files
committed
Refactor comments
1 parent 2a9de0e commit a5fb5e6

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

index.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = wrapper
1313

1414
var own = {}.hasOwnProperty
1515

16-
/* Handlers. */
16+
// Handlers.
1717
var map = {
1818
'#document': root,
1919
'#document-fragment': root,
@@ -22,7 +22,7 @@ var map = {
2222
'#documentType': doctype
2323
}
2424

25-
/* Wrapper to normalise options. */
25+
// Wrapper to normalise options.
2626
function wrapper(ast, options) {
2727
var settings = options || {}
2828
var file
@@ -42,7 +42,7 @@ function wrapper(ast, options) {
4242
})
4343
}
4444

45-
/* Transform a node. */
45+
// Transform a node.
4646
function transform(ast, config) {
4747
var schema = config.schema
4848
var fn = own.call(map, ast.nodeName) ? map[ast.nodeName] : element
@@ -74,7 +74,7 @@ function transform(ast, config) {
7474
return node
7575
}
7676

77-
/* Transform children. */
77+
// Transform children.
7878
function nodes(children, config) {
7979
var length = children.length
8080
var index = -1
@@ -87,8 +87,8 @@ function nodes(children, config) {
8787
return result
8888
}
8989

90-
/* Transform a document.
91-
* Stores `ast.quirksMode` in `node.data.quirksMode`. */
90+
// Transform a document.
91+
// Stores `ast.quirksMode` in `node.data.quirksMode`.
9292
function root(ast, children, config) {
9393
var node = {type: 'root', children: children, data: {}}
9494
var doc
@@ -111,7 +111,7 @@ function root(ast, children, config) {
111111
return node
112112
}
113113

114-
/* Transform a doctype. */
114+
// Transform a doctype.
115115
function doctype(ast) {
116116
return {
117117
type: 'doctype',
@@ -121,17 +121,17 @@ function doctype(ast) {
121121
}
122122
}
123123

124-
/* Transform a text. */
124+
// Transform a text.
125125
function text(ast) {
126126
return {type: 'text', value: ast.value}
127127
}
128128

129-
/* Transform a comment. */
129+
// Transform a comment.
130130
function comment(ast) {
131131
return {type: 'comment', value: ast.data}
132132
}
133133

134-
/* Transform an element. */
134+
// Transform an element.
135135
function element(ast, children, config) {
136136
var fn = config.schema.space === 'svg' ? s : h
137137
var name = ast.tagName
@@ -169,7 +169,7 @@ function element(ast, children, config) {
169169
return node
170170
}
171171

172-
/* Create clean positional information. */
172+
// Create clean positional information.
173173
function location(node, location, config) {
174174
var schema = config.schema
175175
var verbose = config.verbose
@@ -183,7 +183,8 @@ function location(node, location, config) {
183183
if (node.type === 'element') {
184184
reference = node.children[node.children.length - 1]
185185

186-
/* Unclosed with children (upstream: https://github.com/inikulin/parse5/issues/109) */
186+
// Bug for unclosed with children.
187+
// See: <https://github.com/inikulin/parse5/issues/109>.
187188
if (
188189
!location.endTag &&
189190
reference &&

test/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ test('fixtures', function(t) {
381381
try {
382382
expected = JSON.parse(fs.readFileSync(options.out))
383383
} catch (error) {
384-
/* New fixture. */
384+
// New fixture.
385385
fs.writeFileSync(options.out, JSON.stringify(actual, 0, 2) + '\n')
386386
return
387387
}
@@ -437,7 +437,7 @@ function clean(tree) {
437437
function cleaner(node) {
438438
delete node.position
439439

440-
/* Remove verbose data */
440+
// Remove verbose data.
441441
if (node.type === 'element') {
442442
delete node.data
443443
}

0 commit comments

Comments
 (0)