Skip to content

Commit 81b4123

Browse files
committed
refactor: valid.html
1 parent 2cd3f10 commit 81b4123

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ pnpm-lock.yaml
77
pnpm-workspace.yaml
88
playground/tsconfig-json-load-error/has-error/tsconfig.json
99
playground/html/invalid.html
10+
playground/html/valid.html
1011
playground/worker/classic-worker.js

playground/html/__tests__/html.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,10 @@ describe.runIf(isServe)('invalid', () => {
242242
expect(content).toBeTruthy()
243243
})
244244
})
245+
246+
describe('valid html', () => {
247+
test('duplicated attrs', async () => {
248+
await page.goto(viteTestUrl + '/valid.html')
249+
expect(await getColor('#duplicated-attrs')).toBe('green')
250+
})
251+
})

playground/html/index.html

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,3 @@ <h1>Hello</h1>
88
<link rel="icon" href="{{cdn_host}}/cdn/images/favicon.ico" />
99
<link rel="stylesheet" href="{{cdn_host}}/css.css" type="text/css" />
1010
<script src="{{cdn_host}}/js.js"></script>
11-
12-
<!-- accepted HTML parsing errors, browsers accept these -->
13-
<div foo="a" foo="b">Accept duplicated attribute</div>
14-
15-
<!-- accepted HTML constructs -->
16-
<datalist>
17-
<!-- prettier-ignore -->
18-
<option value="option-without-closing-tag">
19-
</datalist>
20-
</datalist>

playground/html/valid.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!-- accepted HTML parsing errors, browsers accept these -->
2+
<div id="duplicated-attrs" style="color: green;" style="color: red;">Accept duplicated attribute</div>
3+
4+
<!-- accepted HTML constructs -->
5+
<datalist>
6+
<option value="option-without-closing-tag">
7+
</datalist>

playground/html/vite.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ module.exports = {
2626
__dirname,
2727
'unicode-path/中文-にほんご-한글-🌕🌖🌗/index.html'
2828
),
29-
linkProps: resolve(__dirname, 'link-props/index.html')
29+
linkProps: resolve(__dirname, 'link-props/index.html'),
30+
valid: resolve(__dirname, 'valid.html')
3031
}
3132
}
3233
},

0 commit comments

Comments
 (0)