From 1f3d2f7646190213e83936146e16ca2eb2f650b0 Mon Sep 17 00:00:00 2001 From: Yuichiro Yamashita Date: Sun, 26 Feb 2023 23:35:00 +0900 Subject: [PATCH 01/39] fix: better handling of inert attribute (add tests) (#7944) * add inert to attribute_lookup * typed for preventing a repeat of the tragedy * add tests * revert unnecessary change * add more test --------- Co-authored-by: fcrozatier --- .../compile/render_dom/wrappers/Element/Attribute.ts | 7 +++++-- src/shared/boolean_attributes.ts | 8 ++++++-- .../attribute-boolean-indeterminate/_config.js | 4 ---- .../samples/attribute-boolean-inert/_config.js | 11 +++++++++++ .../samples/attribute-boolean-inert/main.svelte | 5 +++++ .../samples/attribute-boolean-itemscope/_config.js | 11 +++++++++++ .../samples/attribute-boolean-itemscope/main.svelte | 5 +++++ 7 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 test/runtime/samples/attribute-boolean-inert/_config.js create mode 100644 test/runtime/samples/attribute-boolean-inert/main.svelte create mode 100644 test/runtime/samples/attribute-boolean-itemscope/_config.js create mode 100644 test/runtime/samples/attribute-boolean-itemscope/main.svelte diff --git a/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts b/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts index 81a1898331..ca35ea84db 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/Attribute.ts @@ -9,7 +9,7 @@ import Text from '../../../nodes/Text'; import handle_select_value_binding from './handle_select_value_binding'; import { Identifier, Node } from 'estree'; import { namespaces } from '../../../../utils/namespaces'; -import { boolean_attributes } from '../../../../../shared/boolean_attributes'; +import { BooleanAttributes, boolean_attributes } from '../../../../../shared/boolean_attributes'; import { regex_double_quotes } from '../../../../utils/patterns'; const non_textlike_input_types = new Set([ @@ -324,7 +324,8 @@ export default class AttributeWrapper extends BaseAttributeWrapper { } // source: https://html.spec.whatwg.org/multipage/indices.html -const attribute_lookup = { +type AttributeMetadata = { property_name?: string, applies_to?: string[] }; +const attribute_lookup: { [key in BooleanAttributes]: AttributeMetadata } & { [key in string]: AttributeMetadata } = { allowfullscreen: { property_name: 'allowFullscreen', applies_to: ['iframe'] }, allowpaymentrequest: { property_name: 'allowPaymentRequest', applies_to: ['iframe'] }, async: { applies_to: ['script'] }, @@ -349,7 +350,9 @@ const attribute_lookup = { formnovalidate: { property_name: 'formNoValidate', applies_to: ['button', 'input'] }, hidden: {}, indeterminate: { applies_to: ['input'] }, + inert: {}, ismap: { property_name: 'isMap', applies_to: ['img'] }, + itemscope: {}, loop: { applies_to: ['audio', 'bgsound', 'video'] }, multiple: { applies_to: ['input', 'select'] }, muted: { applies_to: ['audio', 'video'] }, diff --git a/src/shared/boolean_attributes.ts b/src/shared/boolean_attributes.ts index e29f921e32..f6ec25c6e5 100644 --- a/src/shared/boolean_attributes.ts +++ b/src/shared/boolean_attributes.ts @@ -1,5 +1,5 @@ // source: https://html.spec.whatwg.org/multipage/indices.html -export const boolean_attributes = new Set([ +const _boolean_attributes = [ 'allowfullscreen', 'allowpaymentrequest', 'async', @@ -12,6 +12,7 @@ export const boolean_attributes = new Set([ 'disabled', 'formnovalidate', 'hidden', + 'indeterminate', 'inert', 'ismap', 'itemscope', @@ -26,4 +27,7 @@ export const boolean_attributes = new Set([ 'required', 'reversed', 'selected' -]); +] as const; + +export type BooleanAttributes = typeof _boolean_attributes[number]; +export const boolean_attributes: Set = new Set([..._boolean_attributes]); diff --git a/test/runtime/samples/attribute-boolean-indeterminate/_config.js b/test/runtime/samples/attribute-boolean-indeterminate/_config.js index d6e97ffc0e..aafb0ec164 100644 --- a/test/runtime/samples/attribute-boolean-indeterminate/_config.js +++ b/test/runtime/samples/attribute-boolean-indeterminate/_config.js @@ -1,8 +1,4 @@ export default { - // This is a bit of a funny one — there's no equivalent attribute, - // so it can't be server-rendered - skip_if_ssr: true, - props: { indeterminate: true }, diff --git a/test/runtime/samples/attribute-boolean-inert/_config.js b/test/runtime/samples/attribute-boolean-inert/_config.js new file mode 100644 index 0000000000..8f99b4ebd8 --- /dev/null +++ b/test/runtime/samples/attribute-boolean-inert/_config.js @@ -0,0 +1,11 @@ +export default { + props: { + inert: true + }, + test({ assert, target, component }) { + const div = target.querySelector('div'); + assert.ok(div.inert); + component.inert = false; + assert.ok(!div.inert); + } +}; diff --git a/test/runtime/samples/attribute-boolean-inert/main.svelte b/test/runtime/samples/attribute-boolean-inert/main.svelte new file mode 100644 index 0000000000..6c3df7e31e --- /dev/null +++ b/test/runtime/samples/attribute-boolean-inert/main.svelte @@ -0,0 +1,5 @@ + + +
some div
diff --git a/test/runtime/samples/attribute-boolean-itemscope/_config.js b/test/runtime/samples/attribute-boolean-itemscope/_config.js new file mode 100644 index 0000000000..b5b21cfc47 --- /dev/null +++ b/test/runtime/samples/attribute-boolean-itemscope/_config.js @@ -0,0 +1,11 @@ +export default { + props: { + itemscope: true + }, + test({ assert, target, component }) { + const div = target.querySelector('div'); + assert.ok(div.itemscope); + component.itemscope = false; + assert.ok(!div.itemscope); + } +}; diff --git a/test/runtime/samples/attribute-boolean-itemscope/main.svelte b/test/runtime/samples/attribute-boolean-itemscope/main.svelte new file mode 100644 index 0000000000..83265a983c --- /dev/null +++ b/test/runtime/samples/attribute-boolean-itemscope/main.svelte @@ -0,0 +1,5 @@ + + +
From 79c64df41bfc907d5d65aea6e0add1f3b9441c9d Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Sun, 26 Feb 2023 22:37:15 +0800 Subject: [PATCH 02/39] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4ea2fbe7c..2af04103fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ * Compute node dimensions directly before crossfading ([#4111](https://github.com/sveltejs/svelte/issues/4111)) * Add `readonly` method to convert `writable` store to readonly ([#6518](https://github.com/sveltejs/svelte/pull/6518)) * Ensure `bind:offsetHeight` updates initially ([#4233](https://github.com/sveltejs/svelte/issues/4233)) +* Better handling of `inert` attribute ([#7500](https://github.com/sveltejs/svelte/issues/7500)) ## 3.55.1 From 3423bf6b307d11a44f6a9a71f988e32e198a360e Mon Sep 17 00:00:00 2001 From: Yuichiro Yamashita Date: Sun, 26 Feb 2023 23:40:36 +0900 Subject: [PATCH 03/39] add docs (#8326) --- site/content/docs/03-template-syntax.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/site/content/docs/03-template-syntax.md b/site/content/docs/03-template-syntax.md index f0bbf67dea..419489211c 100644 --- a/site/content/docs/03-template-syntax.md +++ b/site/content/docs/03-template-syntax.md @@ -1517,6 +1517,8 @@ The content is exposed in the child component using the `` element, which ``` +Note: If you want to render regular `` element, You can use ``. + #### `` --- From 636290af954a2b37a263b35c6deb69f149b59905 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Mon, 27 Feb 2023 11:33:45 +0100 Subject: [PATCH 04/39] fix: remove indeterminate from boolean attributes (#8334) It's only existing as a boolean property cleanup of #7944 --- src/shared/boolean_attributes.ts | 7 +++++-- .../samples/attribute-boolean-indeterminate/_config.js | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/shared/boolean_attributes.ts b/src/shared/boolean_attributes.ts index f6ec25c6e5..668dd97975 100644 --- a/src/shared/boolean_attributes.ts +++ b/src/shared/boolean_attributes.ts @@ -1,4 +1,3 @@ -// source: https://html.spec.whatwg.org/multipage/indices.html const _boolean_attributes = [ 'allowfullscreen', 'allowpaymentrequest', @@ -12,7 +11,6 @@ const _boolean_attributes = [ 'disabled', 'formnovalidate', 'hidden', - 'indeterminate', 'inert', 'ismap', 'itemscope', @@ -30,4 +28,9 @@ const _boolean_attributes = [ ] as const; export type BooleanAttributes = typeof _boolean_attributes[number]; + +/** + * List of HTML boolean attributes (e.g. ``). + * Source: https://html.spec.whatwg.org/multipage/indices.html + */ export const boolean_attributes: Set = new Set([..._boolean_attributes]); diff --git a/test/runtime/samples/attribute-boolean-indeterminate/_config.js b/test/runtime/samples/attribute-boolean-indeterminate/_config.js index aafb0ec164..5853e76922 100644 --- a/test/runtime/samples/attribute-boolean-indeterminate/_config.js +++ b/test/runtime/samples/attribute-boolean-indeterminate/_config.js @@ -1,14 +1,14 @@ export default { + // This is a bit of a funny one — there's no equivalent attribute, + // so it can't be server-rendered + skip_if_ssr: true, + props: { indeterminate: true }, html: "", - // somehow ssr will render indeterminate="" - // the hydrated html will still contain that attribute - ssrHtml: "", - test({ assert, component, target }) { const input = target.querySelector('input'); From 5f99ae76ce4ad1b1be2a08a19a93a44178720523 Mon Sep 17 00:00:00 2001 From: Yuichiro Yamashita Date: Mon, 27 Feb 2023 19:40:24 +0900 Subject: [PATCH 05/39] chore: Reduce number of lines of expected files (#8325) - removes character and pos from the expected output to reduce noise - adds a test that pos/character are correct --- test/validator/index.ts | 77 ++++++-- .../samples/a11y-alt-text/warnings.json | 39 ++-- .../a11y-anchor-has-content/warnings.json | 11 +- .../a11y-anchor-in-svg-is-valid/warnings.json | 27 +-- .../a11y-anchor-is-valid/warnings.json | 54 ++---- .../a11y-aria-activedescendant/warnings.json | 3 - .../samples/a11y-aria-props/warnings.json | 19 +- .../a11y-aria-proptypes-boolean/warnings.json | 20 +- .../a11y-aria-proptypes-integer/warnings.json | 29 +-- .../a11y-aria-proptypes-number/warnings.json | 83 ++++---- .../a11y-aria-proptypes-string/warnings.json | 29 ++- .../a11y-aria-proptypes-token/warnings.json | 38 ++-- .../warnings.json | 47 ++--- .../warnings.json | 20 +- .../samples/a11y-aria-role/warnings.json | 18 +- .../warnings.json | 19 +- .../warnings.json | 63 +++---- .../errors.json | 9 +- .../a11y-figcaption-wrong-place/warnings.json | 18 +- .../a11y-heading-has-content/warnings.json | 19 +- .../samples/a11y-html-has-lang/warnings.json | 9 +- .../a11y-iframe-has-title/warnings.json | 9 +- .../a11y-img-redundant-alt/warnings.json | 17 +- .../warnings.json | 6 - .../a11y-media-has-caption/warnings.json | 12 -- .../input.svelte | 2 +- .../warnings.json | 14 +- .../a11y-no-abstract-roles/warnings.json | 36 ---- .../samples/a11y-no-access-key/warnings.json | 11 +- .../samples/a11y-no-autofocus/warnings.json | 11 +- .../warnings.json | 19 +- .../warnings.json | 177 ------------------ .../warnings.json | 12 -- .../a11y-no-redundant-roles/warnings.json | 126 ------------- .../a11y-not-on-components/warnings.json | 9 +- .../warnings.json | 32 +--- .../samples/a11y-scope/warnings.json | 9 +- .../a11y-tabindex-no-positive/warnings.json | 9 +- .../samples/action-invalid/warnings.json | 9 +- .../samples/action-object/input.svelte | 4 +- .../samples/action-object/warnings.json | 3 - .../samples/action-on-component/errors.json | 9 +- .../samples/animation-duplicate/errors.json | 11 +- .../samples/animation-missing/warnings.json | 11 +- .../samples/animation-not-in-each/errors.json | 9 +- .../animation-not-in-keyed-each/errors.json | 9 +- .../samples/animation-siblings/errors.json | 9 +- .../samples/assignment-to-const-2/errors.json | 11 +- .../samples/assignment-to-const-3/errors.json | 11 +- .../samples/assignment-to-const-4/errors.json | 11 +- .../samples/assignment-to-const/errors.json | 11 +- .../attribute-expected-equals/errors.json | 9 +- .../attribute-invalid-name-2/errors.json | 9 +- .../attribute-invalid-name-3/errors.json | 9 +- .../attribute-invalid-name-4/errors.json | 9 +- .../attribute-invalid-name-5/errors.json | 9 +- .../attribute-invalid-name/errors.json | 9 +- .../samples/binding-await-catch/errors.json | 5 +- .../samples/binding-await-then-2/errors.json | 5 +- .../samples/binding-await-then/errors.json | 5 +- .../samples/binding-const/errors.json | 9 +- .../binding-dimensions-svg-child/errors.json | 9 +- .../binding-dimensions-svg/errors.json | 9 +- .../binding-dimensions-void/errors.json | 9 +- .../samples/binding-input-checked/errors.json | 11 +- .../binding-input-type-boolean/errors.json | 11 +- .../binding-input-type-dynamic/errors.json | 11 +- .../errors.json | 7 +- .../binding-invalid-on-element/errors.json | 9 +- .../binding-invalid-value-global/errors.json | 7 +- .../samples/binding-invalid-value/errors.json | 9 +- .../samples/binding-invalid/errors.json | 9 +- .../validator/samples/binding-let/errors.json | 9 +- .../errors.json | 11 +- .../samples/component-dynamic/warnings.json | 9 - .../errors.json | 9 +- .../errors.json | 5 +- .../component-name-lowercase/warnings.json | 3 - .../errors.json | 5 +- .../errors.json | 11 +- .../errors.json | 11 +- .../component-slot-dynamic/errors.json | 11 +- .../errors.json | 5 +- .../errors.json | 5 +- .../component-slotted-each-block/errors.json | 11 +- .../component-slotted-if-block/errors.json | 11 +- .../samples/const-tag-conflict-1/errors.json | 5 +- .../samples/const-tag-conflict-2/errors.json | 5 +- .../samples/const-tag-cyclical/errors.json | 5 +- .../const-tag-out-of-scope/warnings.json | 3 - .../samples/const-tag-placement-1/errors.json | 5 +- .../samples/const-tag-placement-2/errors.json | 5 +- .../samples/const-tag-readonly-1/errors.json | 5 +- .../samples/const-tag-readonly-2/errors.json | 5 +- .../contenteditable-dynamic/errors.json | 11 +- .../contenteditable-missing/errors.json | 11 +- .../errors.json | 5 +- .../errors.json | 5 +- .../errors.json | 5 +- .../errors.json | 5 +- .../errors.json | 9 +- .../errors.json | 9 +- .../css-invalid-global-placement/errors.json | 11 +- .../css-invalid-global-selector-2/errors.json | 9 +- .../css-invalid-global-selector-3/errors.json | 9 +- .../css-invalid-global-selector-4/errors.json | 9 +- .../css-invalid-global-selector-5/errors.json | 9 +- .../css-invalid-global-selector-6/errors.json | 9 +- .../css-invalid-global-selector/errors.json | 9 +- .../samples/debug-invalid-args/errors.json | 11 +- .../errors.json | 7 +- .../errors.json | 7 +- .../samples/default-export/errors.json | 7 +- .../directive-non-expression/errors.json | 9 +- .../errors.json | 9 +- .../errors.json | 9 +- .../dollar-global-in-markup/errors.json | 9 +- .../dollar-global-in-script/errors.json | 9 +- .../dynamic-element-invalid-tag/errors.json | 9 +- .../dynamic-element-missing-tag/errors.json | 9 +- .../samples/dynamic-element-this/errors.json | 9 +- .../errors.json | 7 +- .../errors.json | 9 +- .../errors.json | 11 +- .../each-block-invalid-context/errors.json | 11 +- .../samples/empty-block/warnings.json | 20 +- .../samples/error-mode-warn/warnings.json | 15 +- .../errors.json | 9 +- .../errors.json | 9 +- .../event-modifiers-invalid/errors.json | 9 +- .../event-modifiers-legacy/errors.json | 9 +- .../event-modifiers-redundant/warnings.json | 18 +- .../html-block-in-attribute/errors.json | 5 +- .../html-block-in-textarea/errors.json | 5 +- .../samples/ignore-warning/warnings.json | 8 +- .../ignore-warnings-cumulative/warnings.json | 5 +- .../ignore-warnings-newline/warnings.json | 5 +- .../ignore-warnings-stacked/warnings.json | 5 +- .../samples/ignore-warnings/warnings.json | 5 +- .../illegal-variable-declaration/errors.json | 9 +- .../invalid-empty-css-declaration/errors.json | 12 +- .../logic-block-in-attribute/errors.json | 5 +- .../logic-block-in-textarea/errors.json | 5 +- .../missing-component-global/warnings.json | 11 +- .../samples/missing-component/warnings.json | 11 +- .../warnings.json | 3 - .../warnings.json | 5 +- .../errors.json | 9 +- .../errors.json | 9 +- .../namespace-invalid-unguessable/errors.json | 7 +- .../samples/namespace-invalid/errors.json | 7 +- .../samples/namespace-non-literal/errors.json | 7 +- .../reactive-declaration-cyclical/errors.json | 5 +- .../warnings.json | 5 +- .../reactive-module-variable/warnings.json | 3 - .../ref-not-supported-in-css/errors.json | 9 +- .../samples/ref-not-supported/errors.json | 9 +- .../rest-eachblock-binding-2/warnings.json | 5 +- .../rest-eachblock-binding-3/warnings.json | 5 +- .../rest-eachblock-binding/warnings.json | 5 +- .../script-invalid-context/errors.json | 9 +- .../warnings.json | 54 ------ .../slot-attribute-invalid/errors.json | 9 +- .../samples/slot-warning/warnings.json | 5 +- .../samples/slot-warning2/warnings.json | 5 +- .../errors.json | 9 +- .../svelte-fragment-placement-2/errors.json | 5 +- .../svelte-fragment-placement/errors.json | 5 +- .../warnings.json | 27 ++- .../validator/samples/tag-invalid/errors.json | 9 +- .../samples/tag-non-string/errors.json | 9 +- .../textarea-value-children/errors.json | 11 +- .../samples/title-no-attributes/errors.json | 11 +- .../samples/title-no-children/errors.json | 11 +- .../errors.json | 11 +- .../transition-duplicate-in/errors.json | 11 +- .../errors.json | 11 +- .../transition-duplicate-out/errors.json | 11 +- .../errors.json | 11 +- .../errors.json | 11 +- .../errors.json | 11 +- .../samples/transition-missing/warnings.json | 11 +- .../transition-on-component/errors.json | 11 +- .../undefined-value-global/warnings.json | 7 +- .../samples/undefined-value/warnings.json | 9 +- .../unreferenced-variables-each/warnings.json | 6 - .../unreferenced-variables/warnings.json | 15 -- .../samples/use-the-platform/warnings.json | 6 - .../errors.json | 11 +- .../window-binding-invalid-value/errors.json | 11 +- .../window-binding-invalid-width/errors.json | 11 +- .../window-binding-invalid/errors.json | 11 +- 192 files changed, 743 insertions(+), 1775 deletions(-) diff --git a/test/validator/index.ts b/test/validator/index.ts index e58be87a3a..fce5ed7065 100644 --- a/test/validator/index.ts +++ b/test/validator/index.ts @@ -33,13 +33,15 @@ describe('validate', () => { ...options }); - assert.deepEqual(warnings.map(w => ({ - code: w.code, - message: w.message, - pos: w.pos, - start: w.start, - end: w.end - })), expected_warnings); + assert.deepEqual( + warnings.map((w) => ({ + code: w.code, + message: w.message, + start: { line: w.start.line, column: w.start.column }, + end: { line: w.end.line, column: w.end.column } + })), + expected_warnings + ); } catch (e) { error = e; } @@ -56,13 +58,17 @@ describe('validate', () => { } try { - assert.equal(error.code, expected.code); - assert.equal(error.message, expected.message); - assert.deepEqual(error.start, expected.start); - assert.deepEqual(error.end, expected.end); - assert.equal(error.pos, expected.pos); + assert.deepEqual( + { + code: error.code, + message: error.message, + start: { line: error.start.line, column: error.start.column }, + end: { line: error.end.line, column: error.end.column } + }, + expected + ); } catch (e) { - console.error(error); // eslint-disable-line no-console + console.error(error); throw e; } } @@ -78,6 +84,51 @@ describe('validate', () => { }, /options\.name must be a valid identifier/); }); + it('check warning position', () => { + const { warnings } = svelte.compile('\n \n', { + generate: false + }); + + assert.deepEqual( + warnings.map((w) => { + return { + code: w.code, + frame: w.frame, + message: w.message, + start: { + character: w.start.character, + column: w.start.column, + line: w.start.line + }, + end: { + character: w.end.character, + column: w.end.column, + line: w.end.line + }, + pos: w.pos + }; + }), + [ + { + code: 'a11y-missing-attribute', + frame: '1: \n2: \n4: ', + message: 'A11y: element should have an alt attribute', + start: { + character: 3, + column: 2, + line: 2 + }, + end: { + character: 24, + column: 15, + line: 3 + }, + pos: 3 + } + ] + ); + }); + it('warns if options.name is not capitalised', () => { const { warnings } = svelte.compile('
', { name: 'lowercase', diff --git a/test/validator/samples/a11y-alt-text/warnings.json b/test/validator/samples/a11y-alt-text/warnings.json index 7ce5fb2d8f..904288c45c 100644 --- a/test/validator/samples/a11y-alt-text/warnings.json +++ b/test/validator/samples/a11y-alt-text/warnings.json @@ -4,62 +4,47 @@ "message": "A11y: element should have an alt attribute", "start": { "line": 1, - "column": 0, - "character": 0 + "column": 0 }, "end": { "line": 1, - "column": 19, - "character": 19 - }, - "pos": 0 + "column": 19 + } }, - { "code": "a11y-missing-attribute", "message": "A11y: element should have an alt, aria-label or aria-labelledby attribute", "start": { "line": 4, - "column": 1, - "character": 28 + "column": 1 }, "end": { "line": 4, - "column": 7, - "character": 34 - }, - "pos": 28 + "column": 7 + } }, - { "code": "a11y-missing-attribute", "message": "A11y: element should have a title, aria-label or aria-labelledby attribute", "start": { "line": 7, - "column": 0, - "character": 43 + "column": 0 }, "end": { "line": 7, - "column": 17, - "character": 60 - }, - "pos": 43 + "column": 17 + } }, - { "code": "a11y-missing-attribute", "message": "A11y: element should have an alt, aria-label or aria-labelledby attribute", "start": { "line": 9, - "column": 0, - "character": 62 + "column": 0 }, "end": { "line": 9, - "column": 20, - "character": 82 - }, - "pos": 62 + "column": 20 + } } ] diff --git a/test/validator/samples/a11y-anchor-has-content/warnings.json b/test/validator/samples/a11y-anchor-has-content/warnings.json index 8708311f3c..e5e0a5a48c 100644 --- a/test/validator/samples/a11y-anchor-has-content/warnings.json +++ b/test/validator/samples/a11y-anchor-has-content/warnings.json @@ -3,13 +3,10 @@ "message": "A11y: element should have child content", "start": { "line": 1, - "column": 0, - "character": 0 + "column": 0 }, "end": { "line": 1, - "column": 19, - "character": 19 - }, - "pos": 0 -}] \ No newline at end of file + "column": 19 + } +}] diff --git a/test/validator/samples/a11y-anchor-in-svg-is-valid/warnings.json b/test/validator/samples/a11y-anchor-in-svg-is-valid/warnings.json index eb62ce8db6..0ca16767d7 100644 --- a/test/validator/samples/a11y-anchor-in-svg-is-valid/warnings.json +++ b/test/validator/samples/a11y-anchor-in-svg-is-valid/warnings.json @@ -4,44 +4,35 @@ "message": "A11y: element should have an href attribute", "start": { "line": 1, - "column": 11, - "character": 11 + "column": 11 }, "end": { "line": 1, - "column": 37, - "character": 37 - }, - "pos": 11 + "column": 37 + } }, { "code": "a11y-invalid-attribute", "message": "A11y: '' is not a valid xlink:href attribute", "start": { "line": 2, - "column": 14, - "character": 65 + "column": 14 }, "end": { "line": 2, - "column": 27, - "character": 78 - }, - "pos": 65 + "column": 27 + } }, { "code": "a11y-invalid-attribute", "message": "A11y: '#' is not a valid xlink:href attribute", "start": { "line": 3, - "column": 14, - "character": 130 + "column": 14 }, "end": { "line": 3, - "column": 28, - "character": 144 - }, - "pos": 130 + "column": 28 + } } ] diff --git a/test/validator/samples/a11y-anchor-is-valid/warnings.json b/test/validator/samples/a11y-anchor-is-valid/warnings.json index f04c6f1593..50d19ae630 100644 --- a/test/validator/samples/a11y-anchor-is-valid/warnings.json +++ b/test/validator/samples/a11y-anchor-is-valid/warnings.json @@ -4,89 +4,71 @@ "message": "A11y: element should have an href attribute", "start": { "line": 1, - "column": 0, - "character": 0 + "column": 0 }, "end": { "line": 1, - "column": 26, - "character": 26 - }, - "pos": 0 + "column": 26 + } }, { "code": "a11y-invalid-attribute", "message": "A11y: '' is not a valid href attribute", "start": { "line": 2, - "column": 3, - "character": 30 + "column": 3 }, "end": { "line": 2, - "column": 10, - "character": 37 - }, - "pos": 30 + "column": 10 + } }, { "code": "a11y-invalid-attribute", "message": "A11y: '#' is not a valid href attribute", "start": { "line": 3, - "column": 3, - "character": 53 + "column": 3 }, "end": { "line": 3, - "column": 11, - "character": 61 - }, - "pos": 53 + "column": 11 + } }, { "code": "a11y-invalid-attribute", "message": "A11y: 'javascript:void(0)' is not a valid href attribute", "start": { "line": 4, - "column": 3, - "character": 77 + "column": 3 }, "end": { "line": 4, - "column": 28, - "character": 102 - }, - "pos": 77 + "column": 28 + } }, { "code": "a11y-missing-attribute", "message": "A11y: element should have an href attribute", "start": { "line": 5, - "column": 0, - "character": 115 + "column": 0 }, "end": { "line": 5, - "column": 22, - "character": 137 - }, - "pos": 115 + "column": 22 + } }, { "code": "a11y-missing-attribute", "message": "A11y: element should have an href attribute", "start": { "line": 6, - "column": 0, - "character": 138 + "column": 0 }, "end": { "line": 6, - "column": 20, - "character": 158 - }, - "pos": 138 + "column": 20 + } } ] diff --git a/test/validator/samples/a11y-aria-activedescendant/warnings.json b/test/validator/samples/a11y-aria-activedescendant/warnings.json index 8749c1c125..57288f188f 100644 --- a/test/validator/samples/a11y-aria-activedescendant/warnings.json +++ b/test/validator/samples/a11y-aria-activedescendant/warnings.json @@ -2,14 +2,11 @@ { "code": "a11y-aria-activedescendant-has-tabindex", "end": { - "character": 568, "column": 36, "line": 16 }, "message": "A11y: Elements with attribute aria-activedescendant should have tabindex value", - "pos": 537, "start": { - "character": 537, "column": 5, "line": 16 } diff --git a/test/validator/samples/a11y-aria-props/warnings.json b/test/validator/samples/a11y-aria-props/warnings.json index 73d34fc589..f357429f62 100644 --- a/test/validator/samples/a11y-aria-props/warnings.json +++ b/test/validator/samples/a11y-aria-props/warnings.json @@ -4,30 +4,23 @@ "message": "A11y: Unknown aria attribute 'aria-labeledby' (did you mean 'labelledby'?)", "start": { "line": 1, - "column": 20, - "character": 20 + "column": 20 }, "end": { "line": 1, - "column": 40, - "character": 40 - }, - "pos": 20 + "column": 40 + } }, - { "code": "a11y-missing-attribute", "message": "A11y: element should have an alt, aria-label or aria-labelledby attribute", "start": { "column": 0, - "line": 1, - "character": 0 + "line": 1 }, "end": { "line": 1, - "column": 41, - "character": 41 - }, - "pos": 0 + "column": 41 + } } ] diff --git a/test/validator/samples/a11y-aria-proptypes-boolean/warnings.json b/test/validator/samples/a11y-aria-proptypes-boolean/warnings.json index b43697b64d..eadd4314bb 100644 --- a/test/validator/samples/a11y-aria-proptypes-boolean/warnings.json +++ b/test/validator/samples/a11y-aria-proptypes-boolean/warnings.json @@ -4,29 +4,23 @@ "message": "A11y: The value of 'aria-disabled' must be exactly one of true or false", "start": { "line": 5, - "column": 8, - "character": 51 + "column": 8 }, "end": { "line": 5, - "column": 27, - "character": 70 - }, - "pos": 51 + "column": 27 + } }, { "code": "a11y-incorrect-aria-attribute-type", "message": "A11y: The value of 'aria-disabled' must be exactly one of true or false", "start": { "line": 6, - "column": 8, - "character": 81 + "column": 8 }, "end": { "line": 6, - "column": 26, - "character": 99 - }, - "pos": 81 + "column": 26 + } } -] \ No newline at end of file +] diff --git a/test/validator/samples/a11y-aria-proptypes-integer/warnings.json b/test/validator/samples/a11y-aria-proptypes-integer/warnings.json index e4c37df493..f894174368 100644 --- a/test/validator/samples/a11y-aria-proptypes-integer/warnings.json +++ b/test/validator/samples/a11y-aria-proptypes-integer/warnings.json @@ -4,44 +4,35 @@ "message": "A11y: The value of 'aria-level' must be of type integer", "start": { "line": 1, - "column": 5, - "character": 5 + "column": 5 }, "end": { "line": 1, - "column": 21, - "character": 21 - }, - "pos": 5 + "column": 21 + } }, { "code": "a11y-incorrect-aria-attribute-type", "message": "A11y: The value of 'aria-level' must be of type integer", "start": { "line": 2, - "column": 5, - "character": 30 + "column": 5 }, "end": { "line": 2, - "column": 20, - "character": 45 - }, - "pos": 30 + "column": 20 + } }, { "code": "a11y-incorrect-aria-attribute-type", "message": "A11y: The value of 'aria-level' must be of type integer", "start": { "line": 5, - "column": 5, - "character": 107 + "column": 5 }, "end": { "line": 5, - "column": 15, - "character": 117 - }, - "pos": 107 + "column": 15 + } } -] \ No newline at end of file +] diff --git a/test/validator/samples/a11y-aria-proptypes-number/warnings.json b/test/validator/samples/a11y-aria-proptypes-number/warnings.json index 93c64cb97b..e28a43df37 100644 --- a/test/validator/samples/a11y-aria-proptypes-number/warnings.json +++ b/test/validator/samples/a11y-aria-proptypes-number/warnings.json @@ -1,47 +1,38 @@ [ - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-valuemax' must be of type number", - "start": { - "line": 1, - "column": 5, - "character": 5 - }, - "end": { - "line": 1, - "column": 24, - "character": 24 - }, - "pos": 5 - }, - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-valuemax' must be of type number", - "start": { - "line": 2, - "column": 5, - "character": 33 - }, - "end": { - "line": 2, - "column": 23, - "character": 51 - }, - "pos": 33 - }, - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-valuemax' must be of type number", - "start": { - "line": 5, - "column": 5, - "character": 119 - }, - "end": { - "line": 5, - "column": 18, - "character": 132 - }, - "pos": 119 - } -] \ No newline at end of file + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-valuemax' must be of type number", + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 24 + } + }, + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-valuemax' must be of type number", + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 23 + } + }, + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-valuemax' must be of type number", + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 18 + } + } +] diff --git a/test/validator/samples/a11y-aria-proptypes-string/warnings.json b/test/validator/samples/a11y-aria-proptypes-string/warnings.json index f83eb895a4..2dd8f2509f 100644 --- a/test/validator/samples/a11y-aria-proptypes-string/warnings.json +++ b/test/validator/samples/a11y-aria-proptypes-string/warnings.json @@ -1,17 +1,14 @@ [ - { - "code": "a11y-incorrect-aria-attribute-type", - "message": "A11y: The value of 'aria-label' must be of type string", - "start": { - "line": 1, - "column": 5, - "character": 5 - }, - "end": { - "line": 1, - "column": 15, - "character": 15 - }, - "pos": 5 - } -] \ No newline at end of file + { + "code": "a11y-incorrect-aria-attribute-type", + "message": "A11y: The value of 'aria-label' must be of type string", + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + } +] diff --git a/test/validator/samples/a11y-aria-proptypes-token/warnings.json b/test/validator/samples/a11y-aria-proptypes-token/warnings.json index 168fc70434..b07838dde4 100644 --- a/test/validator/samples/a11y-aria-proptypes-token/warnings.json +++ b/test/validator/samples/a11y-aria-proptypes-token/warnings.json @@ -4,59 +4,47 @@ "message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", "start": { "line": 1, - "column": 5, - "character": 5 + "column": 5 }, "end": { "line": 1, - "column": 17, - "character": 17 - }, - "pos": 5 + "column": 17 + } }, { "code": "a11y-incorrect-aria-attribute-type", "message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", "start": { "line": 2, - "column": 5, - "character": 26 + "column": 5 }, "end": { "line": 2, - "column": 26, - "character": 47 - }, - "pos": 26 + "column": 26 + } }, { "code": "a11y-incorrect-aria-attribute-type", "message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", "start": { "line": 3, - "column": 5, - "character": 56 + "column": 5 }, "end": { "line": 3, - "column": 14, - "character": 65 - }, - "pos": 56 + "column": 14 + } }, { "code": "a11y-incorrect-aria-attribute-type", "message": "A11y: The value of 'aria-sort' must be exactly one of ascending, descending, none, other", "start": { "line": 6, - "column": 5, - "character": 127 + "column": 5 }, "end": { "line": 6, - "column": 37, - "character": 159 - }, - "pos": 127 + "column": 37 + } } -] \ No newline at end of file +] diff --git a/test/validator/samples/a11y-aria-proptypes-tokenlist/warnings.json b/test/validator/samples/a11y-aria-proptypes-tokenlist/warnings.json index 959f1821a5..43159dafcd 100644 --- a/test/validator/samples/a11y-aria-proptypes-tokenlist/warnings.json +++ b/test/validator/samples/a11y-aria-proptypes-tokenlist/warnings.json @@ -4,74 +4,59 @@ "message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text", "start": { "line": 1, - "column": 5, - "character": 5 + "column": 5 }, "end": { "line": 1, - "column": 21, - "character": 21 - }, - "pos": 5 + "column": 21 + } }, { "code": "a11y-incorrect-aria-attribute-type", "message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text", "start": { "line": 2, - "column": 5, - "character": 30 + "column": 5 }, "end": { "line": 2, - "column": 27, - "character": 52 - }, - "pos": 30 + "column": 27 + } }, { "code": "a11y-incorrect-aria-attribute-type", "message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text", "start": { "line": 3, - "column": 5, - "character": 61 + "column": 5 }, "end": { "line": 3, - "column": 18, - "character": 74 - }, - "pos": 61 + "column": 18 + } }, { "code": "a11y-incorrect-aria-attribute-type", "message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text", "start": { "line": 6, - "column": 5, - "character": 144 + "column": 5 }, "end": { "line": 6, - "column": 40, - "character": 179 - }, - "pos": 144 + "column": 40 + } }, { "code": "a11y-incorrect-aria-attribute-type", "message": "A11y: The value of 'aria-relevant' must be a space-separated list of one or more of additions, all, removals, text", "start": { "line": 7, - "column": 5, - "character": 188 + "column": 5 }, "end": { "line": 7, - "column": 41, - "character": 224 - }, - "pos": 188 + "column": 41 + } } -] \ No newline at end of file +] diff --git a/test/validator/samples/a11y-aria-proptypes-tristate/warnings.json b/test/validator/samples/a11y-aria-proptypes-tristate/warnings.json index a8ff8fd3a1..3711efa22b 100644 --- a/test/validator/samples/a11y-aria-proptypes-tristate/warnings.json +++ b/test/validator/samples/a11y-aria-proptypes-tristate/warnings.json @@ -4,29 +4,23 @@ "message": "A11y: The value of 'aria-checked' must be exactly one of true, false, or mixed", "start": { "line": 5, - "column": 5, - "character": 48 + "column": 5 }, "end": { "line": 5, - "column": 23, - "character": 66 - }, - "pos": 48 + "column": 23 + } }, { "code": "a11y-incorrect-aria-attribute-type", "message": "A11y: The value of 'aria-checked' must be exactly one of true, false, or mixed", "start": { "line": 6, - "column": 5, - "character": 75 + "column": 5 }, "end": { "line": 6, - "column": 22, - "character": 92 - }, - "pos": 75 + "column": 22 + } } -] \ No newline at end of file +] diff --git a/test/validator/samples/a11y-aria-role/warnings.json b/test/validator/samples/a11y-aria-role/warnings.json index 2943f232f8..49581ac003 100644 --- a/test/validator/samples/a11y-aria-role/warnings.json +++ b/test/validator/samples/a11y-aria-role/warnings.json @@ -4,29 +4,23 @@ "message": "A11y: Unknown role 'toooltip' (did you mean 'tooltip'?)", "start": { "line": 6, - "column": 5, - "character": 101 + "column": 5 }, "end": { "line": 6, - "column": 20, - "character": 116 - }, - "pos": 101 + "column": 20 + } }, { "code": "a11y-unknown-role", "message": "A11y: Unknown role 'toooltip' (did you mean 'tooltip'?)", "start": { "line": 7, - "column": 5, - "character": 129 + "column": 5 }, "end": { "line": 7, - "column": 27, - "character": 151 - }, - "pos": 129 + "column": 27 + } } ] diff --git a/test/validator/samples/a11y-aria-unsupported-element/warnings.json b/test/validator/samples/a11y-aria-unsupported-element/warnings.json index 4597e3e868..04891378b0 100644 --- a/test/validator/samples/a11y-aria-unsupported-element/warnings.json +++ b/test/validator/samples/a11y-aria-unsupported-element/warnings.json @@ -4,30 +4,23 @@ "message": "A11y: should not have aria-* attributes", "start": { "line": 1, - "column": 6, - "character": 6 + "column": 6 }, "end": { "line": 1, - "column": 25, - "character": 25 - }, - "pos": 6 + "column": 25 + } }, - { "code": "a11y-misplaced-role", "message": "A11y: should not have role attribute", "start": { "line": 2, - "column": 6, - "character": 33 + "column": 6 }, "end": { "line": 2, - "column": 20, - "character": 47 - }, - "pos": 33 + "column": 20 + } } ] diff --git a/test/validator/samples/a11y-click-events-have-key-events/warnings.json b/test/validator/samples/a11y-click-events-have-key-events/warnings.json index 220f8377a3..904c733a99 100644 --- a/test/validator/samples/a11y-click-events-have-key-events/warnings.json +++ b/test/validator/samples/a11y-click-events-have-key-events/warnings.json @@ -4,104 +4,83 @@ "message": "A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.", "start": { "line": 12, - "column": 0, - "character": 190 + "column": 0 }, "end": { "line": 12, - "column": 23, - "character": 213 - }, - "pos": 190 + "column": 23 + } }, { "code": "a11y-click-events-have-key-events", "message": "A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.", "start": { "line": 13, - "column": 0, - "character": 214 + "column": 0 }, "end": { "line": 13, - "column": 43, - "character": 257 - }, - "pos": 214 + "column": 43 + } }, { "code": "a11y-click-events-have-key-events", "message": "A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.", "start": { "line": 15, - "column": 0, - "character": 259 + "column": 0 }, "end": { "line": 15, - "column": 27, - "character": 286 - }, - "pos": 259 + "column": 27 + } }, { "code": "a11y-click-events-have-key-events", "message": "A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.", "start": { "line": 16, - "column": 0, - "character": 287 + "column": 0 }, "end": { "line": 16, - "column": 24, - "character": 311 - }, - "pos": 287 + "column": 24 + } }, { "code": "a11y-click-events-have-key-events", "message": "A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.", "start": { "line": 17, - "column": 0, - "character": 312 + "column": 0 }, "end": { "line": 17, - "column": 27, - "character": 339 - }, - "pos": 312 + "column": 27 + } }, { "code": "a11y-click-events-have-key-events", "message": "A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.", "start": { "line": 18, - "column": 0, - "character": 340 + "column": 0 }, "end": { "line": 18, - "column": 26, - "character": 366 - }, - "pos": 340 + "column": 26 + } }, { "code": "a11y-click-events-have-key-events", "message": "A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.", "start": { "line": 19, - "column": 0, - "character": 367 + "column": 0 }, "end": { "line": 19, - "column": 26, - "character": 393 - }, - "pos": 367 + "column": 26 + } } ] diff --git a/test/validator/samples/a11y-contenteditable-element-without-child/errors.json b/test/validator/samples/a11y-contenteditable-element-without-child/errors.json index dd2a915b9d..b4bd522c40 100644 --- a/test/validator/samples/a11y-contenteditable-element-without-child/errors.json +++ b/test/validator/samples/a11y-contenteditable-element-without-child/errors.json @@ -4,14 +4,11 @@ "message": "'contenteditable' attribute is required for textContent and innerHTML two-way bindings", "start": { "line": 6, - "column": 3, - "character": 157 + "column": 3 }, "end": { "line": 6, - "column": 24, - "character": 178 - }, - "pos": 157 + "column": 24 + } } ] diff --git a/test/validator/samples/a11y-figcaption-wrong-place/warnings.json b/test/validator/samples/a11y-figcaption-wrong-place/warnings.json index eba5b6f31e..c9cac1daf9 100644 --- a/test/validator/samples/a11y-figcaption-wrong-place/warnings.json +++ b/test/validator/samples/a11y-figcaption-wrong-place/warnings.json @@ -4,29 +4,23 @@ "message": "A11y:
must be first or last child of
", "start": { "line": 4, - "column": 1, - "character": 44 + "column": 1 }, "end": { "line": 6, - "column": 14, - "character": 102 - }, - "pos": 44 + "column": 14 + } }, { "code": "a11y-structure", "message": "A11y:
must be an immediate child of
", "start": { "line": 15, - "column": 2, - "character": 226 + "column": 2 }, "end": { "line": 17, - "column": 15, - "character": 302 - }, - "pos": 226 + "column": 15 + } } ] diff --git a/test/validator/samples/a11y-heading-has-content/warnings.json b/test/validator/samples/a11y-heading-has-content/warnings.json index 9cb77adc02..ad5f5d4033 100644 --- a/test/validator/samples/a11y-heading-has-content/warnings.json +++ b/test/validator/samples/a11y-heading-has-content/warnings.json @@ -4,30 +4,23 @@ "message": "A11y:

element should have child content", "start": { "line": 1, - "column": 0, - "character": 0 + "column": 0 }, "end": { "line": 1, - "column": 9, - "character": 9 - }, - "pos": 0 + "column": 9 + } }, - { "code": "a11y-hidden", "message": "A11y:

element should not be hidden", "start": { "line": 2, - "column": 4, - "character": 14 + "column": 4 }, "end": { "line": 2, - "column": 15, - "character": 25 - }, - "pos": 14 + "column": 15 + } } ] diff --git a/test/validator/samples/a11y-html-has-lang/warnings.json b/test/validator/samples/a11y-html-has-lang/warnings.json index 2ac8a2e5e0..097e8e88bd 100644 --- a/test/validator/samples/a11y-html-has-lang/warnings.json +++ b/test/validator/samples/a11y-html-has-lang/warnings.json @@ -4,14 +4,11 @@ "message": "A11y: element should have a lang attribute", "start": { "column": 0, - "line": 9, - "character": 124 + "line": 9 }, "end": { "line": 9, - "column": 13, - "character": 137 - }, - "pos": 124 + "column": 13 + } } ] diff --git a/test/validator/samples/a11y-iframe-has-title/warnings.json b/test/validator/samples/a11y-iframe-has-title/warnings.json index cc80cceaa2..e78523931e 100644 --- a/test/validator/samples/a11y-iframe-has-title/warnings.json +++ b/test/validator/samples/a11y-iframe-has-title/warnings.json @@ -4,14 +4,11 @@ "message": "A11y: