Skip to content

Commit 30841a4

Browse files
committed
better name
1 parent f548bdf commit 30841a4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/svelte/src/html-tree-validation.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
* Map of elements that have certain elements that are not allowed inside them, in the sense that they will auto-close the parent/ancestor element.
33
* Theoretically one could take advantage of it but most of the time it will just result in confusing behavior and break when SSR'd.
44
* There are more elements that are invalid inside other elements, but they're not auto-closed and so don't break SSR and are therefore not listed here.
5-
* @type {Record<string, { direct: string[]} | { descendant: string[]; resets?: string[] }>}
5+
* @type {Record<string, { direct: string[]} | { descendant: string[]; reset_by?: string[] }>}
66
*/
77
const autoclosing_children = {
88
// based on http://developers.whatwg.org/syntax.html#syntax-tag-omission
99
li: { direct: ['li'] },
1010
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dt#technical_summary
11-
dt: { descendant: ['dt', 'dd'], resets: ['dl'] },
12-
dd: { descendant: ['dt', 'dd'], resets: ['dl'] },
11+
dt: { descendant: ['dt', 'dd'], reset_by: ['dl'] },
12+
dd: { descendant: ['dt', 'dd'], reset_by: ['dl'] },
1313
p: {
1414
descendant: [
1515
'address',
@@ -76,7 +76,7 @@ export function closing_tag_omitted(current, next) {
7676
/**
7777
* Map of elements that have certain elements that are not allowed inside them, in the sense that the browser will somehow repair the HTML.
7878
* There are more elements that are invalid inside other elements, but they're not repaired and so don't break SSR and are therefore not listed here.
79-
* @type {Record<string, { direct: string[]} | { descendant: string[]; resets?: string[]; only?: string[] } | { only: string[] }>}
79+
* @type {Record<string, { direct: string[]} | { descendant: string[]; reset_by?: string[]; only?: string[] } | { only: string[] }>}
8080
*/
8181
const disallowed_children = {
8282
...autoclosing_children,
@@ -146,10 +146,10 @@ export function is_tag_valid_with_ancestor(tag, ancestors) {
146146
const disallowed = disallowed_children[target];
147147
if (!disallowed) return true;
148148

149-
if ('resets' in disallowed && disallowed.resets) {
149+
if ('reset_by' in disallowed && disallowed.reset_by) {
150150
for (let i = ancestors.length - 2; i >= 0; i--) {
151151
// A reset means that forbidden descendants are allowed again
152-
if (disallowed.resets.includes(ancestors[i])) {
152+
if (disallowed.reset_by.includes(ancestors[i])) {
153153
return true;
154154
}
155155
}

0 commit comments

Comments
 (0)