From dc411f87e6a6a8ea0d2de68217dd9aef1085c55e Mon Sep 17 00:00:00 2001 From: Greg Grothaus Date: Fri, 11 Feb 2022 12:17:47 -0800 Subject: [PATCH] Allow input[type=image]. (#37651) --- .../test/validator-amp-story-form-error.out | 2 +- validator/testdata/feature_tests/forms.html | 4 +-- validator/testdata/feature_tests/forms.out | 6 ++-- validator/testdata/feature_tests/leaks.out | 4 +-- .../testdata/feature_tests/leaks.out.cpponly | 2 +- validator/validator-main.protoascii | 29 +++++++++++++++++++ 6 files changed, 37 insertions(+), 10 deletions(-) diff --git a/extensions/amp-story/1.0/test/validator-amp-story-form-error.out b/extensions/amp-story/1.0/test/validator-amp-story-form-error.out index 9fc4895aa4d9..b1a483aa1858 100644 --- a/extensions/amp-story/1.0/test/validator-amp-story-form-error.out +++ b/extensions/amp-story/1.0/test/validator-amp-story-form-error.out @@ -55,7 +55,7 @@ amp-story/1.0/test/validator-amp-story-form-error.html:42:10 The attribute 'form | | >> ^~~~~~~~~ -amp-story/1.0/test/validator-amp-story-form-error.html:45:10 The attribute 'type' in tag 'input' is set to the invalid value 'image'. (see https://amp.dev/documentation/components/amp-form/) +amp-story/1.0/test/validator-amp-story-form-error.html:45:10 The tag 'input' may only appear as a descendant of tag 'form [method=post]'. (see https://amp.dev/documentation/components/amp-form/) | | | diff --git a/validator/testdata/feature_tests/forms.html b/validator/testdata/feature_tests/forms.html index e4e9ca557049..95f3bfeaf4ed 100644 --- a/validator/testdata/feature_tests/forms.html +++ b/validator/testdata/feature_tests/forms.html @@ -120,9 +120,9 @@ - +
- +
diff --git a/validator/testdata/feature_tests/forms.out b/validator/testdata/feature_tests/forms.out index 31275df78b9d..0b41a6732424 100644 --- a/validator/testdata/feature_tests/forms.out +++ b/validator/testdata/feature_tests/forms.out @@ -125,11 +125,9 @@ feature_tests/forms.html:114:2 The attribute 'target' in tag 'form' is set to th | | | -| +| | -| ->> ^~~~~~~~~ -feature_tests/forms.html:125:4 The attribute 'type' in tag 'input' is set to the invalid value 'image'. (see https://amp.dev/documentation/components/amp-form/) +| |
| |
diff --git a/validator/testdata/feature_tests/leaks.out b/validator/testdata/feature_tests/leaks.out index a2f179c2b6cf..1821f9f3b2b1 100644 --- a/validator/testdata/feature_tests/leaks.out +++ b/validator/testdata/feature_tests/leaks.out @@ -144,7 +144,7 @@ feature_tests/leaks.html:90:0 The attribute 'longdesc' may not appear in tag 'im | --> | >> ^~~~~~~~~ -feature_tests/leaks.html:96:0 The attribute 'src' may not appear in tag 'input'. (see https://amp.dev/documentation/components/amp-form/) +feature_tests/leaks.html:96:0 The tag 'input' may only appear as a descendant of tag 'form [method=post]'. (see https://amp.dev/documentation/components/amp-form/) | >> ^~~~~~~~~ feature_tests/leaks.html:97:0 The tag 'isindex' is disallowed. @@ -364,4 +364,4 @@ feature_tests/leaks.html:203:0 The tag 'vmlframe' is disallowed. | | | -| +| \ No newline at end of file diff --git a/validator/testdata/feature_tests/leaks.out.cpponly b/validator/testdata/feature_tests/leaks.out.cpponly index e1bcc491114c..3ef76096c028 100644 --- a/validator/testdata/feature_tests/leaks.out.cpponly +++ b/validator/testdata/feature_tests/leaks.out.cpponly @@ -144,7 +144,7 @@ feature_tests/leaks.html:90:0 The attribute 'longdesc' may not appear in tag 'im | --> | >> ^~~~~~~~~ -feature_tests/leaks.html:96:0 The attribute 'src' may not appear in tag 'input'. (see https://amp.dev/documentation/components/amp-form/) +feature_tests/leaks.html:96:0 The tag 'input' may only appear as a descendant of tag 'form [method=post]'. (see https://amp.dev/documentation/components/amp-form/) | >> ^~~~~~~~~ feature_tests/leaks.html:97:0 The tag 'isindex' is disallowed. diff --git a/validator/validator-main.protoascii b/validator/validator-main.protoascii index ec68b102beff..c3b93c9496a8 100644 --- a/validator/validator-main.protoascii +++ b/validator/validator-main.protoascii @@ -2942,6 +2942,35 @@ tags: { mandatory_ancestor: "FORM [method=POST]" spec_url: "https://amp.dev/documentation/components/amp-form/" } +tags: { + html_format: AMP + tag_name: "INPUT" + spec_name: "INPUT [type=image]" + attrs: { + name: "type" + value_casei: "image" + mandatory: true + dispatch_key: NAME_VALUE_DISPATCH + } + attrs: { + disabled_by: "amp4email" + name: "[type]" + } + attrs: { + name: "src" + mandatory: true + value_url: { + protocol: "data" + protocol: "http" + protocol: "https" + } + disallowed_value_regex: "__amp_source_origin" + } + attr_lists: "input-common-attr" + attr_lists: "name-attr" + mandatory_ancestor: "FORM [method=POST]" + spec_url: "https://amp.dev/documentation/components/amp-form/" +} # 4.10.6 The button element tags: { html_format: AMP