Skip to content

Commit 966e63a

Browse files
authored
Merge pull request #6 from ryansolid/allow-dl-nested-div
Allow div as parent of dt, dd
2 parents d7ff1af + 842db0f commit 966e63a

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/mapping.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ const onlyValidParents = {
5353
thead: new Set(['table']),
5454
tr: new Set(['tbody', 'thead', 'tfoot']),
5555
// data list
56-
dd: new Set(['dl']),
57-
dt: new Set(['dl']),
56+
dd: new Set(['dl', 'div']),
57+
dt: new Set(['dl', 'div']),
5858
// other
5959
figcaption: new Set(['figure']),
6060
// li: new Set(["ul", "ol"]),

tests/validation.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,17 @@ describe('SVG', () => {
150150
expect(isValidHTMLNesting('g', 'textarea')).toBe(true);
151151
expect(isValidHTMLNesting('g', 'g')).toBe(true);
152152
});
153+
154+
test('dl', () => {
155+
// valid
156+
expect(isValidHTMLNesting('dl', 'dt')).toBe(true);
157+
expect(isValidHTMLNesting('dl', 'dd')).toBe(true);
158+
expect(isValidHTMLNesting('dl', 'div')).toBe(true);
159+
expect(isValidHTMLNesting('div', 'dt')).toBe(true);
160+
expect(isValidHTMLNesting('div', 'dd')).toBe(true);
161+
162+
// invalid
163+
expect(isValidHTMLNesting('span', 'dt')).toBe(false);
164+
expect(isValidHTMLNesting('span', 'dd')).toBe(false);
165+
});
153166
});

0 commit comments

Comments
 (0)