From 0b987a64342138e6d4091a45ff5f55754bf29e3a Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 4 Dec 2017 18:17:11 -0600 Subject: [PATCH 01/25] 804 : Update allowed AMP tags in sanitizer file. Generate class-amp-allowed-tags-generated.php, Using amp_wp_build.py. Followed the instructions at the top of the file. This is spec file revision 527. --- .../class-amp-allowed-tags-generated.php | 6062 ++++++++++++----- 1 file changed, 4453 insertions(+), 1609 deletions(-) diff --git a/includes/sanitizers/class-amp-allowed-tags-generated.php b/includes/sanitizers/class-amp-allowed-tags-generated.php index edf6d196ae1..91ef6e0938a 100644 --- a/includes/sanitizers/class-amp-allowed-tags-generated.php +++ b/includes/sanitizers/class-amp-allowed-tags-generated.php @@ -11,37 +11,20 @@ */ class AMP_Allowed_Tags_Generated { - private static $spec_file_revision = 325; - private static $minimum_validator_revision_required = 189; + private static $spec_file_revision = 527; + private static $minimum_validator_revision_required = 265; private static $allowed_tags = array( 'a' => array( array( 'attr_spec_list' => array( + '[href]' => array(), 'border' => array(), 'download' => array(), 'href' => array( 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_empty' => true, 'allow_relative' => true, - 'allowed_protocol' => array( - 'bbmi', - 'fb-messenger', - 'ftp', - 'http', - 'https', - 'intent', - 'line', - 'mailto', - 'skype', - 'sms', - 'snapchat', - 'tel', - 'tg', - 'threema', - 'twitter', - 'viber', - 'whatsapp', - ), ), 'hreflang' => array(), 'media' => array(), @@ -57,19 +40,13 @@ class AMP_Allowed_Tags_Generated { 'type' => array( 'value_casei' => 'text/html', ), - 'verify-xhr' => array( - 'blacklisted_value_regex' => '__amp_source_origin', - 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), - 'disallowed_domain' => array( - 'cdn.ampproject.org', - ), - ), ), 'tag_spec' => array( - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#links', + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#links', ), ), @@ -99,6 +76,28 @@ class AMP_Allowed_Tags_Generated { ), ), + 'amp-3q-player' => array( + array( + 'attr_spec_list' => array( + 'autoplay' => array( + 'value' => '', + ), + 'data-id' => array( + 'mandatory' => true, + ), + 'media' => array(), + 'noloading' => array( + 'value' => '', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + ), 'amp-accordion' => array( array( 'attr_spec_list' => array( @@ -107,22 +106,46 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-accordion extension .js script', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-accordion', + ), + + ), + ), + 'amp-ad' => array( + array( + 'attr_spec_list' => array( + 'alt' => array(), + 'json' => array(), + 'media' => array(), + 'noloading' => array( + 'value' => '', + ), + 'src' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_relative' => true, + ), + 'type' => array( + 'mandatory' => true, + ), + ), + 'tag_spec' => array( + 'disallowed_ancestor' => array( + 'amp-app-banner', ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-accordion.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-ad', ), ), - ), - 'amp-ad' => array( array( 'attr_spec_list' => array( 'alt' => array(), + 'data-multi-size' => array( + 'mandatory' => true, + 'value' => '', + ), 'json' => array(), 'media' => array(), 'noloading' => array( @@ -131,9 +154,6 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), ), 'type' => array( 'mandatory' => true, @@ -142,12 +162,36 @@ class AMP_Allowed_Tags_Generated { 'tag_spec' => array( 'disallowed_ancestor' => array( 'amp-app-banner', - 'amp-sidebar', + 'amp-carousel', + 'amp-fx-flying-carpet', + 'amp-lightbox', + 'amp-sticky-ad', ), 'html_format' => array( 'amp', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/amp-ad.html', + 'spec_name' => 'amp-ad with data-multi-size attribute', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-ad', + ), + + ), + ), + 'amp-ad-exit' => array( + array( + 'attr_spec_list' => array( + 'id' => array( + 'mandatory' => true, + ), + 'media' => array(), + 'noloading' => array( + 'value' => '', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp4ads', + ), + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-ad-exit', ), ), @@ -157,25 +201,17 @@ class AMP_Allowed_Tags_Generated { 'attr_spec_list' => array( 'config' => array( 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_empty' => true, 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), ), 'type' => array(), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-analytics extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-analytics.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-analytics', ), ), @@ -185,9 +221,6 @@ class AMP_Allowed_Tags_Generated { 'attr_spec_list' => array( 'alt' => array(), 'attribution' => array(), - 'autoplay' => array( - 'value' => '', - ), 'controls' => array(), 'media' => array(), 'noloading' => array( @@ -200,25 +233,34 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => true, - 'allowed_protocol' => array( - 'data', - 'http', - 'https', - ), ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-anim extension .js script', + 'html_format' => array( + 'amp', + 'amp4ads', ), - 'disallowed_ancestor' => array( - 'amp-sidebar', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-anim', + ), + + ), + ), + 'amp-animation' => array( + array( + 'attr_spec_list' => array( + 'media' => array(), + 'noloading' => array( + 'value' => '', + ), + 'trigger' => array( + 'value' => 'visibility', ), + ), + 'tag_spec' => array( 'html_format' => array( 'amp', 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-anim.html', ), ), @@ -238,13 +280,10 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-apester-media extension .js script', - ), 'html_format' => array( 'amp', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-apester-media.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-apester-media', ), ), @@ -261,16 +300,11 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-app-banner button[open-button]', - 'amp-app-banner extension .js script', - ), 'html_format' => array( 'amp', ), 'mandatory_parent' => 'body', - 'spec_name' => 'amp-app-banner', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-add-banner.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-app-banner', 'unique' => true, ), @@ -279,10 +313,14 @@ class AMP_Allowed_Tags_Generated { 'amp-audio' => array( array( 'attr_spec_list' => array( + 'album' => array(), + 'artist' => array(), + 'artwork' => array(), 'autoplay' => array( - 'value_regex' => '^$|desktop|tablet|mobile|autoplay', + 'value' => '', ), 'controls' => array(), + 'controlslist' => array(), 'loop' => array( 'value' => '', ), @@ -296,28 +334,30 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-audio extension .js script', - ), 'disallowed_ancestor' => array( - 'amp-sidebar', + 'amp-story', ), 'html_format' => array( 'amp', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-audio.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-audio', ), ), array( 'attr_spec_list' => array( + 'album' => array(), + 'artist' => array(), + 'artwork' => array(), + 'autoplay' => array( + 'mandatory' => true, + 'value' => '', + ), 'controls' => array(), + 'controlslist' => array(), 'loop' => array( 'value' => '', ), @@ -331,23 +371,46 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-audio extension .js script', + 'html_format' => array( + 'amp', ), - 'disallowed_ancestor' => array( - 'amp-sidebar', + 'mandatory_ancestor' => 'amp-story', + 'spec_name' => 'amp-story >> amp-audio', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-audio', + ), + + ), + array( + 'attr_spec_list' => array( + 'album' => array(), + 'artist' => array(), + 'artwork' => array(), + 'controls' => array(), + 'controlslist' => array(), + 'loop' => array( + 'value' => '', + ), + 'media' => array(), + 'muted' => array( + 'value' => '', + ), + 'noloading' => array( + 'value' => '', + ), + 'src' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_relative' => true, ), + ), + 'tag_spec' => array( 'html_format' => array( 'amp4ads', ), 'spec_name' => 'amp-audio (a4a)', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-audio.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-audio', ), ), @@ -367,6 +430,8 @@ class AMP_Allowed_Tags_Generated { 'html_format' => array( 'amp', ), + 'mandatory_parent' => 'body', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-auto-ads', ), ), @@ -374,6 +439,10 @@ class AMP_Allowed_Tags_Generated { 'amp-brid-player' => array( array( 'attr_spec_list' => array( + 'autoplay' => array(), + 'data-outstream' => array( + 'value_regex' => '[0-9]+', + ), 'data-partner' => array( 'mandatory' => true, 'value_regex' => '[0-9]+', @@ -394,17 +463,10 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-brid-player extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-brid-player.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-brid-player', ), ), @@ -412,30 +474,47 @@ class AMP_Allowed_Tags_Generated { 'amp-brightcove' => array( array( 'attr_spec_list' => array( + '[data-account]' => array(), + '[data-embed]' => array(), + '[data-player-id]' => array(), + '[data-player]' => array(), + '[data-playlist-id]' => array(), + '[data-video-id]' => array(), 'data-account' => array( 'mandatory' => true, ), - 'data-embed' => array(), - 'data-player' => array(), - 'data-playlist-id' => array(), - 'data-video-id' => array(), 'media' => array(), 'noloading' => array( 'value' => '', ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-brightcove extension .js script', + 'html_format' => array( + 'amp', ), - 'disallowed_ancestor' => array( - 'amp-sidebar', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-brightcove', + ), + + ), + ), + 'amp-call-tracking' => array( + array( + 'attr_spec_list' => array( + 'config' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'mandatory' => true, + 'allow_relative' => false, + ), + 'media' => array(), + 'noloading' => array( + 'value' => '', ), + ), + 'tag_spec' => array( 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-brightcove.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-call-tracking', ), ), @@ -443,6 +522,7 @@ class AMP_Allowed_Tags_Generated { 'amp-carousel' => array( array( 'attr_spec_list' => array( + '[slide]' => array(), 'arrows' => array( 'value' => '', ), @@ -468,17 +548,7 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-carousel extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), - 'html_format' => array( - 'amp', - 'amp4ads', - ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-carousel.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-carousel', ), ), @@ -486,6 +556,7 @@ class AMP_Allowed_Tags_Generated { 'amp-dailymotion' => array( array( 'attr_spec_list' => array( + 'autoplay' => array(), 'data-endscreen-enable' => array( 'value_regex' => 'true|false', ), @@ -517,25 +588,49 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-dailymotion extension .js script', + 'html_format' => array( + 'amp', + ), + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-dailymotion', + ), + + ), + ), + 'amp-embed' => array( + array( + 'attr_spec_list' => array( + 'alt' => array(), + 'json' => array(), + 'media' => array(), + 'noloading' => array( + 'value' => '', + ), + 'src' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_relative' => true, + ), + 'type' => array( + 'mandatory' => true, ), + ), + 'tag_spec' => array( 'disallowed_ancestor' => array( - 'amp-sidebar', + 'amp-app-banner', ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-dailymotion.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-ad', ), ), - ), - 'amp-embed' => array( array( 'attr_spec_list' => array( 'alt' => array(), + 'data-multi-size' => array( + 'mandatory' => true, + 'value' => '', + ), 'json' => array(), 'media' => array(), 'noloading' => array( @@ -544,9 +639,6 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), ), 'type' => array( 'mandatory' => true, @@ -554,12 +646,17 @@ class AMP_Allowed_Tags_Generated { ), 'tag_spec' => array( 'disallowed_ancestor' => array( - 'amp-sidebar', + 'amp-app-banner', + 'amp-carousel', + 'amp-fx-flying-carpet', + 'amp-lightbox', + 'amp-sticky-ad', ), 'html_format' => array( 'amp', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/amp-embed.html', + 'spec_name' => 'amp-embed with data-multi-size attribute', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-ad', ), ), @@ -568,16 +665,10 @@ class AMP_Allowed_Tags_Generated { array( 'attr_spec_list' => array(), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-experiment extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-experiment.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-experiment', 'unique' => true, ), @@ -595,44 +686,66 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-facebook extension .js script', + 'html_format' => array( + 'amp', ), - 'disallowed_ancestor' => array( - 'amp-sidebar', + ), + + ), + ), + 'amp-facebook-comments' => array( + array( + 'attr_spec_list' => array( + 'data-href' => array( + 'mandatory' => true, + ), + 'media' => array(), + 'noloading' => array( + 'value' => '', ), + ), + 'tag_spec' => array( 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-facebook.html', ), ), ), - 'amp-fit-text' => array( + 'amp-facebook-like' => array( array( 'attr_spec_list' => array( - 'max-font-size' => array(), + 'data-href' => array( + 'mandatory' => true, + 'allow_relative' => false, + ), 'media' => array(), - 'min-font-size' => array(), 'noloading' => array( 'value' => '', ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-fit-text extension .js script', - ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-fit-text.html', ), ), ), + 'amp-fit-text' => array( + array( + 'attr_spec_list' => array( + 'max-font-size' => array(), + 'media' => array(), + 'min-font-size' => array(), + 'noloading' => array( + 'value' => '', + ), + ), + 'tag_spec' => array(), + + ), + ), 'amp-font' => array( array( 'attr_spec_list' => array( @@ -655,17 +768,10 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-font extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-font.html', ), ), @@ -682,17 +788,9 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-fx-flying-carpet extension .js script', + 'html_format' => array( + 'amp', ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), - 'html_format' => array( - 'amp', - 'amp4ads', - ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-fx-flying-carpet.html', ), ), @@ -712,17 +810,49 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-gfycat extension .js script', + 'html_format' => array( + 'amp', ), - 'disallowed_ancestor' => array( - 'amp-sidebar', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-gfycat', + ), + + ), + ), + 'amp-gist' => array( + array( + 'attr_spec_list' => array( + 'data-gistid' => array( + 'mandatory' => true, ), + 'media' => array(), + 'noloading' => array( + 'value' => '', + ), + ), + 'tag_spec' => array( 'html_format' => array( 'amp', + ), + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-gist', + ), + + ), + ), + 'amp-gwd-animation' => array( + array( + 'attr_spec_list' => array( + 'media' => array(), + 'noloading' => array( + 'value' => '', + ), + 'timeline-event-prefix' => array( + 'value' => '', + ), + ), + 'tag_spec' => array( + 'html_format' => array( 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-gfycat.html', ), ), @@ -739,16 +869,10 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-hulu extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', - 'amp4ads', ), + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-hulu', ), ), @@ -756,9 +880,16 @@ class AMP_Allowed_Tags_Generated { 'amp-iframe' => array( array( 'attr_spec_list' => array( + '[src]' => array(), + 'allow' => array( + 'value_regex' => 'geolocation|fullscreen|payment|transparency', + ), 'allowfullscreen' => array( 'value' => '', ), + 'allowpaymentrequest' => array( + 'value' => '', + ), 'allowtransparency' => array( 'value' => '', ), @@ -780,24 +911,38 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, - 'allowed_protocol' => array( - 'data', - 'https', - ), ), 'srcdoc' => array(), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-iframe extension .js script', + 'html_format' => array( + 'amp', ), - 'disallowed_ancestor' => array( - 'amp-sidebar', + ), + + ), + ), + 'amp-ima-video' => array( + array( + 'attr_spec_list' => array( + 'data-src' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_relative' => true, + ), + 'data-tag' => array( + 'mandatory' => true, + 'allow_relative' => true, + ), + 'media' => array(), + 'noloading' => array( + 'value' => '', ), + ), + 'tag_spec' => array( 'html_format' => array( 'amp', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-iframe.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-ima-video', ), ), @@ -812,17 +957,9 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-image-lightbox extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-image-lightbox.html', ), ), @@ -830,6 +967,10 @@ class AMP_Allowed_Tags_Generated { 'amp-img' => array( array( 'attr_spec_list' => array( + '[alt]' => array(), + '[attribution]' => array(), + '[src]' => array(), + '[srcset]' => array(), 'alt' => array(), 'attribution' => array(), 'media' => array(), @@ -844,11 +985,6 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => true, - 'allowed_protocol' => array( - 'data', - 'http', - 'https', - ), ), ), 'tag_spec' => array( @@ -856,7 +992,26 @@ class AMP_Allowed_Tags_Generated { 'amp', 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/amp-img.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-img', + ), + + ), + ), + 'amp-imgur' => array( + array( + 'attr_spec_list' => array( + 'data-imgur-id' => array( + 'mandatory' => true, + ), + 'media' => array(), + 'noloading' => array( + 'value' => '', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), ), ), @@ -874,17 +1029,9 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-instagram extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-instagram.html', ), ), @@ -892,26 +1039,40 @@ class AMP_Allowed_Tags_Generated { 'amp-install-serviceworker' => array( array( 'attr_spec_list' => array( + 'data-iframe-src' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_relative' => true, + ), 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-install-serviceworker extension .js script', + 'html_format' => array( + 'amp', ), - 'disallowed_ancestor' => array( - 'amp-sidebar', + ), + + ), + ), + 'amp-izlesene' => array( + array( + 'attr_spec_list' => array( + 'data-videoid' => array( + 'mandatory' => true, + 'value_regex' => '[0-9]+', + ), + 'media' => array(), + 'noloading' => array( + 'value' => '', ), + ), + 'tag_spec' => array( 'html_format' => array( 'amp', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-install-serviceworker.html', ), ), @@ -931,17 +1092,9 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-jwplayer extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-jwplayer.html', ), ), @@ -958,17 +1111,27 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-kaltura-player extension .js script', + 'html_format' => array( + 'amp', ), - 'disallowed_ancestor' => array( - 'amp-sidebar', + ), + + ), + ), + 'amp-layout' => array( + array( + 'attr_spec_list' => array( + 'media' => array(), + 'noloading' => array( + 'value' => '', ), + ), + 'tag_spec' => array( 'html_format' => array( 'amp', 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-kaltura-player.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-layout', ), ), @@ -985,17 +1148,9 @@ class AMP_Allowed_Tags_Generated { 'scrollable' => array(), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-lightbox extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-lightbox.html', ), ), @@ -1003,30 +1158,27 @@ class AMP_Allowed_Tags_Generated { 'amp-list' => array( array( 'attr_spec_list' => array( + '[src]' => array(), + '[state]' => array(), 'credentials' => array(), + 'items' => array(), + 'max-items' => array(), 'media' => array(), 'noloading' => array( 'value' => '', ), + 'single-item' => array(), 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), ), 'template' => array(), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-list extension .js script', - ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-list.html', ), ), @@ -1049,14 +1201,42 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-live-list extension .js script', + 'html_format' => array( + 'amp', + ), + ), + + ), + ), + 'amp-nexxtv-player' => array( + array( + 'attr_spec_list' => array( + 'data-client' => array( + 'mandatory' => true, + ), + 'data-mediaid' => array( + 'mandatory' => true, + 'value_regex' => '[^=/?:]+', + ), + 'data-mode' => array( + 'value_regex' => 'api|static', + ), + 'data-origin' => array( + 'allow_empty' => true, + ), + 'data-seek-to' => array(), + 'data-streamtype' => array( + 'value_regex' => 'album|audio|live|playlist|playlist-marked|video', + ), + 'media' => array(), + 'noloading' => array( + 'value' => '', ), + ), + 'tag_spec' => array( 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-live-list.html', ), ), @@ -1067,28 +1247,18 @@ class AMP_Allowed_Tags_Generated { 'data-bcid' => array( 'mandatory' => true, ), - 'data-bid' => array(), 'data-pid' => array( 'mandatory' => true, ), - 'data-vid' => array(), 'media' => array(), 'noloading' => array( 'value' => '', ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-o2-player extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-o2-player.html', ), ), @@ -1096,7 +1266,6 @@ class AMP_Allowed_Tags_Generated { 'amp-ooyala-player' => array( array( 'attr_spec_list' => array( - 'data-config' => array(), 'data-embedcode' => array( 'mandatory' => true, ), @@ -1106,21 +1275,15 @@ class AMP_Allowed_Tags_Generated { 'data-playerid' => array( 'mandatory' => true, ), - 'data-playerversion' => array(), 'media' => array(), 'noloading' => array( 'value' => '', ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-ooyala-player extension .js script', - ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-ooyala-player.html', ), ), @@ -1137,17 +1300,10 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-pinterest extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-pinterest.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-pinterest', ), ), @@ -1159,24 +1315,22 @@ class AMP_Allowed_Tags_Generated { 'noloading' => array( 'value' => '', ), + 'referrerpolicy' => array( + 'value' => 'no-referrer', + ), 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, + 'allow_empty' => true, 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), ), ), 'tag_spec' => array( - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/amp-pixel.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-pixel', ), ), @@ -1187,6 +1341,7 @@ class AMP_Allowed_Tags_Generated { 'data-comments' => array( 'value_regex_casei' => '(false|true)', ), + 'data-item' => array(), 'data-item-info' => array( 'value_regex_casei' => '(false|true)', ), @@ -1197,19 +1352,36 @@ class AMP_Allowed_Tags_Generated { 'noloading' => array( 'value' => '', ), - 'src' => array( - 'mandatory' => true, - ), + 'src' => array(), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-playbuzz extension .js script', + 'html_format' => array( + 'amp', + ), + ), + + ), + ), + 'amp-position-observer' => array( + array( + 'attr_spec_list' => array( + 'intersection-ratios' => array( + 'value_regex' => '^([0]*?\\.\\d*$|1$|0$)|([0]*?\\.\\d*|1|0)\\s{1}([0]*?\\.\\d*$|1$|0$)', + ), + 'media' => array(), + 'noloading' => array( + 'value' => '', + ), + 'target' => array(), + 'viewport-margins' => array( + 'value_regex' => '^(\\d+$|\\d+px$|\\d+vh$)|((\\d+|\\d+px|\\d+vh)\\s{1}(\\d+$|\\d+px$|\\d+vh$))', ), + ), + 'tag_spec' => array( 'html_format' => array( 'amp', 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-playbuzz', ), ), @@ -1227,17 +1399,9 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-reach-player extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-reach-player.html', ), ), @@ -1264,17 +1428,9 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-reddit extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-reddit', ), ), @@ -1282,32 +1438,32 @@ class AMP_Allowed_Tags_Generated { 'amp-selector' => array( array( 'attr_spec_list' => array( + '[selected]' => array(), 'disabled' => array( 'value' => '', ), 'form' => array(), + 'keyboard-select-mode' => array( + 'value_regex_casei' => 'focus|none|select', + ), 'media' => array(), 'multiple' => array( 'value' => '', ), - 'name' => array(), + 'name' => array( + 'blacklisted_value_regex' => '(^|\\s)(__amp_\\s*|__count__|__definegetter__|__definesetter__|__lookupgetter__|__lookupsetter__|__nosuchmethod__|__parent__|__proto__|__amp_\\s*|\\$p|\\$proxy|acceptcharset|addeventlistener|appendchild|assignedslot|attachshadow|baseuri|checkvalidity|childelementcount|childnodes|classlist|classname|clientheight|clientleft|clienttop|clientwidth|comparedocumentposition|computedname|computedrole|contenteditable|createshadowroot|enqueaction|firstchild|firstelementchild|getanimations|getattribute|getattributens|getattributenode|getattributenodens|getboundingclientrect|getclientrects|getdestinationinsertionpoints|getelementsbyclassname|getelementsbytagname|getelementsbytagnamens|getrootnode|hasattribute|hasattributens|hasattributes|haschildnodes|haspointercapture|innerhtml|innertext|inputmode|insertadjacentelement|insertadjacenthtml|insertadjacenttext|iscontenteditable|isdefaultnamespace|isequalnode|issamenode|lastchild|lastelementchild|lookupnamespaceuri|namespaceuri|nextelementsibling|nextsibling|nodename|nodetype|nodevalue|offsetheight|offsetleft|offsetparent|offsettop|offsetwidth|outerhtml|outertext|ownerdocument|parentelement|parentnode|previouselementsibling|previoussibling|queryselector|queryselectorall|releasepointercapture|removeattribute|removeattributens|removeattributenode|removechild|removeeventlistener|replacechild|reportvalidity|requestpointerlock|scrollheight|scrollintoview|scrollintoviewifneeded|scrollleft|scrollwidth|setattribute|setattributens|setattributenode|setattributenodens|setpointercapture|shadowroot|stylemap|tabindex|tagname|textcontent|tostring|valueof|(webkit|ms|moz|o)dropzone|(webkit|moz|ms|o)matchesselector|(webkit|moz|ms|o)requestfullscreen|(webkit|moz|ms|o)requestfullscreen)(\\s|$)', + ), 'noloading' => array( 'value' => '', ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-selector extension .js script', - ), 'disallowed_ancestor' => array( 'amp-selector', - 'amp-sidebar', ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-selector.html', ), ), @@ -1324,18 +1480,10 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-sidebar extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', ), 'mandatory_parent' => 'body', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-sidebar.html', - 'unique' => true, ), ), @@ -1346,24 +1494,6 @@ class AMP_Allowed_Tags_Generated { 'data-share-endpoint' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => false, - 'allowed_protocol' => array( - 'bbmi', - 'fb-messenger', - 'ftp', - 'http', - 'https', - 'intent', - 'line', - 'mailto', - 'skype', - 'sms', - 'snapchat', - 'tel', - 'tg', - 'threema', - 'viber', - 'whatsapp', - ), ), 'media' => array(), 'noloading' => array( @@ -1374,14 +1504,10 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-social-share extension .js script', - ), 'html_format' => array( 'amp', 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-social-share.html', ), ), @@ -1392,11 +1518,13 @@ class AMP_Allowed_Tags_Generated { 'data-color' => array( 'value_regex_casei' => '([0-9a-f]{3}){1,2}', ), + 'data-playlistid' => array( + 'value_regex' => '[0-9]+', + ), 'data-secret-token' => array( 'value_regex' => '[a-za-z0-9_-]+', ), 'data-trackid' => array( - 'mandatory' => true, 'value_regex' => '[0-9]+', ), 'data-visual' => array( @@ -1408,17 +1536,9 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-soundcloud extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-soundcloud.html', ), ), @@ -1453,17 +1573,32 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-springboard-player extension .js script', + 'html_format' => array( + 'amp', ), - 'disallowed_ancestor' => array( - 'amp-sidebar', + ), + + ), + ), + 'amp-state' => array( + array( + 'attr_spec_list' => array( + '[src]' => array(), + 'credentials' => array(), + 'id' => array( + 'mandatory' => true, + ), + 'src' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_relative' => true, ), + ), + 'tag_spec' => array( 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-springboard-player.html', + 'spec_name' => 'amp-state', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-bind', ), ), @@ -1477,65 +1612,128 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-sticky-ad extension .js script', - ), 'disallowed_ancestor' => array( 'amp-app-banner', - 'amp-sidebar', ), 'html_format' => array( 'amp', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-sticky-ad.html', 'unique' => true, ), ), ), - 'amp-twitter' => array( + 'amp-story' => array( array( 'attr_spec_list' => array( - 'data-tweetid' => array( + 'background-audio' => array(), + 'bookend-config-src' => array(), + 'standalone' => array( 'mandatory' => true, - ), - 'media' => array(), - 'noloading' => array( 'value' => '', ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-twitter extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-twitter.html', + 'mandatory_parent' => 'body', ), ), ), - 'amp-user-notification' => array( + 'amp-story-grid-layer' => array( + array( + 'attr_spec_list' => array( + 'template' => array( + 'mandatory' => true, + 'value_regex' => '(fill|horizontal|vertical|thirds)', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + 'mandatory_ancestor' => 'amp-story-page', + ), + + ), + ), + 'amp-story-page' => array( + array( + 'attr_spec_list' => array( + 'auto-advance-after' => array(), + 'background-audio' => array(), + 'id' => array( + 'mandatory' => true, + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + 'mandatory_parent' => 'amp-story', + ), + + ), + ), + 'amp-timeago' => array( + array( + 'attr_spec_list' => array( + 'cutoff' => array( + 'value_regex' => '\\d+', + ), + 'datetime' => array( + 'mandatory' => true, + 'value_regex' => '\\d{4}-[01]\\d-[0-3]\\dt[0-2]\\d:[0-5]\\d(:[0-5]\\d(\\.\\d+)?)?(z|[+-][0-1][0-9]:[0-5][0-9])', + ), + 'locale' => array(), + 'media' => array(), + 'noloading' => array( + 'value' => '', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-timeago', + ), + + ), + ), + 'amp-twitter' => array( + array( + 'attr_spec_list' => array( + 'data-tweetid' => array( + 'mandatory' => true, + ), + 'media' => array(), + 'noloading' => array( + 'value' => '', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + ), + 'amp-user-notification' => array( array( 'attr_spec_list' => array( 'data-dismiss-href' => array( 'allow_empty' => false, 'allow_relative' => false, - 'allowed_protocol' => array( - 'https', - ), ), 'data-show-if-href' => array( 'allow_empty' => false, 'allow_relative' => false, - 'allowed_protocol' => array( - 'https', - ), + ), + 'enctype' => array( + 'value' => 'application/x-www-form-urlencoded', ), 'media' => array(), 'noloading' => array( @@ -1543,17 +1741,9 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-analytics extension .js script', - 'amp-user-notification extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-user-notification.html', ), ), @@ -1561,7 +1751,22 @@ class AMP_Allowed_Tags_Generated { 'amp-video' => array( array( 'attr_spec_list' => array( + '[album]' => array(), + '[alt]' => array(), + '[artist]' => array(), + '[artwork]' => array(), + '[attribution]' => array(), + '[controls]' => array(), + '[controlslist]' => array(), + '[loop]' => array(), + '[poster]' => array(), + '[preload]' => array(), + '[src]' => array(), + '[title]' => array(), + 'album' => array(), 'alt' => array(), + 'artist' => array(), + 'artwork' => array(), 'attribution' => array(), 'autoplay' => array( 'value' => '', @@ -1569,6 +1774,11 @@ class AMP_Allowed_Tags_Generated { 'controls' => array( 'value' => '', ), + 'controlslist' => array(), + 'crossorigin' => array(), + 'disableremoteplayback' => array( + 'value' => '', + ), 'loop' => array( 'value' => '', ), @@ -1587,20 +1797,80 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), ), ), 'tag_spec' => array( 'disallowed_ancestor' => array( - 'amp-sidebar', + 'amp-story', + ), + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-video', + ), + + ), + array( + 'attr_spec_list' => array( + '[album]' => array(), + '[alt]' => array(), + '[artist]' => array(), + '[artwork]' => array(), + '[attribution]' => array(), + '[controls]' => array(), + '[controlslist]' => array(), + '[loop]' => array(), + '[poster]' => array(), + '[preload]' => array(), + '[src]' => array(), + '[title]' => array(), + 'album' => array(), + 'alt' => array(), + 'artist' => array(), + 'artwork' => array(), + 'attribution' => array(), + 'autoplay' => array( + 'value' => '', + ), + 'controls' => array( + 'value' => '', + ), + 'controlslist' => array(), + 'crossorigin' => array(), + 'disableremoteplayback' => array( + 'value' => '', + ), + 'loop' => array( + 'value' => '', + ), + 'media' => array(), + 'muted' => array( + 'value' => '', + ), + 'noloading' => array( + 'value' => '', + ), + 'placeholder' => array(), + 'poster' => array( + 'mandatory' => true, + ), + 'preload' => array( + 'value_regex' => '(none|metadata|auto|)', + ), + 'src' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_relative' => true, ), + ), + 'tag_spec' => array( 'html_format' => array( 'amp', 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/amp-video.html', + 'mandatory_ancestor' => 'amp-story', + 'spec_name' => 'amp-story >> amp-video', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-video', ), ), @@ -1618,17 +1888,9 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-vimeo extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-sidebar', - ), 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-vimeo.html', ), ), @@ -1645,47 +1907,104 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-vine extension .js script', + 'html_format' => array( + 'amp', ), - 'disallowed_ancestor' => array( - 'amp-sidebar', + ), + + ), + ), + 'amp-vk' => array( + array( + 'attr_spec_list' => array( + 'data-embedtype' => array( + 'mandatory' => true, + ), + 'media' => array(), + 'noloading' => array( + 'value' => '', ), + ), + 'tag_spec' => array( 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-vine.html', ), ), ), - 'amp-youtube' => array( + 'amp-web-push' => array( array( 'attr_spec_list' => array( - 'autoplay' => array(), - 'data-videoid' => array( + 'helper-iframe-url' => array( 'mandatory' => true, - 'value_regex' => '[^=/?:]+', + 'allow_relative' => false, + ), + 'id' => array( + 'mandatory' => true, + 'value_regex' => 'amp-web-push', ), 'media' => array(), 'noloading' => array( 'value' => '', ), + 'permission-dialog-url' => array( + 'mandatory' => true, + 'allow_relative' => false, + ), + 'service-worker-url' => array( + 'mandatory' => true, + 'allow_relative' => false, + ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-youtube extension .js script', + 'html_format' => array( + 'amp', ), - 'disallowed_ancestor' => array( - 'amp-sidebar', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-web-push', + ), + + ), + ), + 'amp-web-push-widget' => array( + array( + 'attr_spec_list' => array( + 'media' => array(), + 'noloading' => array( + 'value' => '', ), + 'visibility' => array( + 'mandatory' => true, + 'value_regex' => '(blocked|subscribed|unsubscribed)', + ), + ), + 'tag_spec' => array( 'html_format' => array( 'amp', - 'amp4ads', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-youtube.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-web-push', + ), + + ), + ), + 'amp-youtube' => array( + array( + 'attr_spec_list' => array( + '[data-videoid]' => array(), + 'autoplay' => array(), + 'credentials' => array( + 'value_regex_casei' => '(include|omit)', + ), + 'data-videoid' => array( + 'mandatory' => true, + 'value_regex' => '[^=/?:]+', + ), + 'media' => array(), + 'noloading' => array( + 'value' => '', + ), ), + 'tag_spec' => array(), ), ), @@ -1714,10 +2033,6 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => false, - 'allowed_protocol' => array( - 'data', - 'https', - ), ), ), 'tag_spec' => array( @@ -1726,7 +2041,7 @@ class AMP_Allowed_Tags_Generated { ), 'mandatory_ancestor' => 'noscript', 'mandatory_ancestor_suggested_alternative' => 'amp-audio', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-audio.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-audio', ), ), @@ -1771,24 +2086,8 @@ class AMP_Allowed_Tags_Generated { 'align' => array(), 'cite' => array( 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_empty' => true, 'allow_relative' => true, - 'allowed_protocol' => array( - 'fb-messenger', - 'ftp', - 'http', - 'https', - 'intent', - 'mailto', - 'skype', - 'sms', - 'snapchat', - 'tel', - 'tg', - 'threema', - 'twitter', - 'viber', - 'whatsapp', - ), ), ), 'tag_spec' => array(), @@ -1801,7 +2100,7 @@ class AMP_Allowed_Tags_Generated { 'tag_spec' => array( 'mandatory' => true, 'mandatory_parent' => 'html', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#required-markup', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#required-markup', 'unique' => true, ), @@ -1817,10 +2116,15 @@ class AMP_Allowed_Tags_Generated { 'button' => array( array( 'attr_spec_list' => array( + '[disabled]' => array(), + '[type]' => array(), + '[value]' => array(), 'disabled' => array( 'value' => '', ), - 'name' => array(), + 'name' => array( + 'blacklisted_value_regex' => '(^|\\s)(__amp_\\s*|__count__|__definegetter__|__definesetter__|__lookupgetter__|__lookupsetter__|__nosuchmethod__|__parent__|__proto__|__amp_\\s*|\\$p|\\$proxy|acceptcharset|addeventlistener|appendchild|assignedslot|attachshadow|baseuri|checkvalidity|childelementcount|childnodes|classlist|classname|clientheight|clientleft|clienttop|clientwidth|comparedocumentposition|computedname|computedrole|contenteditable|createshadowroot|enqueaction|firstchild|firstelementchild|getanimations|getattribute|getattributens|getattributenode|getattributenodens|getboundingclientrect|getclientrects|getdestinationinsertionpoints|getelementsbyclassname|getelementsbytagname|getelementsbytagnamens|getrootnode|hasattribute|hasattributens|hasattributes|haschildnodes|haspointercapture|innerhtml|innertext|inputmode|insertadjacentelement|insertadjacenthtml|insertadjacenttext|iscontenteditable|isdefaultnamespace|isequalnode|issamenode|lastchild|lastelementchild|lookupnamespaceuri|namespaceuri|nextelementsibling|nextsibling|nodename|nodetype|nodevalue|offsetheight|offsetleft|offsetparent|offsettop|offsetwidth|outerhtml|outertext|ownerdocument|parentelement|parentnode|previouselementsibling|previoussibling|queryselector|queryselectorall|releasepointercapture|removeattribute|removeattributens|removeattributenode|removechild|removeeventlistener|replacechild|reportvalidity|requestpointerlock|scrollheight|scrollintoview|scrollintoviewifneeded|scrollleft|scrollwidth|setattribute|setattributens|setattributenode|setattributenodens|setpointercapture|shadowroot|stylemap|tabindex|tagname|textcontent|tostring|valueof|(webkit|ms|moz|o)dropzone|(webkit|moz|ms|o)matchesselector|(webkit|moz|ms|o)requestfullscreen|(webkit|moz|ms|o)requestfullscreen)(\\s|$)', + ), 'role' => array(), 'tabindex' => array(), 'type' => array(), @@ -1831,7 +2135,9 @@ class AMP_Allowed_Tags_Generated { ), array( 'attr_spec_list' => array( - 'name' => array(), + 'name' => array( + 'blacklisted_value_regex' => '(^|\\s)(__amp_\\s*|__count__|__definegetter__|__definesetter__|__lookupgetter__|__lookupsetter__|__nosuchmethod__|__parent__|__proto__|__amp_\\s*|\\$p|\\$proxy|acceptcharset|addeventlistener|appendchild|assignedslot|attachshadow|baseuri|checkvalidity|childelementcount|childnodes|classlist|classname|clientheight|clientleft|clienttop|clientwidth|comparedocumentposition|computedname|computedrole|contenteditable|createshadowroot|enqueaction|firstchild|firstelementchild|getanimations|getattribute|getattributens|getattributenode|getattributenodens|getboundingclientrect|getclientrects|getdestinationinsertionpoints|getelementsbyclassname|getelementsbytagname|getelementsbytagnamens|getrootnode|hasattribute|hasattributens|hasattributes|haschildnodes|haspointercapture|innerhtml|innertext|inputmode|insertadjacentelement|insertadjacenthtml|insertadjacenttext|iscontenteditable|isdefaultnamespace|isequalnode|issamenode|lastchild|lastelementchild|lookupnamespaceuri|namespaceuri|nextelementsibling|nextsibling|nodename|nodetype|nodevalue|offsetheight|offsetleft|offsetparent|offsettop|offsetwidth|outerhtml|outertext|ownerdocument|parentelement|parentnode|previouselementsibling|previoussibling|queryselector|queryselectorall|releasepointercapture|removeattribute|removeattributens|removeattributenode|removechild|removeeventlistener|replacechild|reportvalidity|requestpointerlock|scrollheight|scrollintoview|scrollintoviewifneeded|scrollleft|scrollwidth|setattribute|setattributens|setattributenode|setattributenodens|setpointercapture|shadowroot|stylemap|tabindex|tagname|textcontent|tostring|valueof|(webkit|ms|moz|o)dropzone|(webkit|moz|ms|o)matchesselector|(webkit|moz|ms|o)requestfullscreen|(webkit|moz|ms|o)requestfullscreen)(\\s|$)', + ), 'open-button' => array( 'value' => '', ), @@ -1841,6 +2147,10 @@ class AMP_Allowed_Tags_Generated { 'value' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'amp-app-banner', 'spec_name' => 'amp-app-banner button[open-button]', ), @@ -1870,7 +2180,6 @@ class AMP_Allowed_Tags_Generated { 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -1928,24 +2237,31 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'systemlanguage' => array(), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'word-spacing' => array(), 'writing-mode' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -1962,7 +2278,6 @@ class AMP_Allowed_Tags_Generated { 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -2017,24 +2332,31 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'systemlanguage' => array(), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'word-spacing' => array(), 'writing-mode' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -2075,11 +2397,7 @@ class AMP_Allowed_Tags_Generated { array( 'attr_spec_list' => array(), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-form extension .js script', - ), - 'mandatory_ancestor' => 'form', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-form.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-form', ), ), @@ -2096,7 +2414,6 @@ class AMP_Allowed_Tags_Generated { 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -2150,24 +2467,31 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'systemlanguage' => array(), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'word-spacing' => array(), 'writing-mode' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -2177,24 +2501,8 @@ class AMP_Allowed_Tags_Generated { 'attr_spec_list' => array( 'cite' => array( 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_empty' => true, 'allow_relative' => true, - 'allowed_protocol' => array( - 'fb-messenger', - 'ftp', - 'http', - 'https', - 'intent', - 'mailto', - 'skype', - 'sms', - 'snapchat', - 'tel', - 'tg', - 'threema', - 'twitter', - 'viber', - 'whatsapp', - ), ), 'datetime' => array(), ), @@ -2205,16 +2513,21 @@ class AMP_Allowed_Tags_Generated { 'desc' => array( array( 'attr_spec_list' => array( - 'class' => array(), - 'xml:base' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -2244,6 +2557,19 @@ class AMP_Allowed_Tags_Generated { ), 'tag_spec' => array(), + ), + array( + 'attr_spec_list' => array( + 'align' => array(), + 'submitting' => array( + 'mandatory' => true, + ), + ), + 'tag_spec' => array( + 'mandatory_parent' => 'form', + 'spec_name' => 'form > div [submitting]', + ), + ), array( 'attr_spec_list' => array( @@ -2291,7 +2617,6 @@ class AMP_Allowed_Tags_Generated { 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -2350,24 +2675,31 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'systemlanguage' => array(), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'word-spacing' => array(), 'writing-mode' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -2379,36 +2711,11 @@ class AMP_Allowed_Tags_Generated { ), ), - 'fieldset' => array( - array( - 'attr_spec_list' => array( - 'disabled' => array(), - 'name' => array(), - ), - 'tag_spec' => array(), - - ), - ), - 'figcaption' => array( - array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), - - ), - ), - 'figure' => array( - array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), - - ), - ), - 'filter' => array( + 'fecolormatrix' => array( array( 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -2422,13 +2729,10 @@ class AMP_Allowed_Tags_Generated { 'display' => array(), 'dominant-baseline' => array(), 'enable-background' => array(), - 'externalresourcesrequired' => array(), 'fill' => array(), 'fill-opacity' => array(), 'fill-rule' => array(), 'filter' => array(), - 'filterres' => array(), - 'filterunits' => array(), 'flood-color' => array(), 'flood-opacity' => array(), 'font-family' => array(), @@ -2442,6 +2746,7 @@ class AMP_Allowed_Tags_Generated { 'glyph-orientation-vertical' => array(), 'height' => array(), 'image-rendering' => array(), + 'in' => array(), 'kerning' => array(), 'letter-spacing' => array(), 'lighting-color' => array(), @@ -2452,7 +2757,7 @@ class AMP_Allowed_Tags_Generated { 'opacity' => array(), 'overflow' => array(), 'pointer-events' => array(), - 'primitiveunits' => array(), + 'result' => array(), 'shape-rendering' => array(), 'stop-color' => array(), 'stop-opacity' => array(), @@ -2464,25 +2769,21 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), + 'type' => array(), 'unicode-bidi' => array(), + 'values' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'width' => array(), 'word-spacing' => array(), 'writing-mode' => array(), 'x' => array(), - 'xlink:actuate' => array(), - 'xlink:arcrole' => array(), - 'xlink:href' => array( - 'value_regex' => '#.*', - ), - 'xlink:role' => array(), - 'xlink:show' => array(), - 'xlink:title' => array(), - 'xlink:type' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), @@ -2490,25 +2791,21 @@ class AMP_Allowed_Tags_Generated { 'y' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'footer' => array( - array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), - - ), - ), - 'foreignobject' => array( + 'fecomposite' => array( array( 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -2522,7 +2819,6 @@ class AMP_Allowed_Tags_Generated { 'display' => array(), 'dominant-baseline' => array(), 'enable-background' => array(), - 'externalresourcesrequired' => array(), 'fill' => array(), 'fill-opacity' => array(), 'fill-rule' => array(), @@ -2540,6 +2836,12 @@ class AMP_Allowed_Tags_Generated { 'glyph-orientation-vertical' => array(), 'height' => array(), 'image-rendering' => array(), + 'in' => array(), + 'in2' => array(), + 'k1' => array(), + 'k2' => array(), + 'k3' => array(), + 'k4' => array(), 'kerning' => array(), 'letter-spacing' => array(), 'lighting-color' => array(), @@ -2548,10 +2850,10 @@ class AMP_Allowed_Tags_Generated { 'marker-start' => array(), 'mask' => array(), 'opacity' => array(), + 'operator' => array(), 'overflow' => array(), 'pointer-events' => array(), - 'requiredextensions' => array(), - 'requiredfeatures' => array(), + 'result' => array(), 'shape-rendering' => array(), 'stop-color' => array(), 'stop-opacity' => array(), @@ -2563,18 +2865,19 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), - 'systemlanguage' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), - 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'width' => array(), 'word-spacing' => array(), 'writing-mode' => array(), 'x' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), @@ -2582,126 +2885,21 @@ class AMP_Allowed_Tags_Generated { 'y' => array(), ), 'tag_spec' => array( - 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', - ), - - ), - ), - 'form' => array( - array( - 'attr_spec_list' => array( - 'accept' => array(), - 'accept-charset' => array(), - 'action' => array( - 'blacklisted_value_regex' => '__amp_source_origin', - 'mandatory' => true, - 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), - 'disallowed_domain' => array( - 'cdn.ampproject.org', - ), - ), - 'action-xhr' => array( - 'blacklisted_value_regex' => '__amp_source_origin', - 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), - 'disallowed_domain' => array( - 'cdn.ampproject.org', - ), - ), - 'autocomplete' => array(), - 'custom-validation-reporting' => array( - 'value_regex' => '(show-first-on-submit|show-all-on-submit|as-you-go)', - ), - 'enctype' => array(), - 'method' => array( - 'value_casei' => 'get', - ), - 'name' => array(), - 'novalidate' => array(), - 'target' => array( - 'mandatory' => true, - 'value_regex_casei' => '(_blank|_top)', - ), - 'verify-xhr' => array( - 'blacklisted_value_regex' => '__amp_source_origin', - 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), - 'disallowed_domain' => array( - 'cdn.ampproject.org', - ), - ), - ), - 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-form extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-app-banner', - ), - 'spec_name' => 'form [method=get]', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-form.html', - ), - - ), - array( - 'attr_spec_list' => array( - 'accept' => array(), - 'accept-charset' => array(), - 'action-xhr' => array( - 'blacklisted_value_regex' => '__amp_source_origin', - 'mandatory' => true, - 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), - 'disallowed_domain' => array( - 'cdn.ampproject.org', - ), - ), - 'autocomplete' => array(), - 'custom-validation-reporting' => array( - 'value_regex' => '(show-first-on-submit|show-all-on-submit|as-you-go)', - ), - 'enctype' => array(), - 'method' => array( - 'dispatch_key' => true, - 'mandatory' => true, - 'value_casei' => 'post', - ), - 'name' => array(), - 'novalidate' => array(), - 'target' => array( - 'mandatory' => true, - 'value_regex_casei' => '(_blank|_top)', - ), - ), - 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-form extension .js script', - ), - 'disallowed_ancestor' => array( - 'amp-app-banner', + 'html_format' => array( + 'amp', + 'amp4ads', ), - 'spec_name' => 'form [method=post]', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-form.html', + 'mandatory_ancestor' => 'svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'g' => array( + 'feflood' => array( array( 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -2715,7 +2913,6 @@ class AMP_Allowed_Tags_Generated { 'display' => array(), 'dominant-baseline' => array(), 'enable-background' => array(), - 'externalresourcesrequired' => array(), 'fill' => array(), 'fill-opacity' => array(), 'fill-rule' => array(), @@ -2731,6 +2928,7 @@ class AMP_Allowed_Tags_Generated { 'font-weight' => array(), 'glyph-orientation-horizontal' => array(), 'glyph-orientation-vertical' => array(), + 'height' => array(), 'image-rendering' => array(), 'kerning' => array(), 'letter-spacing' => array(), @@ -2742,8 +2940,7 @@ class AMP_Allowed_Tags_Generated { 'opacity' => array(), 'overflow' => array(), 'pointer-events' => array(), - 'requiredextensions' => array(), - 'requiredfeatures' => array(), + 'result' => array(), 'shape-rendering' => array(), 'stop-color' => array(), 'stop-opacity' => array(), @@ -2755,35 +2952,41 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), - 'systemlanguage' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), - 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), + 'width' => array(), 'word-spacing' => array(), 'writing-mode' => array(), - 'xml:base' => array(), + 'x' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), + 'y' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'glyph' => array( + 'fegaussianblur' => array( array( 'attr_spec_list' => array( 'alignment-baseline' => array(), - 'arabic-form' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -2793,10 +2996,10 @@ class AMP_Allowed_Tags_Generated { 'color-profile' => array(), 'color-rendering' => array(), 'cursor' => array(), - 'd' => array(), 'direction' => array(), 'display' => array(), 'dominant-baseline' => array(), + 'edgemode' => array(), 'enable-background' => array(), 'fill' => array(), 'fill-opacity' => array(), @@ -2811,11 +3014,11 @@ class AMP_Allowed_Tags_Generated { 'font-style' => array(), 'font-variant' => array(), 'font-weight' => array(), - 'glyph-name' => array(), 'glyph-orientation-horizontal' => array(), 'glyph-orientation-vertical' => array(), - 'horiz-adv-x' => array(), + 'height' => array(), 'image-rendering' => array(), + 'in' => array(), 'kerning' => array(), 'letter-spacing' => array(), 'lighting-color' => array(), @@ -2824,10 +3027,11 @@ class AMP_Allowed_Tags_Generated { 'marker-start' => array(), 'mask' => array(), 'opacity' => array(), - 'orientation' => array(), 'overflow' => array(), 'pointer-events' => array(), + 'result' => array(), 'shape-rendering' => array(), + 'stddeviation' => array(), 'stop-color' => array(), 'stop-opacity' => array(), 'stroke' => array(), @@ -2838,36 +3042,41 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), - 'unicode' => array(), 'unicode-bidi' => array(), - 'vert-adv-y' => array(), - 'vert-origin-x' => array(), - 'vert-origin-y' => array(), + 'vector-effect' => array(), 'visibility' => array(), + 'width' => array(), 'word-spacing' => array(), 'writing-mode' => array(), - 'xml:base' => array(), + 'x' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), + 'y' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'glyphref' => array( + 'femerge' => array( array( 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -2880,8 +3089,6 @@ class AMP_Allowed_Tags_Generated { 'direction' => array(), 'display' => array(), 'dominant-baseline' => array(), - 'dx' => array(), - 'dy' => array(), 'enable-background' => array(), 'fill' => array(), 'fill-opacity' => array(), @@ -2896,10 +3103,9 @@ class AMP_Allowed_Tags_Generated { 'font-style' => array(), 'font-variant' => array(), 'font-weight' => array(), - 'format' => array(), 'glyph-orientation-horizontal' => array(), 'glyph-orientation-vertical' => array(), - 'glyphref' => array(), + 'height' => array(), 'image-rendering' => array(), 'kerning' => array(), 'letter-spacing' => array(), @@ -2911,6 +3117,7 @@ class AMP_Allowed_Tags_Generated { 'opacity' => array(), 'overflow' => array(), 'pointer-events' => array(), + 'result' => array(), 'shape-rendering' => array(), 'stop-color' => array(), 'stop-opacity' => array(), @@ -2922,24 +3129,19 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), + 'width' => array(), 'word-spacing' => array(), 'writing-mode' => array(), 'x' => array(), - 'xlink:actuate' => array(), - 'xlink:arcrole' => array(), - 'xlink:href' => array( - 'value_regex' => '#.*', - ), - 'xlink:role' => array(), - 'xlink:show' => array(), - 'xlink:title' => array(), - 'xlink:type' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), @@ -2947,125 +3149,44 @@ class AMP_Allowed_Tags_Generated { 'y' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', - ), - - ), - ), - 'h1' => array( - array( - 'attr_spec_list' => array( - 'align' => array(), - ), - 'tag_spec' => array(), - - ), - ), - 'h2' => array( - array( - 'attr_spec_list' => array( - 'align' => array(), - ), - 'tag_spec' => array(), - - ), - ), - 'h3' => array( - array( - 'attr_spec_list' => array( - 'align' => array(), - ), - 'tag_spec' => array(), - - ), - ), - 'h4' => array( - array( - 'attr_spec_list' => array( - 'align' => array(), - ), - 'tag_spec' => array(), - - ), - ), - 'h5' => array( - array( - 'attr_spec_list' => array( - 'align' => array(), + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), - 'tag_spec' => array(), ), ), - 'h6' => array( + 'femergenode' => array( array( 'attr_spec_list' => array( - 'align' => array(), + 'in' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), + 'xml:lang' => array(), + 'xml:space' => array(), + 'xmlns' => array(), + 'xmlns:xlink' => array(), ), - 'tag_spec' => array(), - - ), - ), - 'header' => array( - array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), - - ), - ), - 'hgroup' => array( - array( - 'attr_spec_list' => array(), 'tag_spec' => array( 'html_format' => array( 'amp', + 'amp4ads', ), + 'mandatory_ancestor' => 'svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'hkern' => array( - array( - 'attr_spec_list' => array( - 'g1' => array(), - 'g2' => array(), - 'k' => array(), - 'u1' => array(), - 'u2' => array(), - 'xml:base' => array(), - 'xml:lang' => array(), - 'xml:space' => array(), - 'xmlns' => array(), - 'xmlns:xlink' => array(), - ), - 'tag_spec' => array( - 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', - ), - - ), - ), - 'hr' => array( - array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), - - ), - ), - 'i' => array( - array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), - - ), - ), - 'image' => array( + 'feoffset' => array( array( 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -3078,8 +3199,9 @@ class AMP_Allowed_Tags_Generated { 'direction' => array(), 'display' => array(), 'dominant-baseline' => array(), + 'dx' => array(), + 'dy' => array(), 'enable-background' => array(), - 'externalresourcesrequired' => array(), 'fill' => array(), 'fill-opacity' => array(), 'fill-rule' => array(), @@ -3097,6 +3219,7 @@ class AMP_Allowed_Tags_Generated { 'glyph-orientation-vertical' => array(), 'height' => array(), 'image-rendering' => array(), + 'in' => array(), 'kerning' => array(), 'letter-spacing' => array(), 'lighting-color' => array(), @@ -3107,9 +3230,7 @@ class AMP_Allowed_Tags_Generated { 'opacity' => array(), 'overflow' => array(), 'pointer-events' => array(), - 'preserveaspectratio' => array(), - 'requiredextensions' => array(), - 'requiredfeatures' => array(), + 'result' => array(), 'shape-rendering' => array(), 'stop-color' => array(), 'stop-opacity' => array(), @@ -3121,199 +3242,68 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), - 'systemlanguage' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), - 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'width' => array(), 'word-spacing' => array(), 'writing-mode' => array(), 'x' => array(), - 'xlink:actuate' => array(), - 'xlink:arcrole' => array(), - 'xlink:href' => array( - 'blacklisted_value_regex' => '(^|\\s)data:image\\/svg\\+xml', - 'allow_empty' => false, - 'allow_relative' => false, - 'allowed_protocol' => array( - 'data', - ), - ), - 'xlink:role' => array(), - 'xlink:show' => array(), - 'xlink:title' => array(), - 'xlink:type' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), 'y' => array(), ), - 'tag_spec' => array( - 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', - ), - - ), - ), - 'img' => array( - array( - 'attr_spec_list' => array( - 'alt' => array(), - 'border' => array(), - 'height' => array(), - 'ismap' => array(), - 'longdesc' => array( - 'blacklisted_value_regex' => '__amp_source_origin', - 'allow_relative' => true, - 'allowed_protocol' => array( - 'http', - 'https', - ), - ), - 'src' => array( - 'alternative_names' => array( - 'srcset', - ), - 'blacklisted_value_regex' => '__amp_source_origin', - 'mandatory' => true, - 'allow_relative' => true, - 'allowed_protocol' => array( - 'data', - 'https', - ), - ), - 'width' => array(), - ), 'tag_spec' => array( 'html_format' => array( 'amp', + 'amp4ads', ), - 'mandatory_ancestor' => 'noscript', - 'mandatory_ancestor_suggested_alternative' => 'amp-img', - 'spec_url' => 'https://www.ampproject.org/docs/reference/amp-img.html', + 'mandatory_ancestor' => 'svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'input' => array( + 'fieldset' => array( array( 'attr_spec_list' => array( - 'accept' => array(), - 'accesskey' => array(), - 'autocomplete' => array(), - 'autofocus' => array(), - 'checked' => array(), - 'default-value' => array(), + '[disabled]' => array(), 'disabled' => array(), - 'height' => array(), - 'inputmode' => array(), - 'list' => array(), - 'max' => array(), - 'maxlength' => array(), - 'min' => array(), - 'minlength' => array(), - 'multiple' => array(), 'name' => array( - 'blacklisted_value_regex' => '__amp_source_origin', - ), - 'pattern' => array(), - 'placeholder' => array(), - 'readonly' => array(), - 'required' => array(), - 'selectiondirection' => array(), - 'size' => array(), - 'spellcheck' => array(), - 'step' => array(), - 'tabindex' => array(), - 'type' => array( - 'blacklisted_value_regex' => '(^|\\s)(button|file|image|password|)(\\s|$)', - ), - 'value' => array(), - 'width' => array(), - ), - 'tag_spec' => array( - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-form.html', - ), - - ), - ), - 'ins' => array( - array( - 'attr_spec_list' => array( - 'cite' => array( - 'blacklisted_value_regex' => '__amp_source_origin', - 'allow_relative' => true, - 'allowed_protocol' => array( - 'fb-messenger', - 'ftp', - 'http', - 'https', - 'intent', - 'mailto', - 'skype', - 'sms', - 'snapchat', - 'tel', - 'tg', - 'threema', - 'twitter', - 'viber', - 'whatsapp', - ), + 'blacklisted_value_regex' => '(^|\\s)(__amp_\\s*|__count__|__definegetter__|__definesetter__|__lookupgetter__|__lookupsetter__|__nosuchmethod__|__parent__|__proto__|__amp_\\s*|\\$p|\\$proxy|acceptcharset|addeventlistener|appendchild|assignedslot|attachshadow|baseuri|checkvalidity|childelementcount|childnodes|classlist|classname|clientheight|clientleft|clienttop|clientwidth|comparedocumentposition|computedname|computedrole|contenteditable|createshadowroot|enqueaction|firstchild|firstelementchild|getanimations|getattribute|getattributens|getattributenode|getattributenodens|getboundingclientrect|getclientrects|getdestinationinsertionpoints|getelementsbyclassname|getelementsbytagname|getelementsbytagnamens|getrootnode|hasattribute|hasattributens|hasattributes|haschildnodes|haspointercapture|innerhtml|innertext|inputmode|insertadjacentelement|insertadjacenthtml|insertadjacenttext|iscontenteditable|isdefaultnamespace|isequalnode|issamenode|lastchild|lastelementchild|lookupnamespaceuri|namespaceuri|nextelementsibling|nextsibling|nodename|nodetype|nodevalue|offsetheight|offsetleft|offsetparent|offsettop|offsetwidth|outerhtml|outertext|ownerdocument|parentelement|parentnode|previouselementsibling|previoussibling|queryselector|queryselectorall|releasepointercapture|removeattribute|removeattributens|removeattributenode|removechild|removeeventlistener|replacechild|reportvalidity|requestpointerlock|scrollheight|scrollintoview|scrollintoviewifneeded|scrollleft|scrollwidth|setattribute|setattributens|setattributenode|setattributenodens|setpointercapture|shadowroot|stylemap|tabindex|tagname|textcontent|tostring|valueof|(webkit|ms|moz|o)dropzone|(webkit|moz|ms|o)matchesselector|(webkit|moz|ms|o)requestfullscreen|(webkit|moz|ms|o)requestfullscreen)(\\s|$)', ), - 'datetime' => array(), ), 'tag_spec' => array(), ), ), - 'kbd' => array( + 'figcaption' => array( array( 'attr_spec_list' => array(), 'tag_spec' => array(), ), ), - 'label' => array( - array( - 'attr_spec_list' => array( - 'for' => array(), - ), - 'tag_spec' => array( - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-form.html', - ), - - ), - ), - 'legend' => array( + 'figure' => array( array( 'attr_spec_list' => array(), 'tag_spec' => array(), ), ), - 'li' => array( - array( - 'attr_spec_list' => array( - 'value' => array( - 'value_regex' => '[0-9]*', - ), - ), - 'tag_spec' => array(), - - ), - ), - 'line' => array( + 'filter' => array( array( 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -3332,6 +3322,8 @@ class AMP_Allowed_Tags_Generated { 'fill-opacity' => array(), 'fill-rule' => array(), 'filter' => array(), + 'filterres' => array(), + 'filterunits' => array(), 'flood-color' => array(), 'flood-opacity' => array(), 'font-family' => array(), @@ -3343,6 +3335,7 @@ class AMP_Allowed_Tags_Generated { 'font-weight' => array(), 'glyph-orientation-horizontal' => array(), 'glyph-orientation-vertical' => array(), + 'height' => array(), 'image-rendering' => array(), 'kerning' => array(), 'letter-spacing' => array(), @@ -3354,10 +3347,8 @@ class AMP_Allowed_Tags_Generated { 'opacity' => array(), 'overflow' => array(), 'pointer-events' => array(), - 'requiredextensions' => array(), - 'requiredfeatures' => array(), + 'primitiveunits' => array(), 'shape-rendering' => array(), - 'sketch:type' => array(), 'stop-color' => array(), 'stop-opacity' => array(), 'stroke' => array(), @@ -3368,38 +3359,61 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), - 'systemlanguage' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), - 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), + 'width' => array(), 'word-spacing' => array(), 'writing-mode' => array(), - 'x1' => array(), - 'x2' => array(), - 'xml:base' => array(), + 'x' => array(), + 'xlink:actuate' => array(), + 'xlink:arcrole' => array(), + 'xlink:href' => array( + 'alternative_names' => array( + 'href', + ), + 'allow_empty' => false, + 'allow_relative' => true, + ), + 'xlink:role' => array(), + 'xlink:show' => array(), + 'xlink:title' => array(), + 'xlink:type' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), - 'y1' => array(), - 'y2' => array(), + 'y' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'lineargradient' => array( + 'footer' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array(), + + ), + ), + 'foreignobject' => array( array( 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -3429,8 +3443,7 @@ class AMP_Allowed_Tags_Generated { 'font-weight' => array(), 'glyph-orientation-horizontal' => array(), 'glyph-orientation-vertical' => array(), - 'gradienttransform' => array(), - 'gradientunits' => array(), + 'height' => array(), 'image-rendering' => array(), 'kerning' => array(), 'letter-spacing' => array(), @@ -3442,8 +3455,9 @@ class AMP_Allowed_Tags_Generated { 'opacity' => array(), 'overflow' => array(), 'pointer-events' => array(), + 'requiredextensions' => array(), + 'requiredfeatures' => array(), 'shape-rendering' => array(), - 'spreadmethod' => array(), 'stop-color' => array(), 'stop-opacity' => array(), 'stroke' => array(), @@ -3454,148 +3468,130 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), + 'systemlanguage' => array(), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), + 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), + 'width' => array(), 'word-spacing' => array(), 'writing-mode' => array(), - 'x1' => array(), - 'x2' => array(), - 'xlink:actuate' => array(), - 'xlink:arcrole' => array(), - 'xlink:href' => array( - 'value_regex' => '#.*', - ), - 'xlink:role' => array(), - 'xlink:show' => array(), - 'xlink:title' => array(), - 'xlink:type' => array(), - 'xml:base' => array(), + 'x' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), - 'y1' => array(), - 'y2' => array(), + 'y' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'link' => array( + 'form' => array( array( 'attr_spec_list' => array( - 'charset' => array( - 'value_casei' => 'utf-8', - ), - 'color' => array(), - 'href' => array(), - 'hreflang' => array(), - 'media' => array(), - 'rel' => array( - 'blacklisted_value_regex' => '(^|\\s)(canonical|components|import|manifest|serviceworker|stylesheet|subresource|)(\\s|$)', + 'accept' => array(), + 'accept-charset' => array(), + 'action' => array( + 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, + 'allow_relative' => true, ), - 'sizes' => array(), - 'target' => array(), - 'type' => array(), - ), - 'tag_spec' => array( - 'disallowed_ancestor' => array( - 'template', + 'action-xhr' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_relative' => true, ), - 'spec_name' => 'link rel=', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#html-tags', - ), - - ), - array( - 'attr_spec_list' => array( - 'charset' => array( - 'value_casei' => 'utf-8', + 'autocomplete' => array(), + 'custom-validation-reporting' => array( + 'value_regex' => '(show-first-on-submit|show-all-on-submit|as-you-go|interact-and-submit)', ), - 'color' => array(), - 'href' => array( - 'mandatory' => true, + 'enctype' => array(), + 'method' => array( + 'value_casei' => 'get', ), - 'hreflang' => array(), - 'itemprop' => array( - 'dispatch_key' => true, + 'name' => array(), + 'novalidate' => array(), + 'target' => array( 'mandatory' => true, - 'value_casei' => 'sameas', + 'value_regex_casei' => '(_blank|_top)', + ), + 'verify-xhr' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_relative' => true, ), - 'media' => array(), - 'sizes' => array(), - 'target' => array(), - 'type' => array(), ), 'tag_spec' => array( - 'spec_name' => 'link itemprop=sameas', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#html-tags', + 'disallowed_ancestor' => array( + 'amp-app-banner', + ), + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'spec_name' => 'form [method=get]', ), ), array( 'attr_spec_list' => array( - 'charset' => array( - 'value_casei' => 'utf-8', + 'accept' => array(), + 'accept-charset' => array(), + 'action-xhr' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'mandatory' => true, + 'allow_relative' => true, ), - 'color' => array(), - 'href' => array( + 'autocomplete' => array(), + 'custom-validation-reporting' => array( + 'value_regex' => '(show-first-on-submit|show-all-on-submit|as-you-go)', + ), + 'enctype' => array(), + 'method' => array( 'mandatory' => true, + 'value_casei' => 'post', ), - 'hreflang' => array(), - 'itemprop' => array( + 'name' => array(), + 'novalidate' => array(), + 'target' => array( 'mandatory' => true, + 'value_regex_casei' => '(_blank|_top)', + ), + 'verify-xhr' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_relative' => true, ), - 'media' => array(), - 'sizes' => array(), - 'target' => array(), - 'type' => array(), - ), - 'tag_spec' => array( - 'spec_name' => 'link itemprop=', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#html-tags', ), - - ), - ), - 'listing' => array( - array( - 'attr_spec_list' => array(), 'tag_spec' => array( + 'disallowed_ancestor' => array( + 'amp-app-banner', + ), 'html_format' => array( 'amp', + 'amp4ads', ), + 'spec_name' => 'form [method=post]', ), ), ), - 'main' => array( - array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), - - ), - ), - 'mark' => array( - array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), - - ), - ), - 'marker' => array( + 'g' => array( array( 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -3632,17 +3628,12 @@ class AMP_Allowed_Tags_Generated { 'marker-end' => array(), 'marker-mid' => array(), 'marker-start' => array(), - 'markerheight' => array(), - 'markerunits' => array(), - 'markerwidth' => array(), 'mask' => array(), 'opacity' => array(), - 'orient' => array(), 'overflow' => array(), 'pointer-events' => array(), - 'preserveaspectratio' => array(), - 'refx' => array(), - 'refy' => array(), + 'requiredextensions' => array(), + 'requiredfeatures' => array(), 'shape-rendering' => array(), 'stop-color' => array(), 'stop-opacity' => array(), @@ -3654,34 +3645,41 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), + 'systemlanguage' => array(), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), 'transform' => array(), 'unicode-bidi' => array(), - 'viewbox' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'word-spacing' => array(), 'writing-mode' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'mask' => array( + 'glyph' => array( array( 'attr_spec_list' => array( 'alignment-baseline' => array(), + 'arabic-form' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -3691,11 +3689,11 @@ class AMP_Allowed_Tags_Generated { 'color-profile' => array(), 'color-rendering' => array(), 'cursor' => array(), + 'd' => array(), 'direction' => array(), 'display' => array(), 'dominant-baseline' => array(), 'enable-background' => array(), - 'externalresourcesrequired' => array(), 'fill' => array(), 'fill-opacity' => array(), 'fill-rule' => array(), @@ -3709,9 +3707,10 @@ class AMP_Allowed_Tags_Generated { 'font-style' => array(), 'font-variant' => array(), 'font-weight' => array(), + 'glyph-name' => array(), 'glyph-orientation-horizontal' => array(), 'glyph-orientation-vertical' => array(), - 'height' => array(), + 'horiz-adv-x' => array(), 'image-rendering' => array(), 'kerning' => array(), 'letter-spacing' => array(), @@ -3720,13 +3719,10 @@ class AMP_Allowed_Tags_Generated { 'marker-mid' => array(), 'marker-start' => array(), 'mask' => array(), - 'maskcontentunits' => array(), - 'maskunits' => array(), 'opacity' => array(), + 'orientation' => array(), 'overflow' => array(), 'pointer-events' => array(), - 'requiredextensions' => array(), - 'requiredfeatures' => array(), 'shape-rendering' => array(), 'stop-color' => array(), 'stop-opacity' => array(), @@ -3738,204 +3734,200 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), - 'systemlanguage' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), + 'unicode' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), + 'vert-adv-y' => array(), + 'vert-origin-x' => array(), + 'vert-origin-y' => array(), 'visibility' => array(), - 'width' => array(), 'word-spacing' => array(), 'writing-mode' => array(), - 'x' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), - 'y' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'meta' => array( + 'glyphref' => array( array( 'attr_spec_list' => array( - 'content' => array( - 'mandatory' => true, + 'alignment-baseline' => array(), + 'baseline-shift' => array(), + 'clip' => array(), + 'clip-path' => array(), + 'clip-rule' => array(), + 'color' => array(), + 'color-interpolation' => array(), + 'color-interpolation-filters' => array(), + 'color-profile' => array(), + 'color-rendering' => array(), + 'cursor' => array(), + 'direction' => array(), + 'display' => array(), + 'dominant-baseline' => array(), + 'dx' => array(), + 'dy' => array(), + 'enable-background' => array(), + 'fill' => array(), + 'fill-opacity' => array(), + 'fill-rule' => array(), + 'filter' => array(), + 'flood-color' => array(), + 'flood-opacity' => array(), + 'font-family' => array(), + 'font-size' => array(), + 'font-size-adjust' => array(), + 'font-stretch' => array(), + 'font-style' => array(), + 'font-variant' => array(), + 'font-weight' => array(), + 'format' => array(), + 'glyph-orientation-horizontal' => array(), + 'glyph-orientation-vertical' => array(), + 'glyphref' => array(), + 'image-rendering' => array(), + 'kerning' => array(), + 'letter-spacing' => array(), + 'lighting-color' => array(), + 'marker-end' => array(), + 'marker-mid' => array(), + 'marker-start' => array(), + 'mask' => array(), + 'opacity' => array(), + 'overflow' => array(), + 'pointer-events' => array(), + 'shape-rendering' => array(), + 'stop-color' => array(), + 'stop-opacity' => array(), + 'stroke' => array(), + 'stroke-dasharray' => array(), + 'stroke-dashoffset' => array(), + 'stroke-linecap' => array(), + 'stroke-linejoin' => array(), + 'stroke-miterlimit' => array(), + 'stroke-opacity' => array(), + 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', ), - 'http-equiv' => array( - 'dispatch_key' => true, - 'mandatory' => true, - 'value_casei' => 'x-ua-compatible', + 'text-anchor' => array(), + 'text-decoration' => array(), + 'text-rendering' => array(), + 'unicode-bidi' => array(), + 'vector-effect' => array(), + 'visibility' => array(), + 'word-spacing' => array(), + 'writing-mode' => array(), + 'x' => array(), + 'xlink:actuate' => array(), + 'xlink:arcrole' => array(), + 'xlink:href' => array( + 'alternative_names' => array( + 'href', + ), + 'allow_empty' => false, + 'allow_relative' => true, ), + 'xlink:role' => array(), + 'xlink:show' => array(), + 'xlink:title' => array(), + 'xlink:type' => array(), + 'xml:lang' => array(), + 'xml:space' => array(), + 'xmlns' => array(), + 'xmlns:xlink' => array(), + 'y' => array(), ), 'tag_spec' => array( - 'spec_name' => 'meta http-equiv=x-ua-compatible', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#html-tags', + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), + ), + 'h1' => array( array( 'attr_spec_list' => array( - 'content' => array(), - 'itemprop' => array(), - 'name' => array( - 'blacklisted_value_regex' => '(^|\\s)(viewport|content-disposition|revisit-after|apple-itunes-app)(\\s|$)', - ), - 'property' => array(), - ), - 'tag_spec' => array( - 'spec_name' => 'meta name= and content=', + 'align' => array(), ), + 'tag_spec' => array(), ), + ), + 'h2' => array( array( 'attr_spec_list' => array( - 'content' => array( - 'mandatory' => true, - 'value_casei' => 'text/html; charset=utf-8', - ), - 'http-equiv' => array( - 'dispatch_key' => true, - 'mandatory' => true, - 'value_casei' => 'content-type', - ), - ), - 'tag_spec' => array( - 'spec_name' => 'meta http-equiv=content-type', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#html-tags', - ), - - ), - array( - 'attr_spec_list' => array( - 'content' => array( - 'mandatory' => true, - ), - 'http-equiv' => array( - 'dispatch_key' => true, - 'mandatory' => true, - 'value_casei' => 'content-language', - ), - ), - 'tag_spec' => array( - 'spec_name' => 'meta http-equiv=content-language', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#html-tags', - ), - - ), - array( - 'attr_spec_list' => array( - 'content' => array( - 'mandatory' => true, - ), - 'http-equiv' => array( - 'dispatch_key' => true, - 'mandatory' => true, - 'value_casei' => 'pics-label', - ), - ), - 'tag_spec' => array( - 'spec_name' => 'meta http-equiv=pics-label', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#html-tags', - ), - - ), - array( - 'attr_spec_list' => array( - 'content' => array( - 'mandatory' => true, - ), - 'http-equiv' => array( - 'dispatch_key' => true, - 'mandatory' => true, - 'value_casei' => 'imagetoolbar', - ), - ), - 'tag_spec' => array( - 'spec_name' => 'meta http-equiv=imagetoolbar', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#html-tags', + 'align' => array(), ), + 'tag_spec' => array(), ), + ), + 'h3' => array( array( 'attr_spec_list' => array( - 'content' => array( - 'mandatory' => true, - 'value_casei' => 'text/css', - ), - 'http-equiv' => array( - 'dispatch_key' => true, - 'mandatory' => true, - 'value_casei' => 'content-style-type', - ), - ), - 'tag_spec' => array( - 'spec_name' => 'meta http-equiv=content-style-type', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#html-tags', + 'align' => array(), ), + 'tag_spec' => array(), ), + ), + 'h4' => array( array( 'attr_spec_list' => array( - 'content' => array( - 'mandatory' => true, - 'value_casei' => 'text/javascript', - ), - 'http-equiv' => array( - 'dispatch_key' => true, - 'mandatory' => true, - 'value_casei' => 'content-script-type', - ), - ), - 'tag_spec' => array( - 'spec_name' => 'meta http-equiv=content-script-type', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#html-tags', + 'align' => array(), ), + 'tag_spec' => array(), ), + ), + 'h5' => array( array( 'attr_spec_list' => array( - 'content' => array( - 'mandatory' => true, - ), - 'http-equiv' => array( - 'dispatch_key' => true, - 'mandatory' => true, - 'value_casei' => 'resource-type', - ), - ), - 'tag_spec' => array( - 'spec_name' => 'meta http-equiv=resource-type', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#html-tags', + 'align' => array(), ), + 'tag_spec' => array(), ), ), - 'multicol' => array( + 'h6' => array( array( - 'attr_spec_list' => array(), - 'tag_spec' => array( - 'html_format' => array( - 'amp', - ), + 'attr_spec_list' => array( + 'align' => array(), ), + 'tag_spec' => array(), ), ), - 'nav' => array( + 'header' => array( array( 'attr_spec_list' => array(), 'tag_spec' => array(), ), ), - 'nextid' => array( + 'hgroup' => array( array( 'attr_spec_list' => array(), 'tag_spec' => array( @@ -3946,109 +3938,86 @@ class AMP_Allowed_Tags_Generated { ), ), - 'nobr' => array( + 'hkern' => array( array( - 'attr_spec_list' => array(), + 'attr_spec_list' => array( + 'g1' => array(), + 'g2' => array(), + 'k' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), + 'u1' => array(), + 'u2' => array(), + 'xml:lang' => array(), + 'xml:space' => array(), + 'xmlns' => array(), + 'xmlns:xlink' => array(), + ), 'tag_spec' => array( 'html_format' => array( 'amp', + 'amp4ads', ), + 'mandatory_ancestor' => 'svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'noscript' => array( + 'hr' => array( array( 'attr_spec_list' => array(), - 'tag_spec' => array( - 'disallowed_ancestor' => array( - 'noscript', - ), - 'html_format' => array( - 'amp', - ), - 'mandatory_ancestor' => 'body', - ), + 'tag_spec' => array(), ), ), - 'o:p' => array( + 'i' => array( array( 'attr_spec_list' => array(), - 'tag_spec' => array( - 'html_format' => array( - 'amp', - ), - ), + 'tag_spec' => array(), ), ), - 'ol' => array( + 'iframe' => array( array( 'attr_spec_list' => array( - 'reversed' => array( - 'value' => '', + 'frameborder' => array( + 'value_regex' => '0|1', ), - 'start' => array( - 'value_regex' => '[0-9]*', + 'height' => array(), + 'name' => array(), + 'referrerpolicy' => array(), + 'resizable' => array( + 'value' => '', ), - 'type' => array( - 'value_regex' => '[1aaii]', + 'sandbox' => array(), + 'scrolling' => array( + 'value_regex' => 'auto|yes|no', ), - ), - 'tag_spec' => array(), - - ), - ), - 'optgroup' => array( - array( - 'attr_spec_list' => array( - 'disabled' => array(), - 'label' => array(), - ), - 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-form extension .js script', + 'src' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_relative' => false, ), - 'mandatory_parent' => 'select', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-form.html', - ), - - ), - ), - 'option' => array( - array( - 'attr_spec_list' => array( - 'disabled' => array(), - 'label' => array(), - 'selected' => array(), - 'value' => array(), + 'srcdoc' => array(), + 'width' => array(), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-form extension .js script', + 'html_format' => array( + 'amp', ), - 'mandatory_ancestor' => 'form', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-form.html', - ), - - ), - ), - 'p' => array( - array( - 'attr_spec_list' => array( - 'align' => array(), + 'mandatory_ancestor' => 'noscript', + 'mandatory_ancestor_suggested_alternative' => 'amp-iframe', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-iframe', ), - 'tag_spec' => array(), ), ), - 'path' => array( + 'image' => array( array( 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -4058,7 +4027,6 @@ class AMP_Allowed_Tags_Generated { 'color-profile' => array(), 'color-rendering' => array(), 'cursor' => array(), - 'd' => array(), 'direction' => array(), 'display' => array(), 'dominant-baseline' => array(), @@ -4079,6 +4047,7 @@ class AMP_Allowed_Tags_Generated { 'font-weight' => array(), 'glyph-orientation-horizontal' => array(), 'glyph-orientation-vertical' => array(), + 'height' => array(), 'image-rendering' => array(), 'kerning' => array(), 'letter-spacing' => array(), @@ -4089,12 +4058,11 @@ class AMP_Allowed_Tags_Generated { 'mask' => array(), 'opacity' => array(), 'overflow' => array(), - 'pathlength' => array(), 'pointer-events' => array(), + 'preserveaspectratio' => array(), 'requiredextensions' => array(), 'requiredfeatures' => array(), 'shape-rendering' => array(), - 'sketch:type' => array(), 'stop-color' => array(), 'stop-opacity' => array(), 'stroke' => array(), @@ -4105,132 +4073,203 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'systemlanguage' => array(), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), + 'width' => array(), 'word-spacing' => array(), 'writing-mode' => array(), - 'xml:base' => array(), + 'x' => array(), + 'xlink:actuate' => array(), + 'xlink:arcrole' => array(), + 'xlink:href' => array( + 'alternative_names' => array( + 'href', + ), + 'blacklisted_value_regex' => '(^|\\s)data:image\\/svg\\+xml', + 'allow_empty' => false, + 'allow_relative' => true, + ), + 'xlink:role' => array(), + 'xlink:show' => array(), + 'xlink:title' => array(), + 'xlink:type' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), + 'y' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'pattern' => array( + 'img' => array( array( 'attr_spec_list' => array( - 'alignment-baseline' => array(), - 'baseline-shift' => array(), - 'class' => array(), - 'clip' => array(), - 'clip-path' => array(), - 'clip-rule' => array(), - 'color' => array(), - 'color-interpolation' => array(), - 'color-interpolation-filters' => array(), - 'color-profile' => array(), - 'color-rendering' => array(), - 'cursor' => array(), - 'direction' => array(), - 'display' => array(), - 'dominant-baseline' => array(), - 'enable-background' => array(), - 'externalresourcesrequired' => array(), - 'fill' => array(), - 'fill-opacity' => array(), - 'fill-rule' => array(), - 'filter' => array(), - 'flood-color' => array(), - 'flood-opacity' => array(), - 'font-family' => array(), - 'font-size' => array(), - 'font-size-adjust' => array(), - 'font-stretch' => array(), - 'font-style' => array(), - 'font-variant' => array(), - 'font-weight' => array(), - 'glyph-orientation-horizontal' => array(), - 'glyph-orientation-vertical' => array(), + 'alt' => array(), + 'border' => array(), 'height' => array(), - 'image-rendering' => array(), - 'kerning' => array(), - 'letter-spacing' => array(), - 'lighting-color' => array(), - 'marker-end' => array(), - 'marker-mid' => array(), - 'marker-start' => array(), - 'mask' => array(), - 'opacity' => array(), - 'overflow' => array(), - 'patterncontentunits' => array(), - 'patterntransform' => array(), - 'patternunits' => array(), - 'pointer-events' => array(), - 'preserveaspectratio' => array(), - 'requiredextensions' => array(), - 'requiredfeatures' => array(), - 'shape-rendering' => array(), - 'stop-color' => array(), - 'stop-opacity' => array(), - 'stroke' => array(), - 'stroke-dasharray' => array(), - 'stroke-dashoffset' => array(), - 'stroke-linecap' => array(), - 'stroke-linejoin' => array(), - 'stroke-miterlimit' => array(), - 'stroke-opacity' => array(), - 'stroke-width' => array(), - 'systemlanguage' => array(), - 'text-anchor' => array(), - 'text-decoration' => array(), - 'text-rendering' => array(), - 'unicode-bidi' => array(), - 'viewbox' => array(), - 'visibility' => array(), + 'ismap' => array(), + 'longdesc' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_relative' => true, + ), + 'src' => array( + 'alternative_names' => array( + 'srcset', + ), + 'blacklisted_value_regex' => '__amp_source_origin', + 'mandatory' => true, + 'allow_relative' => true, + ), 'width' => array(), - 'word-spacing' => array(), - 'writing-mode' => array(), - 'x' => array(), - 'xlink:actuate' => array(), - 'xlink:arcrole' => array(), - 'xlink:href' => array( - 'value_regex' => '#.*', + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', ), - 'xlink:role' => array(), - 'xlink:show' => array(), - 'xlink:title' => array(), - 'xlink:type' => array(), - 'xml:base' => array(), - 'xml:lang' => array(), - 'xml:space' => array(), - 'xmlns' => array(), - 'xmlns:xlink' => array(), - 'y' => array(), + 'mandatory_ancestor' => 'noscript', + 'mandatory_ancestor_suggested_alternative' => 'amp-img', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-img', + ), + + ), + ), + 'input' => array( + array( + 'attr_spec_list' => array( + '[accept]' => array(), + '[accesskey]' => array(), + '[autocomplete]' => array(), + '[checked]' => array(), + '[disabled]' => array(), + '[height]' => array(), + '[inputmode]' => array(), + '[max]' => array(), + '[maxlength]' => array(), + '[min]' => array(), + '[minlength]' => array(), + '[multiple]' => array(), + '[pattern]' => array(), + '[placeholder]' => array(), + '[readonly]' => array(), + '[required]' => array(), + '[selectiondirection]' => array(), + '[size]' => array(), + '[spellcheck]' => array(), + '[step]' => array(), + '[type]' => array(), + '[value]' => array(), + '[width]' => array(), + 'accept' => array(), + 'accesskey' => array(), + 'autocomplete' => array(), + 'autofocus' => array(), + 'checked' => array(), + 'disabled' => array(), + 'height' => array(), + 'inputmode' => array(), + 'list' => array(), + 'max' => array(), + 'maxlength' => array(), + 'min' => array(), + 'minlength' => array(), + 'multiple' => array(), + 'name' => array( + 'blacklisted_value_regex' => '(^|\\s)(__amp_\\s*|__count__|__definegetter__|__definesetter__|__lookupgetter__|__lookupsetter__|__nosuchmethod__|__parent__|__proto__|__amp_\\s*|\\$p|\\$proxy|acceptcharset|addeventlistener|appendchild|assignedslot|attachshadow|baseuri|checkvalidity|childelementcount|childnodes|classlist|classname|clientheight|clientleft|clienttop|clientwidth|comparedocumentposition|computedname|computedrole|contenteditable|createshadowroot|enqueaction|firstchild|firstelementchild|getanimations|getattribute|getattributens|getattributenode|getattributenodens|getboundingclientrect|getclientrects|getdestinationinsertionpoints|getelementsbyclassname|getelementsbytagname|getelementsbytagnamens|getrootnode|hasattribute|hasattributens|hasattributes|haschildnodes|haspointercapture|innerhtml|innertext|inputmode|insertadjacentelement|insertadjacenthtml|insertadjacenttext|iscontenteditable|isdefaultnamespace|isequalnode|issamenode|lastchild|lastelementchild|lookupnamespaceuri|namespaceuri|nextelementsibling|nextsibling|nodename|nodetype|nodevalue|offsetheight|offsetleft|offsetparent|offsettop|offsetwidth|outerhtml|outertext|ownerdocument|parentelement|parentnode|previouselementsibling|previoussibling|queryselector|queryselectorall|releasepointercapture|removeattribute|removeattributens|removeattributenode|removechild|removeeventlistener|replacechild|reportvalidity|requestpointerlock|scrollheight|scrollintoview|scrollintoviewifneeded|scrollleft|scrollwidth|setattribute|setattributens|setattributenode|setattributenodens|setpointercapture|shadowroot|stylemap|tabindex|tagname|textcontent|tostring|valueof|(webkit|ms|moz|o)dropzone|(webkit|moz|ms|o)matchesselector|(webkit|moz|ms|o)requestfullscreen|(webkit|moz|ms|o)requestfullscreen)(\\s|$)', + ), + 'pattern' => array(), + 'placeholder' => array(), + 'readonly' => array(), + 'required' => array(), + 'selectiondirection' => array(), + 'size' => array(), + 'spellcheck' => array(), + 'step' => array(), + 'tabindex' => array(), + 'type' => array( + 'blacklisted_value_regex' => '(^|\\s)(button|file|image|password|)(\\s|$)', + ), + 'value' => array(), + 'width' => array(), ), 'tag_spec' => array( - 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-form', ), ), ), - 'polygon' => array( + 'ins' => array( + array( + 'attr_spec_list' => array( + 'cite' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_empty' => true, + 'allow_relative' => true, + ), + 'datetime' => array(), + ), + 'tag_spec' => array(), + + ), + ), + 'kbd' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array(), + + ), + ), + 'label' => array( + array( + 'attr_spec_list' => array( + 'for' => array(), + ), + 'tag_spec' => array( + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-form', + ), + + ), + ), + 'legend' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array(), + + ), + ), + 'li' => array( + array( + 'attr_spec_list' => array( + 'value' => array( + 'value_regex' => '[0-9]*', + ), + ), + 'tag_spec' => array(), + + ), + ), + 'line' => array( array( 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -4271,7 +4310,6 @@ class AMP_Allowed_Tags_Generated { 'opacity' => array(), 'overflow' => array(), 'pointer-events' => array(), - 'points' => array(), 'requiredextensions' => array(), 'requiredfeatures' => array(), 'shape-rendering' => array(), @@ -4286,34 +4324,44 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'systemlanguage' => array(), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'word-spacing' => array(), 'writing-mode' => array(), - 'xml:base' => array(), + 'x1' => array(), + 'x2' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), + 'y1' => array(), + 'y2' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'polyline' => array( + 'lineargradient' => array( array( 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -4343,6 +4391,8 @@ class AMP_Allowed_Tags_Generated { 'font-weight' => array(), 'glyph-orientation-horizontal' => array(), 'glyph-orientation-vertical' => array(), + 'gradienttransform' => array(), + 'gradientunits' => array(), 'image-rendering' => array(), 'kerning' => array(), 'letter-spacing' => array(), @@ -4354,11 +4404,8 @@ class AMP_Allowed_Tags_Generated { 'opacity' => array(), 'overflow' => array(), 'pointer-events' => array(), - 'points' => array(), - 'requiredextensions' => array(), - 'requiredfeatures' => array(), 'shape-rendering' => array(), - 'sketch:type' => array(), + 'spreadmethod' => array(), 'stop-color' => array(), 'stop-opacity' => array(), 'stroke' => array(), @@ -4369,81 +4416,206 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), - 'systemlanguage' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), - 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'word-spacing' => array(), 'writing-mode' => array(), - 'xml:base' => array(), + 'x1' => array(), + 'x2' => array(), + 'xlink:actuate' => array(), + 'xlink:arcrole' => array(), + 'xlink:href' => array( + 'alternative_names' => array( + 'href', + ), + 'allow_empty' => false, + 'allow_relative' => true, + ), + 'xlink:role' => array(), + 'xlink:show' => array(), + 'xlink:title' => array(), + 'xlink:type' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), + 'y1' => array(), + 'y2' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'pre' => array( - array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), - - ), - ), - 'q' => array( + 'link' => array( array( 'attr_spec_list' => array( - 'cite' => array( - 'blacklisted_value_regex' => '__amp_source_origin', - 'allow_relative' => true, - 'allowed_protocol' => array( - 'fb-messenger', - 'ftp', - 'http', - 'https', - 'intent', - 'mailto', - 'skype', - 'sms', - 'snapchat', - 'tel', - 'tg', - 'threema', - 'twitter', - 'viber', - 'whatsapp', - ), + 'charset' => array( + 'value_casei' => 'utf-8', + ), + 'color' => array(), + 'href' => array(), + 'hreflang' => array(), + 'media' => array(), + 'rel' => array( + 'blacklisted_value_regex' => '(^|\\s)(canonical|components|import|manifest|serviceworker|stylesheet|subresource|)(\\s|$)', + 'mandatory' => true, ), + 'sizes' => array(), + 'target' => array(), + 'type' => array(), + ), + 'tag_spec' => array( + 'disallowed_ancestor' => array( + 'template', + ), + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'spec_name' => 'link rel=', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#html-tags', ), - 'tag_spec' => array(), ), - ), - 'radialgradient' => array( array( 'attr_spec_list' => array( - 'alignment-baseline' => array(), - 'baseline-shift' => array(), - 'class' => array(), - 'clip' => array(), - 'clip-path' => array(), - 'clip-rule' => array(), + 'charset' => array( + 'value_casei' => 'utf-8', + ), 'color' => array(), - 'color-interpolation' => array(), - 'color-interpolation-filters' => array(), - 'color-profile' => array(), - 'color-rendering' => array(), - 'cursor' => array(), - 'cx' => array(), - 'cy' => array(), + 'href' => array( + 'mandatory' => true, + ), + 'hreflang' => array(), + 'itemprop' => array( + 'mandatory' => true, + 'value_casei' => 'sameas', + ), + 'media' => array(), + 'sizes' => array(), + 'target' => array(), + 'type' => array(), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'spec_name' => 'link itemprop=sameas', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#html-tags', + ), + + ), + array( + 'attr_spec_list' => array( + 'charset' => array( + 'value_casei' => 'utf-8', + ), + 'color' => array(), + 'href' => array( + 'mandatory' => true, + ), + 'hreflang' => array(), + 'itemprop' => array( + 'mandatory' => true, + ), + 'media' => array(), + 'sizes' => array(), + 'target' => array(), + 'type' => array(), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'spec_name' => 'link itemprop=', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#html-tags', + ), + + ), + array( + 'attr_spec_list' => array( + 'charset' => array( + 'value_casei' => 'utf-8', + ), + 'color' => array(), + 'href' => array( + 'mandatory' => true, + ), + 'hreflang' => array(), + 'media' => array(), + 'property' => array( + 'mandatory' => true, + ), + 'sizes' => array(), + 'target' => array(), + 'type' => array(), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'spec_name' => 'link property=', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#html-tags', + ), + + ), + ), + 'listing' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + ), + 'main' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array(), + + ), + ), + 'mark' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array(), + + ), + ), + 'marker' => array( + array( + 'attr_spec_list' => array( + 'alignment-baseline' => array(), + 'baseline-shift' => array(), + 'clip' => array(), + 'clip-path' => array(), + 'clip-rule' => array(), + 'color' => array(), + 'color-interpolation' => array(), + 'color-interpolation-filters' => array(), + 'color-profile' => array(), + 'color-rendering' => array(), + 'cursor' => array(), 'direction' => array(), 'display' => array(), 'dominant-baseline' => array(), @@ -4462,12 +4634,8 @@ class AMP_Allowed_Tags_Generated { 'font-style' => array(), 'font-variant' => array(), 'font-weight' => array(), - 'fx' => array(), - 'fy' => array(), 'glyph-orientation-horizontal' => array(), 'glyph-orientation-vertical' => array(), - 'gradienttransform' => array(), - 'gradientunits' => array(), 'image-rendering' => array(), 'kerning' => array(), 'letter-spacing' => array(), @@ -4475,13 +4643,18 @@ class AMP_Allowed_Tags_Generated { 'marker-end' => array(), 'marker-mid' => array(), 'marker-start' => array(), + 'markerheight' => array(), + 'markerunits' => array(), + 'markerwidth' => array(), 'mask' => array(), 'opacity' => array(), + 'orient' => array(), 'overflow' => array(), 'pointer-events' => array(), - 'r' => array(), + 'preserveaspectratio' => array(), + 'refx' => array(), + 'refy' => array(), 'shape-rendering' => array(), - 'spreadmethod' => array(), 'stop-color' => array(), 'stop-opacity' => array(), 'stroke' => array(), @@ -4492,48 +4665,40 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), + 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), + 'viewbox' => array(), 'visibility' => array(), 'word-spacing' => array(), 'writing-mode' => array(), - 'xlink:actuate' => array(), - 'xlink:arcrole' => array(), - 'xlink:href' => array( - 'value_regex' => '#.*', - ), - 'xlink:role' => array(), - 'xlink:show' => array(), - 'xlink:title' => array(), - 'xlink:type' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'rb' => array( - array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), - - ), - ), - 'rect' => array( + 'mask' => array( array( 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -4572,15 +4737,14 @@ class AMP_Allowed_Tags_Generated { 'marker-mid' => array(), 'marker-start' => array(), 'mask' => array(), + 'maskcontentunits' => array(), + 'maskunits' => array(), 'opacity' => array(), 'overflow' => array(), 'pointer-events' => array(), 'requiredextensions' => array(), 'requiredfeatures' => array(), - 'rx' => array(), - 'ry' => array(), 'shape-rendering' => array(), - 'sketch:type' => array(), 'stop-color' => array(), 'stop-opacity' => array(), 'stroke' => array(), @@ -4591,18 +4755,20 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'systemlanguage' => array(), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), - 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'width' => array(), 'word-spacing' => array(), 'writing-mode' => array(), 'x' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), @@ -4610,146 +4776,2400 @@ class AMP_Allowed_Tags_Generated { 'y' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), ), - 'rp' => array( + 'meta' => array( array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), + 'attr_spec_list' => array( + 'content' => array( + 'mandatory' => true, + ), + 'http-equiv' => array( + 'mandatory' => true, + 'value_casei' => 'x-ua-compatible', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'head', + 'spec_name' => 'meta http-equiv=x-ua-compatible', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#html-tags', + ), ), - ), - 'rt' => array( array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), + 'attr_spec_list' => array( + 'content' => array(), + 'itemprop' => array(), + 'name' => array( + 'blacklisted_value_regex' => '(^|\\s)(amp-.*|amp4ads-.*|apple-itunes-app|content-disposition|revisit-after|viewport)(\\s|$)', + ), + 'property' => array(), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'spec_name' => 'meta name= and content=', + ), + + ), + array( + 'attr_spec_list' => array( + 'content' => array( + 'mandatory' => true, + 'value_casei' => 'text/html; charset=utf-8', + ), + 'http-equiv' => array( + 'mandatory' => true, + 'value_casei' => 'content-type', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'head', + 'spec_name' => 'meta http-equiv=content-type', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#html-tags', + ), + + ), + array( + 'attr_spec_list' => array( + 'content' => array( + 'mandatory' => true, + ), + 'http-equiv' => array( + 'mandatory' => true, + 'value_casei' => 'content-language', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'head', + 'spec_name' => 'meta http-equiv=content-language', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#html-tags', + ), + + ), + array( + 'attr_spec_list' => array( + 'content' => array( + 'mandatory' => true, + ), + 'http-equiv' => array( + 'mandatory' => true, + 'value_casei' => 'pics-label', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'head', + 'spec_name' => 'meta http-equiv=pics-label', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#html-tags', + ), + + ), + array( + 'attr_spec_list' => array( + 'content' => array( + 'mandatory' => true, + ), + 'http-equiv' => array( + 'mandatory' => true, + 'value_casei' => 'imagetoolbar', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'head', + 'spec_name' => 'meta http-equiv=imagetoolbar', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#html-tags', + ), + + ), + array( + 'attr_spec_list' => array( + 'content' => array( + 'mandatory' => true, + 'value_casei' => 'text/css', + ), + 'http-equiv' => array( + 'mandatory' => true, + 'value_casei' => 'content-style-type', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'head', + 'spec_name' => 'meta http-equiv=content-style-type', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#html-tags', + ), + + ), + array( + 'attr_spec_list' => array( + 'content' => array( + 'mandatory' => true, + 'value_casei' => 'text/javascript', + ), + 'http-equiv' => array( + 'mandatory' => true, + 'value_casei' => 'content-script-type', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'head', + 'spec_name' => 'meta http-equiv=content-script-type', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#html-tags', + ), + + ), + array( + 'attr_spec_list' => array( + 'content' => array( + 'mandatory' => true, + ), + 'http-equiv' => array( + 'mandatory' => true, + 'value_casei' => 'origin-trial', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'head', + 'spec_name' => 'meta http-equiv=origin-trial', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#html-tags', + ), + + ), + array( + 'attr_spec_list' => array( + 'content' => array( + 'mandatory' => true, + ), + 'http-equiv' => array( + 'mandatory' => true, + 'value_casei' => 'resource-type', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'head', + 'spec_name' => 'meta http-equiv=resource-type', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#html-tags', + ), + + ), + ), + 'metadata' => array( + array( + 'attr_spec_list' => array( + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), + 'xml:lang' => array(), + 'xml:space' => array(), + 'xmlns' => array(), + 'xmlns:xlink' => array(), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', + ), + + ), + ), + 'meter' => array( + array( + 'attr_spec_list' => array( + 'high' => array(), + 'low' => array(), + 'max' => array(), + 'min' => array(), + 'optimum' => array(), + 'value' => array(), + ), + 'tag_spec' => array(), + + ), + ), + 'multicol' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + ), + 'nav' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array(), + + ), + array( + 'attr_spec_list' => array( + 'toolbar' => array( + 'mandatory' => true, + ), + 'toolbar-target' => array( + 'mandatory' => true, + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + 'mandatory_parent' => 'amp-sidebar', + 'spec_name' => 'amp-sidebar > nav', + ), + + ), + ), + 'nextid' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + ), + 'nobr' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + ), + 'noscript' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array( + 'disallowed_ancestor' => array( + 'noscript', + ), + 'html_format' => array( + 'amp', + ), + 'mandatory_ancestor' => 'body', + ), + + ), + ), + 'o:p' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + ), + 'ol' => array( + array( + 'attr_spec_list' => array( + 'reversed' => array( + 'value' => '', + ), + 'start' => array( + 'value_regex' => '[0-9]*', + ), + 'type' => array( + 'value_regex' => '[1aaii]', + ), + ), + 'tag_spec' => array(), + + ), + ), + 'optgroup' => array( + array( + 'attr_spec_list' => array( + '[disabled]' => array(), + '[label]' => array(), + 'disabled' => array(), + 'label' => array(), + ), + 'tag_spec' => array( + 'mandatory_parent' => 'select', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-form', + ), + + ), + ), + 'option' => array( + array( + 'attr_spec_list' => array( + '[disabled]' => array(), + '[label]' => array(), + '[selected]' => array(), + '[value]' => array(), + 'disabled' => array(), + 'label' => array(), + 'selected' => array(), + 'value' => array(), + ), + 'tag_spec' => array( + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-form', + ), + + ), + ), + 'output' => array( + array( + 'attr_spec_list' => array( + 'for' => array(), + 'form' => array(), + 'name' => array( + 'blacklisted_value_regex' => '(^|\\s)(__amp_\\s*|__count__|__definegetter__|__definesetter__|__lookupgetter__|__lookupsetter__|__nosuchmethod__|__parent__|__proto__|__amp_\\s*|\\$p|\\$proxy|acceptcharset|addeventlistener|appendchild|assignedslot|attachshadow|baseuri|checkvalidity|childelementcount|childnodes|classlist|classname|clientheight|clientleft|clienttop|clientwidth|comparedocumentposition|computedname|computedrole|contenteditable|createshadowroot|enqueaction|firstchild|firstelementchild|getanimations|getattribute|getattributens|getattributenode|getattributenodens|getboundingclientrect|getclientrects|getdestinationinsertionpoints|getelementsbyclassname|getelementsbytagname|getelementsbytagnamens|getrootnode|hasattribute|hasattributens|hasattributes|haschildnodes|haspointercapture|innerhtml|innertext|inputmode|insertadjacentelement|insertadjacenthtml|insertadjacenttext|iscontenteditable|isdefaultnamespace|isequalnode|issamenode|lastchild|lastelementchild|lookupnamespaceuri|namespaceuri|nextelementsibling|nextsibling|nodename|nodetype|nodevalue|offsetheight|offsetleft|offsetparent|offsettop|offsetwidth|outerhtml|outertext|ownerdocument|parentelement|parentnode|previouselementsibling|previoussibling|queryselector|queryselectorall|releasepointercapture|removeattribute|removeattributens|removeattributenode|removechild|removeeventlistener|replacechild|reportvalidity|requestpointerlock|scrollheight|scrollintoview|scrollintoviewifneeded|scrollleft|scrollwidth|setattribute|setattributens|setattributenode|setattributenodens|setpointercapture|shadowroot|stylemap|tabindex|tagname|textcontent|tostring|valueof|(webkit|ms|moz|o)dropzone|(webkit|moz|ms|o)matchesselector|(webkit|moz|ms|o)requestfullscreen|(webkit|moz|ms|o)requestfullscreen)(\\s|$)', + ), + ), + 'tag_spec' => array(), + + ), + ), + 'p' => array( + array( + 'attr_spec_list' => array( + 'align' => array(), + ), + 'tag_spec' => array(), + + ), + ), + 'path' => array( + array( + 'attr_spec_list' => array( + 'alignment-baseline' => array(), + 'baseline-shift' => array(), + 'clip' => array(), + 'clip-path' => array(), + 'clip-rule' => array(), + 'color' => array(), + 'color-interpolation' => array(), + 'color-interpolation-filters' => array(), + 'color-profile' => array(), + 'color-rendering' => array(), + 'cursor' => array(), + 'd' => array(), + 'direction' => array(), + 'display' => array(), + 'dominant-baseline' => array(), + 'enable-background' => array(), + 'externalresourcesrequired' => array(), + 'fill' => array(), + 'fill-opacity' => array(), + 'fill-rule' => array(), + 'filter' => array(), + 'flood-color' => array(), + 'flood-opacity' => array(), + 'font-family' => array(), + 'font-size' => array(), + 'font-size-adjust' => array(), + 'font-stretch' => array(), + 'font-style' => array(), + 'font-variant' => array(), + 'font-weight' => array(), + 'glyph-orientation-horizontal' => array(), + 'glyph-orientation-vertical' => array(), + 'image-rendering' => array(), + 'kerning' => array(), + 'letter-spacing' => array(), + 'lighting-color' => array(), + 'marker-end' => array(), + 'marker-mid' => array(), + 'marker-start' => array(), + 'mask' => array(), + 'opacity' => array(), + 'overflow' => array(), + 'pathlength' => array(), + 'pointer-events' => array(), + 'requiredextensions' => array(), + 'requiredfeatures' => array(), + 'shape-rendering' => array(), + 'sketch:type' => array(), + 'stop-color' => array(), + 'stop-opacity' => array(), + 'stroke' => array(), + 'stroke-dasharray' => array(), + 'stroke-dashoffset' => array(), + 'stroke-linecap' => array(), + 'stroke-linejoin' => array(), + 'stroke-miterlimit' => array(), + 'stroke-opacity' => array(), + 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), + 'systemlanguage' => array(), + 'text-anchor' => array(), + 'text-decoration' => array(), + 'text-rendering' => array(), + 'transform' => array(), + 'unicode-bidi' => array(), + 'vector-effect' => array(), + 'visibility' => array(), + 'word-spacing' => array(), + 'writing-mode' => array(), + 'xml:lang' => array(), + 'xml:space' => array(), + 'xmlns' => array(), + 'xmlns:xlink' => array(), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', + ), + + ), + ), + 'pattern' => array( + array( + 'attr_spec_list' => array( + 'alignment-baseline' => array(), + 'baseline-shift' => array(), + 'clip' => array(), + 'clip-path' => array(), + 'clip-rule' => array(), + 'color' => array(), + 'color-interpolation' => array(), + 'color-interpolation-filters' => array(), + 'color-profile' => array(), + 'color-rendering' => array(), + 'cursor' => array(), + 'direction' => array(), + 'display' => array(), + 'dominant-baseline' => array(), + 'enable-background' => array(), + 'externalresourcesrequired' => array(), + 'fill' => array(), + 'fill-opacity' => array(), + 'fill-rule' => array(), + 'filter' => array(), + 'flood-color' => array(), + 'flood-opacity' => array(), + 'font-family' => array(), + 'font-size' => array(), + 'font-size-adjust' => array(), + 'font-stretch' => array(), + 'font-style' => array(), + 'font-variant' => array(), + 'font-weight' => array(), + 'glyph-orientation-horizontal' => array(), + 'glyph-orientation-vertical' => array(), + 'height' => array(), + 'image-rendering' => array(), + 'kerning' => array(), + 'letter-spacing' => array(), + 'lighting-color' => array(), + 'marker-end' => array(), + 'marker-mid' => array(), + 'marker-start' => array(), + 'mask' => array(), + 'opacity' => array(), + 'overflow' => array(), + 'patterncontentunits' => array(), + 'patterntransform' => array(), + 'patternunits' => array(), + 'pointer-events' => array(), + 'preserveaspectratio' => array(), + 'requiredextensions' => array(), + 'requiredfeatures' => array(), + 'shape-rendering' => array(), + 'stop-color' => array(), + 'stop-opacity' => array(), + 'stroke' => array(), + 'stroke-dasharray' => array(), + 'stroke-dashoffset' => array(), + 'stroke-linecap' => array(), + 'stroke-linejoin' => array(), + 'stroke-miterlimit' => array(), + 'stroke-opacity' => array(), + 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), + 'systemlanguage' => array(), + 'text-anchor' => array(), + 'text-decoration' => array(), + 'text-rendering' => array(), + 'unicode-bidi' => array(), + 'vector-effect' => array(), + 'viewbox' => array(), + 'visibility' => array(), + 'width' => array(), + 'word-spacing' => array(), + 'writing-mode' => array(), + 'x' => array(), + 'xlink:actuate' => array(), + 'xlink:arcrole' => array(), + 'xlink:href' => array( + 'alternative_names' => array( + 'href', + ), + 'allow_empty' => false, + 'allow_relative' => true, + ), + 'xlink:role' => array(), + 'xlink:show' => array(), + 'xlink:title' => array(), + 'xlink:type' => array(), + 'xml:lang' => array(), + 'xml:space' => array(), + 'xmlns' => array(), + 'xmlns:xlink' => array(), + 'y' => array(), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', + ), + + ), + ), + 'polygon' => array( + array( + 'attr_spec_list' => array( + 'alignment-baseline' => array(), + 'baseline-shift' => array(), + 'clip' => array(), + 'clip-path' => array(), + 'clip-rule' => array(), + 'color' => array(), + 'color-interpolation' => array(), + 'color-interpolation-filters' => array(), + 'color-profile' => array(), + 'color-rendering' => array(), + 'cursor' => array(), + 'direction' => array(), + 'display' => array(), + 'dominant-baseline' => array(), + 'enable-background' => array(), + 'externalresourcesrequired' => array(), + 'fill' => array(), + 'fill-opacity' => array(), + 'fill-rule' => array(), + 'filter' => array(), + 'flood-color' => array(), + 'flood-opacity' => array(), + 'font-family' => array(), + 'font-size' => array(), + 'font-size-adjust' => array(), + 'font-stretch' => array(), + 'font-style' => array(), + 'font-variant' => array(), + 'font-weight' => array(), + 'glyph-orientation-horizontal' => array(), + 'glyph-orientation-vertical' => array(), + 'image-rendering' => array(), + 'kerning' => array(), + 'letter-spacing' => array(), + 'lighting-color' => array(), + 'marker-end' => array(), + 'marker-mid' => array(), + 'marker-start' => array(), + 'mask' => array(), + 'opacity' => array(), + 'overflow' => array(), + 'pointer-events' => array(), + 'points' => array(), + 'requiredextensions' => array(), + 'requiredfeatures' => array(), + 'shape-rendering' => array(), + 'sketch:type' => array(), + 'stop-color' => array(), + 'stop-opacity' => array(), + 'stroke' => array(), + 'stroke-dasharray' => array(), + 'stroke-dashoffset' => array(), + 'stroke-linecap' => array(), + 'stroke-linejoin' => array(), + 'stroke-miterlimit' => array(), + 'stroke-opacity' => array(), + 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), + 'systemlanguage' => array(), + 'text-anchor' => array(), + 'text-decoration' => array(), + 'text-rendering' => array(), + 'transform' => array(), + 'unicode-bidi' => array(), + 'vector-effect' => array(), + 'visibility' => array(), + 'word-spacing' => array(), + 'writing-mode' => array(), + 'xml:lang' => array(), + 'xml:space' => array(), + 'xmlns' => array(), + 'xmlns:xlink' => array(), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', + ), + + ), + ), + 'polyline' => array( + array( + 'attr_spec_list' => array( + 'alignment-baseline' => array(), + 'baseline-shift' => array(), + 'clip' => array(), + 'clip-path' => array(), + 'clip-rule' => array(), + 'color' => array(), + 'color-interpolation' => array(), + 'color-interpolation-filters' => array(), + 'color-profile' => array(), + 'color-rendering' => array(), + 'cursor' => array(), + 'direction' => array(), + 'display' => array(), + 'dominant-baseline' => array(), + 'enable-background' => array(), + 'externalresourcesrequired' => array(), + 'fill' => array(), + 'fill-opacity' => array(), + 'fill-rule' => array(), + 'filter' => array(), + 'flood-color' => array(), + 'flood-opacity' => array(), + 'font-family' => array(), + 'font-size' => array(), + 'font-size-adjust' => array(), + 'font-stretch' => array(), + 'font-style' => array(), + 'font-variant' => array(), + 'font-weight' => array(), + 'glyph-orientation-horizontal' => array(), + 'glyph-orientation-vertical' => array(), + 'image-rendering' => array(), + 'kerning' => array(), + 'letter-spacing' => array(), + 'lighting-color' => array(), + 'marker-end' => array(), + 'marker-mid' => array(), + 'marker-start' => array(), + 'mask' => array(), + 'opacity' => array(), + 'overflow' => array(), + 'pointer-events' => array(), + 'points' => array(), + 'requiredextensions' => array(), + 'requiredfeatures' => array(), + 'shape-rendering' => array(), + 'sketch:type' => array(), + 'stop-color' => array(), + 'stop-opacity' => array(), + 'stroke' => array(), + 'stroke-dasharray' => array(), + 'stroke-dashoffset' => array(), + 'stroke-linecap' => array(), + 'stroke-linejoin' => array(), + 'stroke-miterlimit' => array(), + 'stroke-opacity' => array(), + 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), + 'systemlanguage' => array(), + 'text-anchor' => array(), + 'text-decoration' => array(), + 'text-rendering' => array(), + 'transform' => array(), + 'unicode-bidi' => array(), + 'vector-effect' => array(), + 'visibility' => array(), + 'word-spacing' => array(), + 'writing-mode' => array(), + 'xml:lang' => array(), + 'xml:space' => array(), + 'xmlns' => array(), + 'xmlns:xlink' => array(), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', + ), + + ), + ), + 'pre' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array(), + + ), + ), + 'progress' => array( + array( + 'attr_spec_list' => array( + 'max' => array(), + 'value' => array(), + ), + 'tag_spec' => array(), + + ), + ), + 'q' => array( + array( + 'attr_spec_list' => array( + 'cite' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'allow_empty' => true, + 'allow_relative' => true, + ), + ), + 'tag_spec' => array(), + + ), + ), + 'radialgradient' => array( + array( + 'attr_spec_list' => array( + 'alignment-baseline' => array(), + 'baseline-shift' => array(), + 'clip' => array(), + 'clip-path' => array(), + 'clip-rule' => array(), + 'color' => array(), + 'color-interpolation' => array(), + 'color-interpolation-filters' => array(), + 'color-profile' => array(), + 'color-rendering' => array(), + 'cursor' => array(), + 'cx' => array(), + 'cy' => array(), + 'direction' => array(), + 'display' => array(), + 'dominant-baseline' => array(), + 'enable-background' => array(), + 'externalresourcesrequired' => array(), + 'fill' => array(), + 'fill-opacity' => array(), + 'fill-rule' => array(), + 'filter' => array(), + 'flood-color' => array(), + 'flood-opacity' => array(), + 'font-family' => array(), + 'font-size' => array(), + 'font-size-adjust' => array(), + 'font-stretch' => array(), + 'font-style' => array(), + 'font-variant' => array(), + 'font-weight' => array(), + 'fr' => array(), + 'fx' => array(), + 'fy' => array(), + 'glyph-orientation-horizontal' => array(), + 'glyph-orientation-vertical' => array(), + 'gradienttransform' => array(), + 'gradientunits' => array(), + 'image-rendering' => array(), + 'kerning' => array(), + 'letter-spacing' => array(), + 'lighting-color' => array(), + 'marker-end' => array(), + 'marker-mid' => array(), + 'marker-start' => array(), + 'mask' => array(), + 'opacity' => array(), + 'overflow' => array(), + 'pointer-events' => array(), + 'r' => array(), + 'shape-rendering' => array(), + 'spreadmethod' => array(), + 'stop-color' => array(), + 'stop-opacity' => array(), + 'stroke' => array(), + 'stroke-dasharray' => array(), + 'stroke-dashoffset' => array(), + 'stroke-linecap' => array(), + 'stroke-linejoin' => array(), + 'stroke-miterlimit' => array(), + 'stroke-opacity' => array(), + 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), + 'text-anchor' => array(), + 'text-decoration' => array(), + 'text-rendering' => array(), + 'unicode-bidi' => array(), + 'vector-effect' => array(), + 'visibility' => array(), + 'word-spacing' => array(), + 'writing-mode' => array(), + 'xlink:actuate' => array(), + 'xlink:arcrole' => array(), + 'xlink:href' => array( + 'alternative_names' => array( + 'href', + ), + 'allow_empty' => false, + 'allow_relative' => true, + ), + 'xlink:role' => array(), + 'xlink:show' => array(), + 'xlink:title' => array(), + 'xlink:type' => array(), + 'xml:lang' => array(), + 'xml:space' => array(), + 'xmlns' => array(), + 'xmlns:xlink' => array(), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', + ), + + ), + ), + 'rb' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array(), + + ), + ), + 'rect' => array( + array( + 'attr_spec_list' => array( + 'alignment-baseline' => array(), + 'baseline-shift' => array(), + 'clip' => array(), + 'clip-path' => array(), + 'clip-rule' => array(), + 'color' => array(), + 'color-interpolation' => array(), + 'color-interpolation-filters' => array(), + 'color-profile' => array(), + 'color-rendering' => array(), + 'cursor' => array(), + 'direction' => array(), + 'display' => array(), + 'dominant-baseline' => array(), + 'enable-background' => array(), + 'externalresourcesrequired' => array(), + 'fill' => array(), + 'fill-opacity' => array(), + 'fill-rule' => array(), + 'filter' => array(), + 'flood-color' => array(), + 'flood-opacity' => array(), + 'font-family' => array(), + 'font-size' => array(), + 'font-size-adjust' => array(), + 'font-stretch' => array(), + 'font-style' => array(), + 'font-variant' => array(), + 'font-weight' => array(), + 'glyph-orientation-horizontal' => array(), + 'glyph-orientation-vertical' => array(), + 'height' => array(), + 'image-rendering' => array(), + 'kerning' => array(), + 'letter-spacing' => array(), + 'lighting-color' => array(), + 'marker-end' => array(), + 'marker-mid' => array(), + 'marker-start' => array(), + 'mask' => array(), + 'opacity' => array(), + 'overflow' => array(), + 'pointer-events' => array(), + 'requiredextensions' => array(), + 'requiredfeatures' => array(), + 'rx' => array(), + 'ry' => array(), + 'shape-rendering' => array(), + 'sketch:type' => array(), + 'stop-color' => array(), + 'stop-opacity' => array(), + 'stroke' => array(), + 'stroke-dasharray' => array(), + 'stroke-dashoffset' => array(), + 'stroke-linecap' => array(), + 'stroke-linejoin' => array(), + 'stroke-miterlimit' => array(), + 'stroke-opacity' => array(), + 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), + 'systemlanguage' => array(), + 'text-anchor' => array(), + 'text-decoration' => array(), + 'text-rendering' => array(), + 'transform' => array(), + 'unicode-bidi' => array(), + 'vector-effect' => array(), + 'visibility' => array(), + 'width' => array(), + 'word-spacing' => array(), + 'writing-mode' => array(), + 'x' => array(), + 'xml:lang' => array(), + 'xml:space' => array(), + 'xmlns' => array(), + 'xmlns:xlink' => array(), + 'y' => array(), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', + ), + + ), + ), + 'rp' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array(), + + ), + ), + 'rt' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array(), + + ), + ), + 'rtc' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array(), + + ), + ), + 'ruby' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array(), + + ), + ), + 's' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array(), + + ), + ), + 'samp' => array( + array( + 'attr_spec_list' => array(), + 'tag_spec' => array(), + + ), + ), + 'script' => array( + array( + 'attr_spec_list' => array( + 'nonce' => array(), + 'type' => array( + 'mandatory' => true, + 'value_casei' => 'application/ld+json', + ), + ), + 'tag_spec' => array( + 'spec_name' => 'script type=application/ld+json', + ), + + ), + array( + 'attr_spec_list' => array( + 'type' => array( + 'mandatory' => true, + 'value_casei' => 'application/json', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + 'mandatory_parent' => 'amp-ima-video', + 'spec_name' => 'amp-ima-video > script[type=application/json]', + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array(), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp4ads', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'nonce' => array(), + 'type' => array( + 'mandatory' => true, + 'value' => 'application/json', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp4ads', + ), + 'mandatory_parent' => 'amp-ad-exit', + 'spec_name' => 'amp-ad-exit configuration json', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-ad-exit', + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + 'spec_name' => 'amp-ad extension .js script', + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'nonce' => array(), + 'type' => array( + 'mandatory' => true, + 'value_casei' => 'application/json', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_parent' => 'amp-analytics', + 'spec_name' => 'amp-analytics extension .json script', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-analytics', + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'nonce' => array(), + 'type' => array( + 'mandatory' => true, + 'value_casei' => 'application/json', + ), + ), + 'tag_spec' => array( + 'mandatory_parent' => 'amp-animation', + 'spec_name' => 'amp-animation extension .json script', + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array(), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'nonce' => array(), + 'type' => array( + 'mandatory' => true, + 'value_casei' => 'application/json', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + 'mandatory_parent' => 'amp-state', + 'spec_name' => 'amp-bind extension .json script', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-bind', + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array(), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'nonce' => array(), + 'type' => array( + 'mandatory' => true, + 'value_casei' => 'application/json', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + 'mandatory_parent' => 'amp-experiment', + 'spec_name' => 'amp-experiment extension .json script', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-experiment', + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array(), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array(), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp4ads', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), + + ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), ), - ), - 'rtc' => array( array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), ), - ), - 'ruby' => array( array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), ), - ), - 's' => array( array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), ), - ), - 'samp' => array( array( - 'attr_spec_list' => array(), - 'tag_spec' => array(), + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + ), + ), ), - ), - 'script' => array( array( 'attr_spec_list' => array( - 'type' => array( - 'dispatch_key' => true, + 'async' => array( 'mandatory' => true, - 'value_casei' => 'application/ld+json', + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', ), ), 'tag_spec' => array( - 'spec_name' => 'script type=application/ld+json', + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'spec_name' => 'amp-video extension .js script', ), ), array( 'attr_spec_list' => array( - 'type' => array( - 'dispatch_key' => true, + 'async' => array( 'mandatory' => true, - 'value_casei' => 'application/json', + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', ), ), 'tag_spec' => array( 'html_format' => array( 'amp', - 'amp4ads', ), - 'mandatory_parent' => 'amp-analytics', - 'spec_name' => 'amp-analytics extension .json script', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-analytics.html', ), ), array( 'attr_spec_list' => array( - 'amp-ad-metadata' => array( - 'dispatch_key' => true, + 'async' => array( 'mandatory' => true, 'value' => '', ), + 'nonce' => array(), 'type' => array( - 'mandatory' => true, - 'value_casei' => 'application/json', + 'value_casei' => 'text/javascript', ), ), 'tag_spec' => array( 'html_format' => array( 'amp', - 'amp4ads', ), - 'mandatory_parent' => 'body', - 'spec_name' => 'amp-ad-metadata .json script', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-analytics.html', ), ), array( 'attr_spec_list' => array( - 'type' => array( - 'dispatch_key' => true, + 'async' => array( 'mandatory' => true, - 'value_casei' => 'application/json', + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', ), ), 'tag_spec' => array( 'html_format' => array( 'amp', ), - 'mandatory_parent' => 'amp-state', - 'spec_name' => 'amp-bind extension .json script', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-bind.html', ), ), array( 'attr_spec_list' => array( - 'type' => array( - 'dispatch_key' => true, + 'async' => array( 'mandatory' => true, - 'value_casei' => 'application/json', + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', ), ), 'tag_spec' => array( 'html_format' => array( 'amp', ), - 'mandatory_parent' => 'amp-experiment', - 'spec_name' => 'amp-experiment extension .json script', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-experiment.html', ), ), + array( + 'attr_spec_list' => array( + 'async' => array( + 'mandatory' => true, + 'value' => '', + ), + 'nonce' => array(), + 'type' => array( + 'value_casei' => 'text/javascript', + ), + ), + 'tag_spec' => array(), + + ), ), 'section' => array( array( @@ -4768,10 +7188,6 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'html_format' => array( - 'amp', - 'amp4ads', - ), 'mandatory_parent' => 'amp-accordion', 'spec_name' => 'amp-accordion > section', ), @@ -4781,19 +7197,35 @@ class AMP_Allowed_Tags_Generated { 'select' => array( array( 'attr_spec_list' => array( + '[autofocus]' => array(), + '[disabled]' => array(), + '[multiple]' => array(), + '[required]' => array(), + '[size]' => array(), 'autofocus' => array(), 'disabled' => array(), 'multiple' => array(), - 'name' => array(), + 'name' => array( + 'blacklisted_value_regex' => '(^|\\s)(__amp_\\s*|__count__|__definegetter__|__definesetter__|__lookupgetter__|__lookupsetter__|__nosuchmethod__|__parent__|__proto__|__amp_\\s*|\\$p|\\$proxy|acceptcharset|addeventlistener|appendchild|assignedslot|attachshadow|baseuri|checkvalidity|childelementcount|childnodes|classlist|classname|clientheight|clientleft|clienttop|clientwidth|comparedocumentposition|computedname|computedrole|contenteditable|createshadowroot|enqueaction|firstchild|firstelementchild|getanimations|getattribute|getattributens|getattributenode|getattributenodens|getboundingclientrect|getclientrects|getdestinationinsertionpoints|getelementsbyclassname|getelementsbytagname|getelementsbytagnamens|getrootnode|hasattribute|hasattributens|hasattributes|haschildnodes|haspointercapture|innerhtml|innertext|inputmode|insertadjacentelement|insertadjacenthtml|insertadjacenttext|iscontenteditable|isdefaultnamespace|isequalnode|issamenode|lastchild|lastelementchild|lookupnamespaceuri|namespaceuri|nextelementsibling|nextsibling|nodename|nodetype|nodevalue|offsetheight|offsetleft|offsetparent|offsettop|offsetwidth|outerhtml|outertext|ownerdocument|parentelement|parentnode|previouselementsibling|previoussibling|queryselector|queryselectorall|releasepointercapture|removeattribute|removeattributens|removeattributenode|removechild|removeeventlistener|replacechild|reportvalidity|requestpointerlock|scrollheight|scrollintoview|scrollintoviewifneeded|scrollleft|scrollwidth|setattribute|setattributens|setattributenode|setattributenodens|setpointercapture|shadowroot|stylemap|tabindex|tagname|textcontent|tostring|valueof|(webkit|ms|moz|o)dropzone|(webkit|moz|ms|o)matchesselector|(webkit|moz|ms|o)requestfullscreen|(webkit|moz|ms|o)requestfullscreen)(\\s|$)', + ), 'required' => array(), 'size' => array(), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-form extension .js script', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-form', + ), + + ), + ), + 'slot' => array( + array( + 'attr_spec_list' => array( + 'name' => array(), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', ), - 'mandatory_ancestor' => 'form', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-form.html', ), ), @@ -4805,42 +7237,132 @@ class AMP_Allowed_Tags_Generated { ), ), + 'solidcolor' => array( + array( + 'attr_spec_list' => array( + 'alignment-baseline' => array(), + 'baseline-shift' => array(), + 'clip' => array(), + 'clip-path' => array(), + 'clip-rule' => array(), + 'color' => array(), + 'color-interpolation' => array(), + 'color-interpolation-filters' => array(), + 'color-profile' => array(), + 'color-rendering' => array(), + 'cursor' => array(), + 'direction' => array(), + 'display' => array(), + 'dominant-baseline' => array(), + 'enable-background' => array(), + 'fill' => array(), + 'fill-opacity' => array(), + 'fill-rule' => array(), + 'filter' => array(), + 'flood-color' => array(), + 'flood-opacity' => array(), + 'font-family' => array(), + 'font-size' => array(), + 'font-size-adjust' => array(), + 'font-stretch' => array(), + 'font-style' => array(), + 'font-variant' => array(), + 'font-weight' => array(), + 'glyph-orientation-horizontal' => array(), + 'glyph-orientation-vertical' => array(), + 'image-rendering' => array(), + 'kerning' => array(), + 'letter-spacing' => array(), + 'lighting-color' => array(), + 'marker-end' => array(), + 'marker-mid' => array(), + 'marker-start' => array(), + 'mask' => array(), + 'opacity' => array(), + 'overflow' => array(), + 'pointer-events' => array(), + 'shape-rendering' => array(), + 'solid-color' => array(), + 'solid-opacity' => array(), + 'stop-color' => array(), + 'stop-opacity' => array(), + 'stroke' => array(), + 'stroke-dasharray' => array(), + 'stroke-dashoffset' => array(), + 'stroke-linecap' => array(), + 'stroke-linejoin' => array(), + 'stroke-miterlimit' => array(), + 'stroke-opacity' => array(), + 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), + 'text-anchor' => array(), + 'text-decoration' => array(), + 'text-rendering' => array(), + 'unicode-bidi' => array(), + 'vector-effect' => array(), + 'visibility' => array(), + 'word-spacing' => array(), + 'writing-mode' => array(), + 'xml:lang' => array(), + 'xml:space' => array(), + 'xmlns' => array(), + 'xmlns:xlink' => array(), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', + ), + + ), + ), 'source' => array( array( 'attr_spec_list' => array( + '[src]' => array(), + '[type]' => array(), 'media' => array(), 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), ), 'type' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_parent' => 'amp-video', 'spec_name' => 'amp-video > source', - 'spec_url' => 'https://www.ampproject.org/docs/reference/amp-video.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-video', ), ), array( 'attr_spec_list' => array( + '[src]' => array(), + '[type]' => array(), 'media' => array(), 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), ), 'type' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_parent' => 'amp-audio', 'spec_name' => 'amp-audio > source', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-audio.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-audio', ), ), @@ -4851,40 +7373,63 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), ), 'type' => array( 'mandatory' => true, ), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_parent' => 'audio', 'spec_name' => 'audio > source', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-audio.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-audio', + ), + + ), + array( + 'attr_spec_list' => array( + 'media' => array(), + 'src' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'mandatory' => true, + 'allow_relative' => true, + ), + 'type' => array( + 'mandatory' => true, + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_parent' => 'video', + 'spec_name' => 'video > source', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-video', ), ), array( 'attr_spec_list' => array( + '[src]' => array(), + '[type]' => array(), 'media' => array(), 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', - 'mandatory' => true, 'allow_relative' => true, - 'allowed_protocol' => array( - 'https', - ), - ), - 'type' => array( - 'mandatory' => true, ), + 'type' => array(), ), 'tag_spec' => array( - 'mandatory_parent' => 'video', - 'spec_name' => 'video > source', - 'spec_url' => 'https://www.ampproject.org/docs/reference/amp-video.html', + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_parent' => 'amp-ima-video', + 'spec_name' => 'amp-ima-video > source', ), ), @@ -4913,11 +7458,18 @@ class AMP_Allowed_Tags_Generated { 'offset' => array(), 'stop-color' => array(), 'stop-opacity' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'lineargradient', 'spec_name' => 'lineargradient > stop', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -4926,11 +7478,18 @@ class AMP_Allowed_Tags_Generated { 'offset' => array(), 'stop-color' => array(), 'stop-opacity' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'radialgradient', 'spec_name' => 'radialgradient > stop', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -4957,19 +7516,17 @@ class AMP_Allowed_Tags_Generated { array( 'attr_spec_list' => array( 'amp-boilerplate' => array( - 'dispatch_key' => true, 'mandatory' => true, 'value' => '', ), + 'nonce' => array(), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'head > style[amp-boilerplate]', - ), 'html_format' => array( 'amp', ), 'mandatory_alternatives' => 'noscript > style[amp-boilerplate]', + 'mandatory_ancestor' => 'head', 'mandatory_parent' => 'noscript', 'spec_name' => 'noscript > style[amp-boilerplate]', 'spec_url' => 'https://github.com/ampproject/amphtml/blob/master/spec/amp-boilerplate.md', @@ -4977,6 +7534,24 @@ class AMP_Allowed_Tags_Generated { ), ), + array( + 'attr_spec_list' => array( + 'amp-keyframes' => array( + 'mandatory' => true, + 'value' => '', + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_parent' => 'body', + 'spec_name' => 'style[amp-keyframes]', + 'unique' => true, + ), + + ), ), 'sub' => array( array( @@ -4997,7 +7572,6 @@ class AMP_Allowed_Tags_Generated { 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -5060,6 +7634,7 @@ class AMP_Allowed_Tags_Generated { 'text-decoration' => array(), 'text-rendering' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'version' => array( 'value_regex' => '(1.0|1.1)', ), @@ -5069,7 +7644,6 @@ class AMP_Allowed_Tags_Generated { 'word-spacing' => array(), 'writing-mode' => array(), 'x' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), @@ -5078,7 +7652,96 @@ class AMP_Allowed_Tags_Generated { 'zoomandpan' => array(), ), 'tag_spec' => array( - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', + ), + + ), + ), + 'switch' => array( + array( + 'attr_spec_list' => array( + 'alignment-baseline' => array(), + 'baseline-shift' => array(), + 'clip' => array(), + 'clip-path' => array(), + 'clip-rule' => array(), + 'color' => array(), + 'color-interpolation' => array(), + 'color-interpolation-filters' => array(), + 'color-profile' => array(), + 'color-rendering' => array(), + 'cursor' => array(), + 'direction' => array(), + 'display' => array(), + 'dominant-baseline' => array(), + 'enable-background' => array(), + 'fill' => array(), + 'fill-opacity' => array(), + 'fill-rule' => array(), + 'filter' => array(), + 'flood-color' => array(), + 'flood-opacity' => array(), + 'font-family' => array(), + 'font-size' => array(), + 'font-size-adjust' => array(), + 'font-stretch' => array(), + 'font-style' => array(), + 'font-variant' => array(), + 'font-weight' => array(), + 'glyph-orientation-horizontal' => array(), + 'glyph-orientation-vertical' => array(), + 'image-rendering' => array(), + 'kerning' => array(), + 'letter-spacing' => array(), + 'lighting-color' => array(), + 'marker-end' => array(), + 'marker-mid' => array(), + 'marker-start' => array(), + 'mask' => array(), + 'opacity' => array(), + 'overflow' => array(), + 'pointer-events' => array(), + 'requiredextensions' => array(), + 'requiredfeatures' => array(), + 'shape-rendering' => array(), + 'stop-color' => array(), + 'stop-opacity' => array(), + 'stroke' => array(), + 'stroke-dasharray' => array(), + 'stroke-dashoffset' => array(), + 'stroke-linecap' => array(), + 'stroke-linejoin' => array(), + 'stroke-miterlimit' => array(), + 'stroke-opacity' => array(), + 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), + 'systemlanguage' => array(), + 'text-anchor' => array(), + 'text-decoration' => array(), + 'text-rendering' => array(), + 'unicode-bidi' => array(), + 'vector-effect' => array(), + 'visibility' => array(), + 'word-spacing' => array(), + 'writing-mode' => array(), + 'xml:lang' => array(), + 'xml:space' => array(), + 'xmlns' => array(), + 'xmlns:xlink' => array(), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_ancestor' => 'svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -5088,7 +7751,6 @@ class AMP_Allowed_Tags_Generated { 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -5141,23 +7803,30 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'viewbox' => array(), 'visibility' => array(), 'word-spacing' => array(), 'writing-mode' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -5211,13 +7880,9 @@ class AMP_Allowed_Tags_Generated { ), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-mustache extension .js script', - ), 'disallowed_ancestor' => array( 'template', ), - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-mustache.html', ), ), @@ -5227,7 +7892,6 @@ class AMP_Allowed_Tags_Generated { 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -5285,6 +7949,9 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'systemlanguage' => array(), 'text-anchor' => array(), 'text-decoration' => array(), @@ -5292,11 +7959,11 @@ class AMP_Allowed_Tags_Generated { 'textlength' => array(), 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'word-spacing' => array(), 'writing-mode' => array(), 'x' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), @@ -5304,8 +7971,12 @@ class AMP_Allowed_Tags_Generated { 'y' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -5313,13 +7984,30 @@ class AMP_Allowed_Tags_Generated { 'textarea' => array( array( 'attr_spec_list' => array( + '[autocomplete]' => array(), + '[autofocus]' => array(), + '[cols]' => array(), + '[disabled]' => array(), + '[maxlength]' => array(), + '[minlength]' => array(), + '[placeholder]' => array(), + '[readonly]' => array(), + '[required]' => array(), + '[rows]' => array(), + '[selectiondirection]' => array(), + '[selectionend]' => array(), + '[selectionstart]' => array(), + '[spellcheck]' => array(), + '[wrap]' => array(), 'autocomplete' => array(), 'autofocus' => array(), 'cols' => array(), 'disabled' => array(), 'maxlength' => array(), 'minlength' => array(), - 'name' => array(), + 'name' => array( + 'blacklisted_value_regex' => '(^|\\s)(__amp_\\s*|__count__|__definegetter__|__definesetter__|__lookupgetter__|__lookupsetter__|__nosuchmethod__|__parent__|__proto__|__amp_\\s*|\\$p|\\$proxy|acceptcharset|addeventlistener|appendchild|assignedslot|attachshadow|baseuri|checkvalidity|childelementcount|childnodes|classlist|classname|clientheight|clientleft|clienttop|clientwidth|comparedocumentposition|computedname|computedrole|contenteditable|createshadowroot|enqueaction|firstchild|firstelementchild|getanimations|getattribute|getattributens|getattributenode|getattributenodens|getboundingclientrect|getclientrects|getdestinationinsertionpoints|getelementsbyclassname|getelementsbytagname|getelementsbytagnamens|getrootnode|hasattribute|hasattributens|hasattributes|haschildnodes|haspointercapture|innerhtml|innertext|inputmode|insertadjacentelement|insertadjacenthtml|insertadjacenttext|iscontenteditable|isdefaultnamespace|isequalnode|issamenode|lastchild|lastelementchild|lookupnamespaceuri|namespaceuri|nextelementsibling|nextsibling|nodename|nodetype|nodevalue|offsetheight|offsetleft|offsetparent|offsettop|offsetwidth|outerhtml|outertext|ownerdocument|parentelement|parentnode|previouselementsibling|previoussibling|queryselector|queryselectorall|releasepointercapture|removeattribute|removeattributens|removeattributenode|removechild|removeeventlistener|replacechild|reportvalidity|requestpointerlock|scrollheight|scrollintoview|scrollintoviewifneeded|scrollleft|scrollwidth|setattribute|setattributens|setattributenode|setattributenodens|setpointercapture|shadowroot|stylemap|tabindex|tagname|textcontent|tostring|valueof|(webkit|ms|moz|o)dropzone|(webkit|moz|ms|o)matchesselector|(webkit|moz|ms|o)requestfullscreen|(webkit|moz|ms|o)requestfullscreen)(\\s|$)', + ), 'placeholder' => array(), 'readonly' => array(), 'required' => array(), @@ -5331,11 +8019,7 @@ class AMP_Allowed_Tags_Generated { 'wrap' => array(), ), 'tag_spec' => array( - 'also_requires_tag' => array( - 'amp-form extension .js script', - ), - 'mandatory_ancestor' => 'form', - 'spec_url' => 'https://www.ampproject.org/docs/reference/extended/amp-form.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-form', ), ), @@ -5345,7 +8029,6 @@ class AMP_Allowed_Tags_Generated { 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -5402,32 +8085,43 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'systemlanguage' => array(), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'word-spacing' => array(), 'writing-mode' => array(), 'xlink:actuate' => array(), 'xlink:arcrole' => array(), 'xlink:href' => array( - 'value_regex' => '#.*', + 'alternative_names' => array( + 'href', + ), + 'allow_empty' => false, + 'allow_relative' => true, ), 'xlink:role' => array(), 'xlink:show' => array(), 'xlink:title' => array(), 'xlink:type' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -5484,17 +8178,22 @@ class AMP_Allowed_Tags_Generated { ), array( 'attr_spec_list' => array( - 'class' => array(), - 'xml:base' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', 'spec_name' => 'svg title', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -5525,13 +8224,14 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, - 'allowed_protocol' => array( - 'https', - ), ), 'srclang' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_parent' => 'audio', 'spec_name' => 'audio > track', ), @@ -5551,15 +8251,16 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, - 'allowed_protocol' => array( - 'https', - ), ), 'srclang' => array( 'mandatory' => true, ), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_parent' => 'audio', 'spec_name' => 'audio > track[kind=subtitles]', ), @@ -5578,13 +8279,14 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, - 'allowed_protocol' => array( - 'https', - ), ), 'srclang' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_parent' => 'video', 'spec_name' => 'video > track', ), @@ -5604,15 +8306,16 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, - 'allowed_protocol' => array( - 'https', - ), ), 'srclang' => array( 'mandatory' => true, ), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_parent' => 'video', 'spec_name' => 'video > track[kind=subtitles]', ), @@ -5620,6 +8323,9 @@ class AMP_Allowed_Tags_Generated { ), array( 'attr_spec_list' => array( + '[label]' => array(), + '[src]' => array(), + '[srclang]' => array(), 'default' => array( 'value' => '', ), @@ -5631,13 +8337,14 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, - 'allowed_protocol' => array( - 'https', - ), ), 'srclang' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_parent' => 'amp-audio', 'spec_name' => 'amp-audio > track', ), @@ -5645,6 +8352,9 @@ class AMP_Allowed_Tags_Generated { ), array( 'attr_spec_list' => array( + '[label]' => array(), + '[src]' => array(), + '[srclang]' => array(), 'default' => array( 'value' => '', ), @@ -5657,15 +8367,16 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, - 'allowed_protocol' => array( - 'https', - ), ), 'srclang' => array( 'mandatory' => true, ), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_parent' => 'amp-audio', 'spec_name' => 'amp-audio > track[kind=subtitles]', ), @@ -5673,6 +8384,9 @@ class AMP_Allowed_Tags_Generated { ), array( 'attr_spec_list' => array( + '[label]' => array(), + '[src]' => array(), + '[srclang]' => array(), 'default' => array( 'value' => '', ), @@ -5684,13 +8398,14 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, - 'allowed_protocol' => array( - 'https', - ), ), 'srclang' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_parent' => 'amp-video', 'spec_name' => 'amp-video > track', ), @@ -5698,6 +8413,9 @@ class AMP_Allowed_Tags_Generated { ), array( 'attr_spec_list' => array( + '[label]' => array(), + '[src]' => array(), + '[srclang]' => array(), 'default' => array( 'value' => '', ), @@ -5710,27 +8428,60 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, - 'allowed_protocol' => array( - 'https', - ), ), 'srclang' => array( 'mandatory' => true, ), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_parent' => 'amp-video', 'spec_name' => 'amp-video > track[kind=subtitles]', ), ), + array( + 'attr_spec_list' => array( + '[label]' => array(), + '[src]' => array(), + '[srclang]' => array(), + 'default' => array( + 'value' => '', + ), + 'kind' => array( + 'mandatory' => true, + 'value_casei' => 'subtitles', + ), + 'label' => array(), + 'src' => array( + 'blacklisted_value_regex' => '__amp_source_origin', + 'mandatory' => true, + 'allow_relative' => false, + ), + 'srclang' => array( + 'mandatory' => true, + ), + ), + 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), + 'mandatory_parent' => 'amp-ima-video', + 'spec_name' => 'amp-ima-video > track[kind=subtitles]', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-ima-video', + ), + + ), ), 'tref' => array( array( 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -5784,32 +8535,43 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'systemlanguage' => array(), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'word-spacing' => array(), 'writing-mode' => array(), 'xlink:actuate' => array(), 'xlink:arcrole' => array(), 'xlink:href' => array( - 'value_regex' => '#.*', + 'alternative_names' => array( + 'href', + ), + 'allow_empty' => false, + 'allow_relative' => true, ), 'xlink:role' => array(), 'xlink:show' => array(), 'xlink:title' => array(), 'xlink:type' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -5819,7 +8581,6 @@ class AMP_Allowed_Tags_Generated { 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -5877,17 +8638,20 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'systemlanguage' => array(), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), 'textlength' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'word-spacing' => array(), 'writing-mode' => array(), 'x' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), @@ -5895,8 +8659,12 @@ class AMP_Allowed_Tags_Generated { 'y' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -5931,7 +8699,6 @@ class AMP_Allowed_Tags_Generated { 'attr_spec_list' => array( 'alignment-baseline' => array(), 'baseline-shift' => array(), - 'class' => array(), 'clip' => array(), 'clip-path' => array(), 'clip-rule' => array(), @@ -5986,12 +8753,16 @@ class AMP_Allowed_Tags_Generated { 'stroke-miterlimit' => array(), 'stroke-opacity' => array(), 'stroke-width' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'systemlanguage' => array(), 'text-anchor' => array(), 'text-decoration' => array(), 'text-rendering' => array(), 'transform' => array(), 'unicode-bidi' => array(), + 'vector-effect' => array(), 'visibility' => array(), 'width' => array(), 'word-spacing' => array(), @@ -6000,13 +8771,16 @@ class AMP_Allowed_Tags_Generated { 'xlink:actuate' => array(), 'xlink:arcrole' => array(), 'xlink:href' => array( - 'value_regex' => '#.*', + 'alternative_names' => array( + 'href', + ), + 'allow_empty' => false, + 'allow_relative' => true, ), 'xlink:role' => array(), 'xlink:show' => array(), 'xlink:title' => array(), 'xlink:type' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), @@ -6014,8 +8788,12 @@ class AMP_Allowed_Tags_Generated { 'y' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -6035,15 +8813,12 @@ class AMP_Allowed_Tags_Generated { 'height' => array(), 'loop' => array(), 'muted' => array(), + 'playsinline' => array(), 'poster' => array(), 'preload' => array(), 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => false, - 'allowed_protocol' => array( - 'data', - 'https', - ), ), 'width' => array(), ), @@ -6053,7 +8828,7 @@ class AMP_Allowed_Tags_Generated { ), 'mandatory_ancestor' => 'noscript', 'mandatory_ancestor_suggested_alternative' => 'amp-video', - 'spec_url' => 'https://www.ampproject.org/docs/reference/amp-video.html', + 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-video', ), ), @@ -6063,9 +8838,11 @@ class AMP_Allowed_Tags_Generated { 'attr_spec_list' => array( 'externalresourcesrequired' => array(), 'preserveaspectratio' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'viewbox' => array(), 'viewtarget' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), @@ -6073,8 +8850,12 @@ class AMP_Allowed_Tags_Generated { 'zoomandpan' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -6085,17 +8866,23 @@ class AMP_Allowed_Tags_Generated { 'g1' => array(), 'g2' => array(), 'k' => array(), + 'style' => array( + 'blacklisted_value_regex' => '!important', + ), 'u1' => array(), 'u2' => array(), - 'xml:base' => array(), 'xml:lang' => array(), 'xml:space' => array(), 'xmlns' => array(), 'xmlns:xlink' => array(), ), 'tag_spec' => array( + 'html_format' => array( + 'amp', + 'amp4ads', + ), 'mandatory_ancestor' => 'svg', - 'spec_url' => 'https://www.ampproject.org/docs/reference/spec.html#svg', + 'spec_url' => 'https://www.ampproject.org/docs/reference/spec#svg', ), ), @@ -6121,6 +8908,8 @@ class AMP_Allowed_Tags_Generated { ); private static $layout_allowed_attrs = array( + '[height]' => array(), + '[width]' => array(), 'height' => array(), 'heights' => array(), 'layout' => array(), @@ -6131,6 +8920,45 @@ class AMP_Allowed_Tags_Generated { private static $globally_allowed_attrs = array( + '[aria-activedescendant]' => array(), + '[aria-atomic]' => array(), + '[aria-autocomplete]' => array(), + '[aria-busy]' => array(), + '[aria-checked]' => array(), + '[aria-controls]' => array(), + '[aria-describedby]' => array(), + '[aria-disabled]' => array(), + '[aria-dropeffect]' => array(), + '[aria-expanded]' => array(), + '[aria-flowto]' => array(), + '[aria-grabbed]' => array(), + '[aria-haspopup]' => array(), + '[aria-hidden]' => array(), + '[aria-invalid]' => array(), + '[aria-label]' => array(), + '[aria-labelledby]' => array(), + '[aria-level]' => array(), + '[aria-live]' => array(), + '[aria-multiline]' => array(), + '[aria-multiselectable]' => array(), + '[aria-orientation]' => array(), + '[aria-owns]' => array(), + '[aria-posinset]' => array(), + '[aria-pressed]' => array(), + '[aria-readonly]' => array(), + '[aria-relevant]' => array(), + '[aria-required]' => array(), + '[aria-selected]' => array(), + '[aria-setsize]' => array(), + '[aria-sort]' => array(), + '[aria-valuemax]' => array(), + '[aria-valuemin]' => array(), + '[aria-valuenow]' => array(), + '[aria-valuetext]' => array(), + '[class]' => array(), + '[hidden]' => array(), + '[text]' => array(), + 'about' => array(), 'accesskey' => array(), 'amp-access' => array(), 'amp-access-behavior' => array(), @@ -6149,6 +8977,7 @@ class AMP_Allowed_Tags_Generated { 'aria-busy' => array(), 'aria-checked' => array(), 'aria-controls' => array(), + 'aria-current' => array(), 'aria-describedby' => array(), 'aria-disabled' => array(), 'aria-dropeffect' => array(), @@ -6181,15 +9010,21 @@ class AMP_Allowed_Tags_Generated { 'class' => array( 'blacklisted_value_regex' => '(^|\\w)i-amphtml-', ), + 'content' => array(), + 'datatype' => array(), 'dir' => array(), 'draggable' => array(), 'fallback' => array( 'value' => '', ), + 'hidden' => array( + 'value' => '', + ), 'i-amp-access-id' => array(), 'id' => array( - 'blacklisted_value_regex' => '^i-amphtml-', + 'blacklisted_value_regex' => '(^|\\s)(__amp_\\s*|__count__|__definegetter__|__definesetter__|__lookupgetter__|__lookupsetter__|__nosuchmethod__|__parent__|__proto__|__amp_\\s*|\\$p|\\$proxy|acceptcharset|addeventlistener|appendchild|assignedslot|attachshadow|amp|baseuri|checkvalidity|childelementcount|childnodes|classlist|classname|clientheight|clientleft|clienttop|clientwidth|comparedocumentposition|computedname|computedrole|contenteditable|createshadowroot|enqueaction|firstchild|firstelementchild|getanimations|getattribute|getattributens|getattributenode|getattributenodens|getboundingclientrect|getclientrects|getdestinationinsertionpoints|getelementsbyclassname|getelementsbytagname|getelementsbytagnamens|getrootnode|hasattribute|hasattributens|hasattributes|haschildnodes|haspointercapture|i-amphtml-\\s*|innerhtml|innertext|inputmode|insertadjacentelement|insertadjacenthtml|insertadjacenttext|iscontenteditable|isdefaultnamespace|isequalnode|issamenode|lastchild|lastelementchild|lookupnamespaceuri|namespaceuri|nextelementsibling|nextsibling|nodename|nodetype|nodevalue|offsetheight|offsetleft|offsetparent|offsettop|offsetwidth|outerhtml|outertext|ownerdocument|parentelement|parentnode|previouselementsibling|previoussibling|queryselector|queryselectorall|releasepointercapture|removeattribute|removeattributens|removeattributenode|removechild|removeeventlistener|replacechild|reportvalidity|requestpointerlock|scrollheight|scrollintoview|scrollintoviewifneeded|scrollleft|scrollwidth|setattribute|setattributens|setattributenode|setattributenodens|setpointercapture|shadowroot|stylemap|tabindex|tagname|textcontent|tostring|valueof|(webkit|ms|moz|o)dropzone|(webkit|moz|ms|o)matchesselector|(webkit|moz|ms|o)requestfullscreen|(webkit|moz|ms|o)requestfullscreen)(\\s|$)', ), + 'inlist' => array(), 'itemid' => array(), 'itemprop' => array(), 'itemref' => array(), @@ -6202,14 +9037,23 @@ class AMP_Allowed_Tags_Generated { 'placeholder' => array( 'value' => '', ), + 'prefix' => array(), + 'property' => array(), + 'rel' => array( + 'blacklisted_value_regex' => '(^|\\s)(canonical|components|dns-prefetch|import|manifest|preconnect|preload|prerender|serviceworker|stylesheet|subresource)(\\s|$)', + ), + 'resource' => array(), + 'rev' => array(), 'role' => array(), 'tabindex' => array(), 'title' => array(), 'translate' => array(), + 'typeof' => array(), 'validation-for' => array(), 'visible-when-invalid' => array( - 'value_regex' => '(badInput|customError|patternMismatch|rangeOverflow|rangeUnderflow|stepMismatch|tooLong|typeMismatch|valueMissing)', + 'value_regex' => '(badinput|customerror|patternmismatch|rangeoverflow|rangeunderflow|stepmismatch|toolong|typemismatch|valuemissing)', ), + 'vocab' => array(), ); From 30064ca7eea79902071756c8fb6ed26551e0ba3c Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 4 Dec 2017 18:18:41 -0600 Subject: [PATCH 02/25] 804 : Prevent errors on amp_wp_build.py, update extensions dir. Before, there was an error in: tag_spec.also_requires_tag This didn't always have the property. Also, update the directory of the extensions. The .protoascii file is no longer in the directory '0.1.' --- bin/amp_wp_build.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/amp_wp_build.py b/bin/amp_wp_build.py index 5fdc95bede9..37d5611ec57 100644 --- a/bin/amp_wp_build.py +++ b/bin/amp_wp_build.py @@ -83,11 +83,11 @@ def GenValidatorProtoascii(out_dir): assert re.match(r'^[a-zA-Z_\-0-9]+$', out_dir), 'bad out_dir: %s' % out_dir protoascii_segments = [open('validator-main.protoascii').read()] - extensions = glob.glob('extensions/*/0.1/validator-*.protoascii') + extensions = glob.glob('extensions/*/validator-*.protoascii') # In the Github project, the extensions are located in a sibling directory # to the validator rather than a child directory. if not extensions: - extensions = glob.glob('../extensions/*/0.1/validator-*.protoascii') + extensions = glob.glob('../extensions/*/validator-*.protoascii') extensions.sort() for extension in extensions: protoascii_segments.append(open(extension).read()) @@ -428,7 +428,7 @@ def GetTagRules(tag_spec): tag_rules = {} - if tag_spec.also_requires_tag: + if hasattr(tag_spec, 'also_requires_tag') and tag_spec.also_requires_tag: also_requires_tag_list = [] for also_requires_tag in tag_spec.also_requires_tag: also_requires_tag_list.append(UnicodeEscape(also_requires_tag)) From ba459a22b4dd5337dfa856d8c74fc6f9db918ed6 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Tue, 5 Dec 2017 23:55:10 -0600 Subject: [PATCH 03/25] Create is_mandatory_attribute_missing method --- .../class-amp-tag-and-attribute-sanitizer.php | 42 ++++++++++++------- tests/test-tag-and-attribute-sanitizer.php | 7 +--- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php index b3d6d1287bd..3344c1241ee 100644 --- a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php +++ b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php @@ -139,22 +139,15 @@ private function process_node( $node ) { // If we're here, then we're not sure which spec should // be used. Let's use the top scoring ones. foreach( $spec_ids_sorted as $id ) { - $attr_spec_list = array_merge( $attr_spec_list, $rule_spec_list_to_validate[ $id ][AMP_Rule_Spec::ATTR_SPEC_LIST] ); + $spec_list = $rule_spec_list_to_validate[ $id ][ AMP_Rule_Spec::ATTR_SPEC_LIST ]; + if ( ! $this->is_mandatory_attribute_missing( $spec_list, $node ) ) { + $attr_spec_list = array_merge( $attr_spec_list, $spec_list ); + } + } + if ( empty( $attr_spec_list ) ) { + $this->remove_node( $node ); + return; } - } - } - - // If an attribute is mandatory and we don't have it, just remove the node and move on. - foreach ( $attr_spec_list as $attr_name => $attr_spec_rule_value ) { - $is_mandatory = - isset( $attr_spec_rule_value[ AMP_Rule_Spec::MANDATORY ] ) - ? (bool) $attr_spec_rule_value[ AMP_Rule_Spec::MANDATORY ] - : false; - $attribute_exists = $node->hasAttribute( $attr_name ); - - if ( $is_mandatory && ! $attribute_exists ) { - $this->remove_node( $node ); - return; } } @@ -165,6 +158,24 @@ private function process_node( $node ) { $this->sanitize_disallowed_attribute_values_in_node( $node, $attr_spec_list ); } + /** + * Whether a node is missing a required attribute. + * + * @param $attr_spec + * @param $node + * @return $is_missing boolean Whether a required attribute is missing. + */ + public function is_mandatory_attribute_missing( $attr_spec, $node ) { + foreach ( $attr_spec as $attr_name => $attr_spec_rule_value ) { + $is_mandatory = isset( $attr_spec_rule_value[ AMP_Rule_Spec::MANDATORY ] ) ? boolval( $attr_spec_rule_value[ AMP_Rule_Spec::MANDATORY ] ) : false; + $attribute_exists = $node->hasAttribute( $attr_name ); + if ( $is_mandatory && ! $attribute_exists ) { + return true; + } + } + return false; + } + /** * Checks to see if a node's placement with the DOM is be valid for the * given tag_spec. If there are restrictions placed on the type of node @@ -481,6 +492,7 @@ private function check_attr_spec_rule_mandatory( $node, $attr_name, $attr_spec_r private function check_attr_spec_rule_value( $node, $attr_name, $attr_spec_rule ) { if ( isset( $attr_spec_rule[AMP_Rule_Spec::VALUE] ) ) { if ( $node->hasAttribute( $attr_name ) ) { + $spec_value = $attr_spec_rule[ AMP_Rule_Spec::VALUE ]; if ( $node->getAttribute( $attr_name ) == $attr_spec_rule[AMP_Rule_Spec::VALUE] ) { return AMP_Rule_Spec::PASS; } else { diff --git a/tests/test-tag-and-attribute-sanitizer.php b/tests/test-tag-and-attribute-sanitizer.php index d934de59dee..952af31f21a 100644 --- a/tests/test-tag-and-attribute-sanitizer.php +++ b/tests/test-tag-and-attribute-sanitizer.php @@ -135,11 +135,6 @@ public function get_data() { 'Click me.', ), - 'attribute_with_disallowed_protocol_removed' => array( - 'Click me.', - 'Click me.' - ), - 'attribute_value_valid' => array( '', '', @@ -369,7 +364,7 @@ public function get_data() { 'a_with_rev' => array( 'Link', - 'Link', + 'Link', ), 'a_with_target_blank' => array( From 8cff76813b32e34fd285af43934186d462422b9d Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Wed, 6 Dec 2017 23:50:58 -0600 Subject: [PATCH 04/25] 804 : Modify PHPUnit tests for tag and attribute validation. Since the allowed tags and attributes are updated, Several assertions failed. Update them to reflect the new AMP spec. Since there is no longer a protocol whitelist, Remove the assertions for protocols. --- ...ribute-sanitizer-private-methods-tests.php | 243 ------------------ tests/test-tag-and-attribute-sanitizer.php | 43 +--- 2 files changed, 3 insertions(+), 283 deletions(-) diff --git a/tests/amp-tag-and-attribute-sanitizer-private-methods-tests.php b/tests/amp-tag-and-attribute-sanitizer-private-methods-tests.php index 0fea4c87c83..1493678e18c 100644 --- a/tests/amp-tag-and-attribute-sanitizer-private-methods-tests.php +++ b/tests/amp-tag-and-attribute-sanitizer-private-methods-tests.php @@ -246,136 +246,6 @@ public function get_attr_spec_rule_data() { ), 'expected' => AMP_Rule_Spec::NOT_APPLICABLE, ), - - - - - 'test_attr_spec_rule_allowed_protocol_pass' => array( - array( - 'rule_spec_index' => 0, - 'tag_name' => 'a', - 'attribute_name' => 'href', - 'attribute_value' => 'http://example.com', - 'include_attr' => true, - 'include_attr_value' => true, - 'func_name' => 'check_attr_spec_rule_allowed_protocol', - ), - 'expected' => AMP_Rule_Spec::PASS, - ), - 'test_attr_spec_rule_allowed_protocol_fail' => array( - array( - 'rule_spec_index' => 0, - 'tag_name' => 'a', - 'attribute_name' => 'href', - 'attribute_value' => 'evil://example.com', - 'include_attr' => true, - 'include_attr_value' => true, - 'func_name' => 'check_attr_spec_rule_allowed_protocol', - ), - 'expected' => AMP_Rule_Spec::FAIL, - ), - 'test_attr_spec_rule_allowed_protocol_na' => array( - array( - 'rule_spec_index' => 0, - 'tag_name' => 'a', - 'attribute_name' => 'href', - 'attribute_value' => 'invalid', - 'include_attr' => false, - 'include_attr_value' => false, - 'func_name' => 'check_attr_spec_rule_allowed_protocol', - ), - 'expected' => AMP_Rule_Spec::NOT_APPLICABLE, - ), - - - 'test_attr_spec_rule_allowed_protocol_srcset_single_pass' => array( - array( - 'rule_spec_index' => 0, - 'tag_name' => 'amp-img', - 'attribute_name' => 'srcset', - 'attribute_value' => 'http://veryunique.com/img.jpg', - 'include_attr' => true, - 'include_attr_value' => true, - 'func_name' => 'check_attr_spec_rule_allowed_protocol', - ), - 'expected' => AMP_Rule_Spec::PASS, - ), - 'test_attr_spec_rule_allowed_protocol_srcset_multiple_pass' => array( - array( - 'rule_spec_index' => 0, - 'tag_name' => 'amp-img', - 'attribute_name' => 'srcset', - 'attribute_value' => 'http://example.com/img.jpg, https://example.com/whatever.jpg, image.jpg', - 'include_attr' => true, - 'include_attr_value' => true, - 'func_name' => 'check_attr_spec_rule_allowed_protocol', - ), - 'expected' => AMP_Rule_Spec::PASS, - ), - 'test_attr_spec_rule_allowed_protocol_srcset_single_fail' => array( - array( - 'rule_spec_index' => 0, - 'tag_name' => 'amp-img', - 'attribute_name' => 'srcset', - 'attribute_value' => 'bad://example.com/img.jpg', - 'include_attr' => true, - 'include_attr_value' => true, - 'func_name' => 'check_attr_spec_rule_allowed_protocol', - ), - 'expected' => AMP_Rule_Spec::FAIL, - ), - 'test_attr_spec_rule_allowed_protocol_srcset_multiple_fail' => array( - array( - 'rule_spec_index' => 0, - 'tag_name' => 'amp-img', - 'attribute_name' => 'srcset', - 'attribute_value' => 'bad://example.com/img.jpg, evil://example.com/whatever.jpg', - 'include_attr' => true, - 'include_attr_value' => true, - 'func_name' => 'check_attr_spec_rule_allowed_protocol', - ), - 'expected' => AMP_Rule_Spec::FAIL, - ), - 'test_attr_spec_rule_allowed_protocol_srcset_multiple_fail_good_first' => array( - array( - 'rule_spec_index' => 0, - 'tag_name' => 'amp-img', - 'attribute_name' => 'srcset', - 'attribute_value' => 'https://example.com/img.jpg, evil://example.com/whatever.jpg', - 'include_attr' => true, - 'include_attr_value' => true, - 'func_name' => 'check_attr_spec_rule_allowed_protocol', - ), - 'expected' => AMP_Rule_Spec::FAIL, - ), - 'test_attr_spec_rule_allowed_protocol_srcset_multiple_fail_bad_first' => array( - array( - 'rule_spec_index' => 0, - 'tag_name' => 'amp-img', - 'attribute_name' => 'srcset', - 'attribute_value' => 'evil://example.com/img.jpg, https://example.com/whatever.jpg', - 'include_attr' => true, - 'include_attr_value' => true, - 'func_name' => 'check_attr_spec_rule_allowed_protocol', - ), - 'expected' => AMP_Rule_Spec::FAIL, - ), - 'test_attr_spec_rule_allowed_protocol_srcset_na' => array( - array( - 'rule_spec_index' => 0, - 'tag_name' => 'amp-img', - 'attribute_name' => 'srcset', - 'attribute_value' => 'invalid', - 'include_attr' => false, - 'include_attr_value' => false, - 'func_name' => 'check_attr_spec_rule_allowed_protocol', - ), - 'expected' => AMP_Rule_Spec::NOT_APPLICABLE, - ), - - - - 'test_attr_spec_rule_disallowed_relative_pass' => array( array( 'rule_spec_index' => 0, @@ -451,61 +321,6 @@ public function get_attr_spec_rule_data() { ), 'expected' => AMP_Rule_Spec::NOT_APPLICABLE, ), - - - - 'test_attr_spec_rule_disallowed_domain_pass' => array( - array( - 'rule_spec_index' => 0, - 'tag_name' => 'form', - 'attribute_name' => 'action', - 'attribute_value' => 'https://example.com', - 'include_attr' => true, - 'include_attr_value' => true, - 'func_name' => 'check_attr_spec_rule_disallowed_domain', - ), - 'expected' => AMP_Rule_Spec::PASS, - ), - 'test_attr_spec_rule_disallowed_domain_fail' => array( - array( - 'rule_spec_index' => 0, - 'tag_name' => 'form', - 'attribute_name' => 'action', - 'attribute_value' => '//cdn.ampproject.org', - 'include_attr' => true, - 'include_attr_value' => true, - 'func_name' => 'check_attr_spec_rule_disallowed_domain', - ), - 'expected' => AMP_Rule_Spec::FAIL, - ), - 'test_attr_spec_rule_disallowed_domain_fail_2' => array( - array( - 'rule_spec_index' => 0, - 'tag_name' => 'form', - 'attribute_name' => 'action', - 'attribute_value' => 'https://cdn.ampproject.org', - 'include_attr' => true, - 'include_attr_value' => true, - 'func_name' => 'check_attr_spec_rule_disallowed_domain', - ), - 'expected' => AMP_Rule_Spec::FAIL, - ), - 'test_attr_spec_rule_disallowed_domain_na' => array( - array( - 'rule_spec_index' => 0, - 'tag_name' => 'form', - 'attribute_name' => 'action', - 'attribute_value' => 'invalid', - 'include_attr' => false, - 'include_attr_value' => false, - 'func_name' => 'check_attr_spec_rule_disallowed_domain', - ), - 'expected' => AMP_Rule_Spec::NOT_APPLICABLE, - ), - - - - 'test_attr_spec_rule_blacklisted_value_regex_pass' => array( array( 'rule_spec_index' => 0, @@ -1169,36 +984,6 @@ public function get_validate_attr_spec_list_for_node_data() { ), 1, ), - 'attributes_allowed_protocol_pass' => array( - array( - 'source' => '
', - 'node_tag_name' => 'div', - 'attr_spec_list' => array( - 'attribute1' => array( - 'allowed_protocol' => array( - 'http', - 'https', - ), - ), - ), - ), - 1, - ), - 'attributes_allowed_protocol_fail' => array( - array( - 'source' => '
', - 'node_tag_name' => 'div', - 'attr_spec_list' => array( - 'attribute1' => array( - 'allowed_protocol' => array( - 'http', - 'https', - ), - ), - ), - ), - 0, - ), 'attributes_allow_relative_false_pass' => array( array( 'source' => '
', @@ -1247,34 +1032,6 @@ public function get_validate_attr_spec_list_for_node_data() { ), 0, ), - 'attributes_disallowed_domain_pass' => array( - array( - 'source' => '
', - 'node_tag_name' => 'div', - 'attr_spec_list' => array( - 'attribute1' => array( - 'disallowed_domain' => array( - 'dis.allow.ed' - ), - ), - ), - ), - 1, - ), - 'attributes_disallowed_domain_fail' => array( - array( - 'source' => '
', - 'node_tag_name' => 'div', - 'attr_spec_list' => array( - 'attribute1' => array( - 'disallowed_domain' => array( - 'dis.allow.ed' - ), - ), - ), - ), - 0, - ), 'attributes_blacklisted_regex' => array( array( 'source' => '
', diff --git a/tests/test-tag-and-attribute-sanitizer.php b/tests/test-tag-and-attribute-sanitizer.php index 952af31f21a..63960e3a1ab 100644 --- a/tests/test-tag-and-attribute-sanitizer.php +++ b/tests/test-tag-and-attribute-sanitizer.php @@ -107,7 +107,7 @@ public function get_data() { 'attribute_value_blacklisted_by_regex_removed' => array( 'Click me.', - 'Click me.' + 'Click me.' ), 'host_relative_url_allowed' => array( @@ -230,8 +230,8 @@ public function get_data() { ), 'allow_node_with_valid_mandatory_attribute' => array( - // script only allows application/json - '', + '', + '', '', ), @@ -285,28 +285,6 @@ public function get_data() { '', ), - 'amp-img_with_bad_protocols' => array( - '', - '', - ), - - // Test Cases from test-amp-blacklist-sanitizer.php - - // 'disallowed_tag_with_innertext' => array( - // '', - // '' - // ), - - // 'multiple_disallowed_tags_only' => array( - // '', - // '' - // ), - - // 'multiple_disallowed_tags_only_in_child' => array( - // '

', - // '' - // ), - 'allowed_tag_only' => array( '

Text

', '

Text

' @@ -332,21 +310,11 @@ public function get_data() { 'Link', ), - 'javascript_protocol' => array( - 'Click', - 'Click' - ), - 'attribute_recursive' => array( '', '' ), - 'mixed_tags' => array( - '

Text

', - '

Text

' - ), - 'no_strip_amp_tags' => array( '', '' @@ -397,11 +365,6 @@ public function get_data() { 'Link', ), - 'a_with_href_scheme_invalid' => array( - 'Link', - 'Link', - ), - 'a_with_href_scheme_tel' => array( 'Call Me, Maybe', 'Call Me, Maybe', From dd807a8e76ee39c6f2bd60db034a30625c7d03f3 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Thu, 7 Dec 2017 00:00:40 -0600 Subject: [PATCH 05/25] 804 : Remove the requirement that 'data-multi-size' be empty. This file was generated from a build script, In the repo https://github.com/ampproject/amphtml The spec file seems to require an empty value: extensions/amp-ad/validator-amp-ad.protoascii But examples of seem to have the value. Like array(), 'data-multi-size' => array( 'mandatory' => true, - 'value' => '', ), 'json' => array(), 'media' => array(), From a698eead2c654ebe9720b34e78793e0338d886a1 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Thu, 7 Dec 2017 02:35:10 -0600 Subject: [PATCH 06/25] 804 : PHPUnit tests for newly-allowed tags. Having generated a new file for the allowed tags and attributes, Add these to the data for test_sanitizer(). Also, add unit test for is_missing_mandatory_attribute(). And rename that function from: is_mandatory_attribute_missing(). --- .../class-amp-tag-and-attribute-sanitizer.php | 17 +- tests/test-tag-and-attribute-sanitizer.php | 180 +++++++++++++----- 2 files changed, 141 insertions(+), 56 deletions(-) diff --git a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php index 3344c1241ee..5f0dd0b0407 100644 --- a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php +++ b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php @@ -140,7 +140,7 @@ private function process_node( $node ) { // be used. Let's use the top scoring ones. foreach( $spec_ids_sorted as $id ) { $spec_list = $rule_spec_list_to_validate[ $id ][ AMP_Rule_Spec::ATTR_SPEC_LIST ]; - if ( ! $this->is_mandatory_attribute_missing( $spec_list, $node ) ) { + if ( ! $this->is_missing_mandatory_attribute( $spec_list, $node ) ) { $attr_spec_list = array_merge( $attr_spec_list, $spec_list ); } } @@ -159,16 +159,19 @@ private function process_node( $node ) { } /** - * Whether a node is missing a required attribute. + * Whether a node is missing a mandatory attribute. * - * @param $attr_spec - * @param $node - * @return $is_missing boolean Whether a required attribute is missing. + * @param array $attr_spec The attribute specification. + * @param object $node The DOMElement of the node to check. + * @return boolean $is_missing boolean Whether a required attribute is missing. */ - public function is_mandatory_attribute_missing( $attr_spec, $node ) { + public function is_missing_mandatory_attribute( $attr_spec, $node ) { + if ( ! is_array( $attr_spec ) ) { + return false; + } foreach ( $attr_spec as $attr_name => $attr_spec_rule_value ) { $is_mandatory = isset( $attr_spec_rule_value[ AMP_Rule_Spec::MANDATORY ] ) ? boolval( $attr_spec_rule_value[ AMP_Rule_Spec::MANDATORY ] ) : false; - $attribute_exists = $node->hasAttribute( $attr_name ); + $attribute_exists = method_exists( $node, 'hasAttribute' ) && $node->hasAttribute( $attr_name ); if ( $is_mandatory && ! $attribute_exists ) { return true; } diff --git a/tests/test-tag-and-attribute-sanitizer.php b/tests/test-tag-and-attribute-sanitizer.php index 63960e3a1ab..ecd2cba3582 100644 --- a/tests/test-tag-and-attribute-sanitizer.php +++ b/tests/test-tag-and-attribute-sanitizer.php @@ -35,11 +35,96 @@ public function get_data() { '
', ), + 'amp-3q-player' => array( + '', + ), + + 'amp-ad' => array( + '', + ), + + 'amp-ad-exit' => array( + '', + ), + + 'amp-animation' => array( + '', + ), + + 'amp-call-tracking' => array( + '+1 (23) 456-789', + ), + + 'amp-call-tracking_blacklisted_config' => array( + '+1 (23) 456-789', + '', + ), + + 'amp-embed' => array( + '', + ), + + 'amp-facebook-comments' => array( + '', + ), + + 'amp-facebook-like' => array( + '', + ), + + 'amp-fit-text' => array( + 'Lorem ipsum', + ), + + 'amp-gist' => array( + '', + ), + + 'amp-gwd-animation' => array( + '', + ), + + 'amp-ima-video' => array( + '', + ), + + 'amp-imgur' => array( + '', + ), + + 'amp-install-serviceworker' => array( + '', + ), + + 'amp-izlesene' => array( + '', + ), + + 'amp-nexxtv-player' => array( + '', + ), + + 'amp-position-observer' => array( + '', + ), + + 'amp-twitter' => array( + '', + ), + 'amp-user-notification' => array( 'This site uses cookies to personalize content.I accept', 'This site uses cookies to personalize content.I accept', ), + 'amp-video' => array( + '', + ), + + 'amp-vk' => array( + '', + ), + 'amp-apester-media' => array( '', '', @@ -95,9 +180,12 @@ public function get_data() { '', ), + 'h2' => array( + '

Example Text

', + ), + 'empty_element' => array( '
', - '
' ), 'merge_two_attr_specs' => array( @@ -112,58 +200,50 @@ public function get_data() { 'host_relative_url_allowed' => array( 'Click me.', - 'Click me.' ), 'protocol_relative_url_allowed' => array( 'Click me.', - 'Click me.' ), 'node_with_whiteilsted_protocol_http_allowed' => array( 'Click me.', - 'Click me.', ), 'node_with_whiteilsted_protocol_https_allowed' => array( 'Click me.', - 'Click me.', ), 'node_with_whiteilsted_protocol_fb-messenger_allowed' => array( 'Click me.', - 'Click me.', ), 'attribute_value_valid' => array( '', - '', ), 'attribute_value_invalid' => array( - // type is mandatory, so the node is removed + // type is mandatory, so the node is removed. '', '', ), 'attribute_amp_accordion_value' => array( 'test', - 'test' ), 'attribute_value_with_blacklisted_regex_removed' => array( 'Click me.', - 'Click me.' + 'Click me.', ), 'attribute_value_with_blacklisted_multi-part_regex_removed' => array( 'Click me.', - 'Click me.' + 'Click me.', ), 'attribute_value_with_required_regex' => array( 'Click me.', - 'Click me.', ), 'attribute_value_with_disallowed_required_regex_removed' => array( @@ -173,17 +253,14 @@ public function get_data() { 'attribute_value_with_required_value_casei_lower' => array( 'Click.me.', - 'Click.me.', ), 'attribute_value_with_required_value_casei_upper' => array( 'Click.me.', - 'Click.me.', ), 'attribute_value_with_required_value_casei_mixed' => array( 'Click.me.', - 'Click.me.', ), 'attribute_value_with_bad_value_casei_removed' => array( @@ -193,46 +270,42 @@ public function get_data() { 'attribute_value_with_value_regex_casei_lower' => array( '', - '', ), 'attribute_value_with_value_regex_casei_upper' => array( '', - '', ), 'attribute_value_with_bad_value_regex_casei_removed' => array( - // data-ui-logo should be true|false + // data-ui-logo should be true|false. '', '', ), 'attribute_bad_attr_with_no_value_removed' => array( 'something here', - 'something here' + 'something here', ), 'attribute_bad_attr_with_value_removed' => array( 'something here', - 'something here' + 'something here', ), 'remove_node_with_missing_mandatory_attribute' => array( - // script needs "type" + // script needs "type". '', '', ), 'remove_node_with_invalid_mandatory_attribute' => array( - // script only allows application/json, nothing else + // script only allows application/json, nothing else. '', '', ), 'allow_node_with_valid_mandatory_attribute' => array( '', - '', - '', ), 'nodes_with_non_whitelisted_tags_replaced_by_children' => array( @@ -267,7 +340,6 @@ public function get_data() { 'allowed_empty_attr' => array( '', - '', ), 'remove_node_with_disallowed_ancestor' => array( @@ -282,27 +354,25 @@ public function get_data() { 'amp-img_with_good_protocols' => array( '', - '', ), 'allowed_tag_only' => array( '

Text

', - '

Text

' + '

Text

', ), 'disallowed_attributes' => array( 'Link', - 'Link' + 'Link', ), 'onclick_attribute' => array( 'Link', - 'Link' + 'Link', ), 'on_attribute' => array( '', - '' ), 'multiple_disallowed_attributes' => array( @@ -312,32 +382,27 @@ public function get_data() { 'attribute_recursive' => array( '', - '' + '', ), 'no_strip_amp_tags' => array( '', - '' ), 'a_with_attachment_rel' => array( 'Link', - 'Link', ), 'a_with_attachment_rel_plus_another_valid_value' => array( 'Link', - 'Link', ), 'a_with_rev' => array( 'Link', - 'Link', ), 'a_with_target_blank' => array( 'Link', - 'Link', ), 'a_with_target_uppercase_blank' => array( @@ -352,7 +417,6 @@ public function get_data() { 'a_with_target_self' => array( 'Link', - 'Link', ), 'a_with_target_invalid' => array( @@ -362,52 +426,43 @@ public function get_data() { 'a_with_href_invalid' => array( 'Link', - 'Link', ), 'a_with_href_scheme_tel' => array( 'Call Me, Maybe', - 'Call Me, Maybe', ), 'a_with_href_scheme_sms' => array( 'SMS Me, Maybe', - 'SMS Me, Maybe', ), 'a_with_href_scheme_mailto' => array( 'Email Me, Maybe', - 'Email Me, Maybe', ), 'a_with_href_relative' => array( 'Home', - 'Home', ), 'a_with_anchor' => array( 'Home', - 'Home', ), 'a_is_anchor' => array( '', - '', ), 'a_is_achor_with_id' => array( '', - '', ), 'a_empty' => array( 'Hello World', - 'Hello World', ), 'a_empty_with_children_with_restricted_attributes' => array( 'Red&Orange', - 'Red&Orange' + 'Red&Orange', ), 'h1_with_size' => array( @@ -420,7 +475,7 @@ public function get_data() { 'Headline', ), - // font is removed so we should check that other elements are checked as well + // font is removed so we should check that other elements are checked as well. 'font_with_other_bad_elements' => array( 'HeadlineSpan', 'HeadlineSpan', @@ -434,11 +489,38 @@ public function setUp() { $this->layout_allowed_attributes = AMP_Allowed_Tags_Generated::get_allowed_attributes(); } + /** + * Tests is_missing_mandatory_attribute + * + * @see AMP_Tag_And_Attribute_Sanitizer::is_missing_mandatory_attribute() + */ + public function test_is_missing_mandatory_attribute() { + $spec = array( + 'data-gistid' => array( + 'mandatory' => true, + ), + 'media' => array(), + 'noloading' => array(), + ); + $dom = new DomDocument(); + $node = new DOMElement( 'amp-gist' ); + $dom->appendChild( $node ); + $sanitizer = new AMP_Tag_And_Attribute_Sanitizer( $dom ); + $this->assertTrue( $sanitizer->is_missing_mandatory_attribute( $spec, $node ) ); + + $node->setAttribute( 'data-gistid', 'foo-value' ); + $this->assertFalse( $sanitizer->is_missing_mandatory_attribute( $spec, $node ) ); + + $spec_non_array = new stdClass(); + $this->assertFalse( $sanitizer->is_missing_mandatory_attribute( $spec_non_array, $node ) ); + } + /** * @dataProvider get_data * @group allowed-tags */ - public function test_sanitizer( $source, $expected ) { + public function test_sanitizer( $source, $expected = null ) { + $expected = isset( $expected ) ? $expected : $source; $dom = AMP_DOM_Utils::get_dom_from_content( $source ); $sanitizer = new AMP_Tag_And_Attribute_Sanitizer( $dom ); $sanitizer->sanitize(); From a066117eefcfe4ffdecacbf88d0a3ff7b7ab1e63 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Thu, 7 Dec 2017 03:20:53 -0600 Subject: [PATCH 07/25] 804 : Move logic for missing attributes. Before, this was inside an 'else' block. And it should be outside of this, So it applies more broadly. If there is a list of attributes, and one is missing, Remove the node. This was the previous behavior. --- .../class-amp-tag-and-attribute-sanitizer.php | 13 +++++---- tests/test-tag-and-attribute-sanitizer.php | 29 ++++++++++++++----- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php index 5f0dd0b0407..2c56e3ddcd0 100644 --- a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php +++ b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php @@ -138,17 +138,18 @@ private function process_node( $node ) { // This should not happen very often, but... // If we're here, then we're not sure which spec should // be used. Let's use the top scoring ones. - foreach( $spec_ids_sorted as $id ) { - $spec_list = $rule_spec_list_to_validate[ $id ][ AMP_Rule_Spec::ATTR_SPEC_LIST ]; + foreach ( $spec_ids_sorted as $id ) { + $spec_list = isset( $rule_spec_list_to_validate[ $id ][ AMP_Rule_Spec::ATTR_SPEC_LIST ] ) ? $rule_spec_list_to_validate[ $id ][ AMP_Rule_Spec::ATTR_SPEC_LIST ] : null; if ( ! $this->is_missing_mandatory_attribute( $spec_list, $node ) ) { $attr_spec_list = array_merge( $attr_spec_list, $spec_list ); } } - if ( empty( $attr_spec_list ) ) { - $this->remove_node( $node ); - return; - } } + } // End if(). + + if ( ! empty( $attr_spec_list ) && $this->is_missing_mandatory_attribute( $attr_spec_list, $node ) ) { + $this->remove_node( $node ); + return; } // Remove any remaining disallowed attributes. diff --git a/tests/test-tag-and-attribute-sanitizer.php b/tests/test-tag-and-attribute-sanitizer.php index ecd2cba3582..c0814787a8c 100644 --- a/tests/test-tag-and-attribute-sanitizer.php +++ b/tests/test-tag-and-attribute-sanitizer.php @@ -65,11 +65,21 @@ public function get_data() { ), 'amp-facebook-comments' => array( + '', + ), + + 'amp-facebook-comments_missing_required_attribute' => array( '', + '', ), 'amp-facebook-like' => array( + '', + ), + + 'amp-facebook-like_missing_required_attribute' => array( '', + '', ), 'amp-fit-text' => array( @@ -80,12 +90,22 @@ public function get_data() { '', ), + 'amp-gist_missing_mandatory_attribute' => array( + '', + '', + ), + 'amp-gwd-animation' => array( '', ), 'amp-ima-video' => array( + '', + ), + + 'amp-ima-video_missing_required_attribute' => array( '', + '', ), 'amp-imgur' => array( @@ -292,12 +312,6 @@ public function get_data() { 'something here', ), - 'remove_node_with_missing_mandatory_attribute' => array( - // script needs "type". - '', - '', - ), - 'remove_node_with_invalid_mandatory_attribute' => array( // script only allows application/json, nothing else. '', @@ -343,7 +357,7 @@ public function get_data() { ), 'remove_node_with_disallowed_ancestor' => array( - 'The sidebarThis node is not allowed here.', + 'The sidebarThis node is not allowed here.', 'The sidebar', ), @@ -499,7 +513,6 @@ public function test_is_missing_mandatory_attribute() { 'data-gistid' => array( 'mandatory' => true, ), - 'media' => array(), 'noloading' => array(), ); $dom = new DomDocument(); From cfcf73037a59ee315eaf505b625e44d72da9ef3d Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Thu, 7 Dec 2017 03:34:10 -0600 Subject: [PATCH 08/25] 804 : Remove the unused $spec_value variable. This was assigned a value that's used later. There's no need to store it in a variable. --- includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php | 1 - 1 file changed, 1 deletion(-) diff --git a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php index 2c56e3ddcd0..6f509e8be9d 100644 --- a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php +++ b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php @@ -496,7 +496,6 @@ private function check_attr_spec_rule_mandatory( $node, $attr_name, $attr_spec_r private function check_attr_spec_rule_value( $node, $attr_name, $attr_spec_rule ) { if ( isset( $attr_spec_rule[AMP_Rule_Spec::VALUE] ) ) { if ( $node->hasAttribute( $attr_name ) ) { - $spec_value = $attr_spec_rule[ AMP_Rule_Spec::VALUE ]; if ( $node->getAttribute( $attr_name ) == $attr_spec_rule[AMP_Rule_Spec::VALUE] ) { return AMP_Rule_Spec::PASS; } else { From 8f0a92534fb6f6d5692f6041347bdcc8b86b99f5 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Thu, 7 Dec 2017 03:56:23 -0600 Subject: [PATCH 09/25] 804 : Improve variable alignment and add PHPDoc tags. There was some missing documentation. Add this for test_sanitizer and validate_tag_spec_for_node. --- .../class-amp-tag-and-attribute-sanitizer.php | 6 +++++- tests/test-tag-and-attribute-sanitizer.php | 14 +++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php index 6f509e8be9d..df19e789d2c 100644 --- a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php +++ b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php @@ -171,7 +171,7 @@ public function is_missing_mandatory_attribute( $attr_spec, $node ) { return false; } foreach ( $attr_spec as $attr_name => $attr_spec_rule_value ) { - $is_mandatory = isset( $attr_spec_rule_value[ AMP_Rule_Spec::MANDATORY ] ) ? boolval( $attr_spec_rule_value[ AMP_Rule_Spec::MANDATORY ] ) : false; + $is_mandatory = isset( $attr_spec_rule_value[ AMP_Rule_Spec::MANDATORY ] ) ? boolval( $attr_spec_rule_value[ AMP_Rule_Spec::MANDATORY ] ) : false; $attribute_exists = method_exists( $node, 'hasAttribute' ) && $node->hasAttribute( $attr_name ); if ( $is_mandatory && ! $attribute_exists ) { return true; @@ -188,6 +188,10 @@ public function is_missing_mandatory_attribute( $attr_spec, $node ) { * * If any of the tests on the restrictions fail, return false, otherwise * return true. + * + * @param object $node The node to validate. + * @param array $tag_spec The sepecification. + * @return boolean $valid Whether the node's placement is valid. */ private function validate_tag_spec_for_node( $node, $tag_spec ) { if ( ! empty( $tag_spec[AMP_Rule_Spec::MANDATORY_PARENT] ) && diff --git a/tests/test-tag-and-attribute-sanitizer.php b/tests/test-tag-and-attribute-sanitizer.php index c0814787a8c..627d0d88aff 100644 --- a/tests/test-tag-and-attribute-sanitizer.php +++ b/tests/test-tag-and-attribute-sanitizer.php @@ -210,12 +210,12 @@ public function get_data() { 'merge_two_attr_specs' => array( '
Whatever
', - '
Whatever
' + '
Whatever
', ), 'attribute_value_blacklisted_by_regex_removed' => array( 'Click me.', - 'Click me.' + 'Click me.', ), 'host_relative_url_allowed' => array( @@ -515,7 +515,7 @@ public function test_is_missing_mandatory_attribute() { ), 'noloading' => array(), ); - $dom = new DomDocument(); + $dom = new DomDocument(); $node = new DOMElement( 'amp-gist' ); $dom->appendChild( $node ); $sanitizer = new AMP_Tag_And_Attribute_Sanitizer( $dom ); @@ -529,15 +529,19 @@ public function test_is_missing_mandatory_attribute() { } /** + * Test sanitization of tags and attributes. + * * @dataProvider get_data * @group allowed-tags + * @param string $source Markup to process. + * @param string $expected The markup to expect. */ public function test_sanitizer( $source, $expected = null ) { - $expected = isset( $expected ) ? $expected : $source; + $expected = isset( $expected ) ? $expected : $source; $dom = AMP_DOM_Utils::get_dom_from_content( $source ); $sanitizer = new AMP_Tag_And_Attribute_Sanitizer( $dom ); $sanitizer->sanitize(); - $content = AMP_DOM_Utils::get_content_from_dom( $dom ); + $content = AMP_DOM_Utils::get_content_from_dom( $dom ); $this->assertEquals( $expected, $content ); } } From a400fa5e56e5957d0ae2a44eab82b49f55c84002 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Thu, 7 Dec 2017 04:08:36 -0600 Subject: [PATCH 10/25] 804 : Exclude the generated allowed tags file from PHPCS checks. This has hundreds of errors and warnings. It's generated from a Python script. --- phpcs.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/phpcs.xml b/phpcs.xml index 10f6b6b7a6b..d876d0f9546 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -19,4 +19,5 @@ */dev-lib/* */node_modules/* */vendor/* + */includes/sanitizers/class-amp-allowed-tags-generated.php From cfc02473697bb9730056d0ced1515115486babcd Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Thu, 7 Dec 2017 04:43:46 -0600 Subject: [PATCH 11/25] 804 : Align 'array' keywords vertically. In response to the warnings in Travis. And align an equal sign in test_sanitizer(). --- tests/test-tag-and-attribute-sanitizer.php | 212 ++++++++++----------- 1 file changed, 106 insertions(+), 106 deletions(-) diff --git a/tests/test-tag-and-attribute-sanitizer.php b/tests/test-tag-and-attribute-sanitizer.php index 627d0d88aff..8b93ec74960 100644 --- a/tests/test-tag-and-attribute-sanitizer.php +++ b/tests/test-tag-and-attribute-sanitizer.php @@ -15,244 +15,244 @@ public function get_data() { '' ), - 'a-test' => array( + 'a-test' => array( 'Show Image', 'Show Image' ), - 'a4a' => array( + 'a4a' => array( '
', '
', ), - 'ads' => array( + 'ads' => array( '
', '
', ), - 'adsense' => array( + 'adsense' => array( '
', '
', ), - 'amp-3q-player' => array( + 'amp-3q-player' => array( '', ), - 'amp-ad' => array( + 'amp-ad' => array( '', ), - 'amp-ad-exit' => array( + 'amp-ad-exit' => array( '', ), - 'amp-animation' => array( + 'amp-animation' => array( '', ), - 'amp-call-tracking' => array( + 'amp-call-tracking' => array( '+1 (23) 456-789', ), - 'amp-call-tracking_blacklisted_config' => array( + 'amp-call-tracking_blacklisted_config' => array( '+1 (23) 456-789', '', ), - 'amp-embed' => array( + 'amp-embed' => array( '', ), - 'amp-facebook-comments' => array( + 'amp-facebook-comments' => array( '', ), - 'amp-facebook-comments_missing_required_attribute' => array( + 'amp-facebook-comments_missing_required_attribute' => array( '', '', ), - 'amp-facebook-like' => array( + 'amp-facebook-like' => array( '', ), - 'amp-facebook-like_missing_required_attribute' => array( + 'amp-facebook-like_missing_required_attribute' => array( '', '', ), - 'amp-fit-text' => array( + 'amp-fit-text' => array( 'Lorem ipsum', ), - 'amp-gist' => array( + 'amp-gist' => array( '', ), - 'amp-gist_missing_mandatory_attribute' => array( + 'amp-gist_missing_mandatory_attribute' => array( '', '', ), - 'amp-gwd-animation' => array( + 'amp-gwd-animation' => array( '', ), - 'amp-ima-video' => array( + 'amp-ima-video' => array( '', ), - 'amp-ima-video_missing_required_attribute' => array( + 'amp-ima-video_missing_required_attribute' => array( '', '', ), - 'amp-imgur' => array( + 'amp-imgur' => array( '', ), - 'amp-install-serviceworker' => array( + 'amp-install-serviceworker' => array( '', ), - 'amp-izlesene' => array( + 'amp-izlesene' => array( '', ), - 'amp-nexxtv-player' => array( + 'amp-nexxtv-player' => array( '', ), - 'amp-position-observer' => array( + 'amp-position-observer' => array( '', ), - 'amp-twitter' => array( + 'amp-twitter' => array( '', ), - 'amp-user-notification' => array( + 'amp-user-notification' => array( 'This site uses cookies to personalize content.I accept', 'This site uses cookies to personalize content.I accept', ), - 'amp-video' => array( + 'amp-video' => array( '', ), - 'amp-vk' => array( + 'amp-vk' => array( '', ), - 'amp-apester-media' => array( + 'amp-apester-media' => array( '', '', ), - 'button' => array( + 'button' => array( '', '', ), - 'brid-player' => array( + 'brid-player' => array( '', '', ), - 'brightcove' => array( + 'brightcove' => array( '', '', ), - 'carousel' => array( + 'carousel' => array( '
hello world
hello world
', '
hello world
hello world
', ), - 'amp-dailymotion' => array( + 'amp-dailymotion' => array( '

Default (responsive)

Custom

', '

Default (responsive)

Custom

', ), - 'doubleclick-1' => array( + 'doubleclick-1' => array( '', '', ), - 'facebook' => array( + 'facebook' => array( '

More Posts

', '

More Posts

', ), - 'font' => array( + 'font' => array( '', '', ), - 'form' => array( + 'form' => array( '
', '
', ), - 'gfycat' => array( + 'gfycat' => array( '', '', ), - 'h2' => array( + 'h2' => array( '

Example Text

', ), - 'empty_element' => array( + 'empty_element' => array( '
', ), - 'merge_two_attr_specs' => array( + 'merge_two_attr_specs' => array( '
Whatever
', '
Whatever
', ), - 'attribute_value_blacklisted_by_regex_removed' => array( + 'attribute_value_blacklisted_by_regex_removed' => array( 'Click me.', 'Click me.', ), - 'host_relative_url_allowed' => array( + 'host_relative_url_allowed' => array( 'Click me.', ), - 'protocol_relative_url_allowed' => array( + 'protocol_relative_url_allowed' => array( 'Click me.', ), - 'node_with_whiteilsted_protocol_http_allowed' => array( + 'node_with_whiteilsted_protocol_http_allowed' => array( 'Click me.', ), - 'node_with_whiteilsted_protocol_https_allowed' => array( + 'node_with_whiteilsted_protocol_https_allowed' => array( 'Click me.', ), - 'node_with_whiteilsted_protocol_fb-messenger_allowed' => array( + 'node_with_whiteilsted_protocol_fb-messenger_allowed' => array( 'Click me.', ), - 'attribute_value_valid' => array( + 'attribute_value_valid' => array( '', ), - 'attribute_value_invalid' => array( + 'attribute_value_invalid' => array( // type is mandatory, so the node is removed. '', '', ), - 'attribute_amp_accordion_value' => array( + 'attribute_amp_accordion_value' => array( 'test', ), - 'attribute_value_with_blacklisted_regex_removed' => array( + 'attribute_value_with_blacklisted_regex_removed' => array( 'Click me.', 'Click me.', ), @@ -262,235 +262,235 @@ public function get_data() { 'Click me.', ), - 'attribute_value_with_required_regex' => array( + 'attribute_value_with_required_regex' => array( 'Click me.', ), - 'attribute_value_with_disallowed_required_regex_removed' => array( + 'attribute_value_with_disallowed_required_regex_removed' => array( 'Click me.', 'Click me.', ), - 'attribute_value_with_required_value_casei_lower' => array( + 'attribute_value_with_required_value_casei_lower' => array( 'Click.me.', ), - 'attribute_value_with_required_value_casei_upper' => array( + 'attribute_value_with_required_value_casei_upper' => array( 'Click.me.', ), - 'attribute_value_with_required_value_casei_mixed' => array( + 'attribute_value_with_required_value_casei_mixed' => array( 'Click.me.', ), - 'attribute_value_with_bad_value_casei_removed' => array( + 'attribute_value_with_bad_value_casei_removed' => array( 'Click.me.', 'Click.me.', ), - 'attribute_value_with_value_regex_casei_lower' => array( + 'attribute_value_with_value_regex_casei_lower' => array( '', ), - 'attribute_value_with_value_regex_casei_upper' => array( + 'attribute_value_with_value_regex_casei_upper' => array( '', ), - 'attribute_value_with_bad_value_regex_casei_removed' => array( + 'attribute_value_with_bad_value_regex_casei_removed' => array( // data-ui-logo should be true|false. '', '', ), - 'attribute_bad_attr_with_no_value_removed' => array( + 'attribute_bad_attr_with_no_value_removed' => array( 'something here', 'something here', ), - 'attribute_bad_attr_with_value_removed' => array( + 'attribute_bad_attr_with_value_removed' => array( 'something here', 'something here', ), - 'remove_node_with_invalid_mandatory_attribute' => array( + 'remove_node_with_invalid_mandatory_attribute' => array( // script only allows application/json, nothing else. '', '', ), - 'allow_node_with_valid_mandatory_attribute' => array( + 'allow_node_with_valid_mandatory_attribute' => array( '', ), - 'nodes_with_non_whitelisted_tags_replaced_by_children' => array( + 'nodes_with_non_whitelisted_tags_replaced_by_children' => array( 'this is some text inside the invalid node', 'this is some text inside the invalid node', ), - 'empty_parent_nodes_of_non_whitelisted_tags_removed' => array( + 'empty_parent_nodes_of_non_whitelisted_tags_removed' => array( '
', '', ), - 'replace_non_whitelisted_node_with_children' => array( + 'replace_non_whitelisted_node_with_children' => array( '

This is some text with a disallowed tag in the middle of it.

', '

This is some text with a disallowed tag in the middle of it.

', ), - 'remove_attribute_on_node_with_missing_mandatory_parent' => array( + 'remove_attribute_on_node_with_missing_mandatory_parent' => array( '
This is a test.
', '
This is a test.
', ), - 'leave_attribute_on_node_with_present_mandatory_parent' => array( + 'leave_attribute_on_node_with_present_mandatory_parent' => array( '
This is a test.
', '
This is a test.
', ), - 'disallowed_empty_attr_removed' => array( + 'disallowed_empty_attr_removed' => array( '', '', ), - 'allowed_empty_attr' => array( + 'allowed_empty_attr' => array( '', ), - 'remove_node_with_disallowed_ancestor' => array( + 'remove_node_with_disallowed_ancestor' => array( 'The sidebarThis node is not allowed here.', 'The sidebar', ), - 'remove_node_without_mandatory_ancestor' => array( + 'remove_node_without_mandatory_ancestor' => array( '
All I have is this div, when all you want is a noscript tag.
', '
All I have is this div, when all you want is a noscript tag.
', ), - 'amp-img_with_good_protocols' => array( + 'amp-img_with_good_protocols' => array( '', ), - 'allowed_tag_only' => array( + 'allowed_tag_only' => array( '

Text

', '

Text

', ), - 'disallowed_attributes' => array( + 'disallowed_attributes' => array( 'Link', 'Link', ), - 'onclick_attribute' => array( + 'onclick_attribute' => array( 'Link', 'Link', ), - 'on_attribute' => array( + 'on_attribute' => array( '', ), - 'multiple_disallowed_attributes' => array( + 'multiple_disallowed_attributes' => array( 'Link', 'Link', ), - 'attribute_recursive' => array( + 'attribute_recursive' => array( '', '', ), - 'no_strip_amp_tags' => array( + 'no_strip_amp_tags' => array( '', ), - 'a_with_attachment_rel' => array( + 'a_with_attachment_rel' => array( 'Link', ), - 'a_with_attachment_rel_plus_another_valid_value' => array( + 'a_with_attachment_rel_plus_another_valid_value' => array( 'Link', ), - 'a_with_rev' => array( + 'a_with_rev' => array( 'Link', ), - 'a_with_target_blank' => array( + 'a_with_target_blank' => array( 'Link', ), - 'a_with_target_uppercase_blank' => array( + 'a_with_target_uppercase_blank' => array( 'Link', 'Link', ), - 'a_with_target_new' => array( + 'a_with_target_new' => array( 'Link', 'Link', ), - 'a_with_target_self' => array( + 'a_with_target_self' => array( 'Link', ), - 'a_with_target_invalid' => array( + 'a_with_target_invalid' => array( 'Link', 'Link', ), - 'a_with_href_invalid' => array( + 'a_with_href_invalid' => array( 'Link', ), - 'a_with_href_scheme_tel' => array( + 'a_with_href_scheme_tel' => array( 'Call Me, Maybe', ), - 'a_with_href_scheme_sms' => array( + 'a_with_href_scheme_sms' => array( 'SMS Me, Maybe', ), - 'a_with_href_scheme_mailto' => array( + 'a_with_href_scheme_mailto' => array( 'Email Me, Maybe', ), - 'a_with_href_relative' => array( + 'a_with_href_relative' => array( 'Home', ), - 'a_with_anchor' => array( + 'a_with_anchor' => array( 'Home', ), - 'a_is_anchor' => array( + 'a_is_anchor' => array( '', ), - 'a_is_achor_with_id' => array( + 'a_is_achor_with_id' => array( '', ), - 'a_empty' => array( + 'a_empty' => array( 'Hello World', ), - 'a_empty_with_children_with_restricted_attributes' => array( + 'a_empty_with_children_with_restricted_attributes' => array( 'Red&Orange', 'Red&Orange', ), - 'h1_with_size' => array( + 'h1_with_size' => array( '

Headline

', '

Headline

', ), - 'font' => array( + 'font' => array( 'Headline', 'Headline', ), // font is removed so we should check that other elements are checked as well. - 'font_with_other_bad_elements' => array( + 'font_with_other_bad_elements' => array( 'HeadlineSpan', 'HeadlineSpan', ), @@ -538,7 +538,7 @@ public function test_is_missing_mandatory_attribute() { */ public function test_sanitizer( $source, $expected = null ) { $expected = isset( $expected ) ? $expected : $source; - $dom = AMP_DOM_Utils::get_dom_from_content( $source ); + $dom = AMP_DOM_Utils::get_dom_from_content( $source ); $sanitizer = new AMP_Tag_And_Attribute_Sanitizer( $dom ); $sanitizer->sanitize(); $content = AMP_DOM_Utils::get_content_from_dom( $dom ); From 7f9a2dbc0bb8c5b6247fae0cdf9f094e5f018a2d Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Thu, 7 Dec 2017 04:53:14 -0600 Subject: [PATCH 12/25] 804 : Change the conditional to simply compare to true. Before, there was a failed Travis build. This used boolval(), which caused a fatal error. Instead, simply compare the value to true. --- includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php index df19e789d2c..1c1f4012c9b 100644 --- a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php +++ b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php @@ -171,7 +171,7 @@ public function is_missing_mandatory_attribute( $attr_spec, $node ) { return false; } foreach ( $attr_spec as $attr_name => $attr_spec_rule_value ) { - $is_mandatory = isset( $attr_spec_rule_value[ AMP_Rule_Spec::MANDATORY ] ) ? boolval( $attr_spec_rule_value[ AMP_Rule_Spec::MANDATORY ] ) : false; + $is_mandatory = isset( $attr_spec_rule_value[ AMP_Rule_Spec::MANDATORY ] ) ? ( true === $attr_spec_rule_value[ AMP_Rule_Spec::MANDATORY ] ) : false; $attribute_exists = method_exists( $node, 'hasAttribute' ) && $node->hasAttribute( $attr_name ); if ( $is_mandatory && ! $attribute_exists ) { return true; From b4bfd81fa27c3d0141e2031bc4723297d0317d33 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Thu, 7 Dec 2017 05:02:05 -0600 Subject: [PATCH 13/25] 804 : Array and equal sign alignment fixes. In response to a failed Travis build. Fix an error in an array not being aligned. An move an = sign 2 spaces to the left. --- tests/test-tag-and-attribute-sanitizer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test-tag-and-attribute-sanitizer.php b/tests/test-tag-and-attribute-sanitizer.php index 8b93ec74960..ebb7eefaf74 100644 --- a/tests/test-tag-and-attribute-sanitizer.php +++ b/tests/test-tag-and-attribute-sanitizer.php @@ -15,7 +15,7 @@ public function get_data() { '' ), - 'a-test' => array( + 'a-test' => array( 'Show Image', 'Show Image' ), @@ -541,7 +541,7 @@ public function test_sanitizer( $source, $expected = null ) { $dom = AMP_DOM_Utils::get_dom_from_content( $source ); $sanitizer = new AMP_Tag_And_Attribute_Sanitizer( $dom ); $sanitizer->sanitize(); - $content = AMP_DOM_Utils::get_content_from_dom( $dom ); + $content = AMP_DOM_Utils::get_content_from_dom( $dom ); $this->assertEquals( $expected, $content ); } } From 6f5e39d8d532e635253e17f3d074316a458c04ce Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Thu, 7 Dec 2017 05:23:42 -0600 Subject: [PATCH 14/25] 804 : Prevent accessing an object as an array. There was an error in the Travis build. A function accessed a DOMElement property as an array. Instead, use the setAttribute() method. --- .../sanitizers/class-amp-tag-and-attribute-sanitizer.php | 3 +-- tests/test-tag-and-attribute-sanitizer.php | 6 +----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php index 1c1f4012c9b..cf9f6731b8d 100644 --- a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php +++ b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php @@ -449,8 +449,7 @@ private function _sanitize_disallowed_attribute_values_in_node( $node, $attr_spe foreach ( $attrs_to_remove as $attr_name ) { if ( isset( $attr_spec_list[$attr_name][AMP_Rule_Spec::ALLOW_EMPTY] ) && ( true == $attr_spec_list[$attr_name][AMP_Rule_Spec::ALLOW_EMPTY] ) ) { - $attr = $node->attributes; - $attr[ $attr_name ]->value = ''; + $node->setAttribute( $attr_name, '' ); } else { $node->removeAttribute( $attr_name ); } diff --git a/tests/test-tag-and-attribute-sanitizer.php b/tests/test-tag-and-attribute-sanitizer.php index ebb7eefaf74..8ee26eff6d9 100644 --- a/tests/test-tag-and-attribute-sanitizer.php +++ b/tests/test-tag-and-attribute-sanitizer.php @@ -12,27 +12,23 @@ public function get_data() { return array( 'empty_doc' => array( '', - '' + '', ), 'a-test' => array( 'Show Image', - 'Show Image' ), 'a4a' => array( '
', - '
', ), 'ads' => array( '
', - '
', ), 'adsense' => array( '
', - '
', ), 'amp-3q-player' => array( From 2b1443ed25e42e22877d9f6c47d7b633fb14680c Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 7 Dec 2017 19:48:41 -0800 Subject: [PATCH 15/25] Suppress DoubleError phpcs errors in test-tag-and-attribute-sanitizer.php --- phpcs.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/phpcs.xml b/phpcs.xml index d876d0f9546..adec7708da6 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -11,6 +11,13 @@ + + tests/test-tag-and-attribute-sanitizer.php + + + tests/test-tag-and-attribute-sanitizer.php + + . From c73f92baec11f52a868eb31e77211a0f0b7d28a0 Mon Sep 17 00:00:00 2001 From: ThierryA Date: Fri, 8 Dec 2017 17:08:13 +0100 Subject: [PATCH 16/25] [WIP] AMP HTML bash updater draft --- .gitignore | 1 + bin/amphtml-fix.diff | 221 +++++++++++++++++++++ bin/{amp_wp_build.py => amphtml-update.py} | 0 bin/amphtml-update.sh | 40 ++++ 4 files changed, 262 insertions(+) create mode 100644 bin/amphtml-fix.diff rename bin/{amp_wp_build.py => amphtml-update.py} (100%) create mode 100644 bin/amphtml-update.sh diff --git a/.gitignore b/.gitignore index e43b0f98895..b2a69e9a03c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .DS_Store +vendor diff --git a/bin/amphtml-fix.diff b/bin/amphtml-fix.diff new file mode 100644 index 00000000000..05bfb2ceba9 --- /dev/null +++ b/bin/amphtml-fix.diff @@ -0,0 +1,221 @@ +diff --git a/validator/validator_gen_md.py b/validator/validator_gen_md.py +new file mode 100644 +index 000000000..80909fd4c +--- /dev/null ++++ b/validator/validator_gen_md.py +@@ -0,0 +1,215 @@ ++# ++# Copyright 2015 The AMP HTML Authors. All Rights Reserved. ++# ++# Licensed under the Apache License, Version 2.0 (the "License"); ++# you may not use this file except in compliance with the License. ++# You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS-IS" BASIS, ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++# See the License for the specific language governing permissions and ++# limitations under the license. ++# ++"""Generates validator-generated.md""" ++ ++import os ++ ++ ++def GenerateValidatorGeneratedMd(specfile, validator_pb2, text_format, out): ++ """Main method for the markdown generator. ++ ++ This method reads the specfile and emits Markdown to sys.stdout. ++ ++ Args: ++ specfile: Path to validator.protoascii. ++ validator_pb2: The proto2 Python module generated from validator.proto. ++ text_format: The text_format module from the protobuf package, e.g. ++ google.protobuf.text_format. ++ out: a list of lines to output (without the newline characters), to ++ which this function will append. ++ """ ++ out.append('' % ++ os.path.basename(__file__)) ++ out.append( ++ '') ++ out.append('') ++ out.append('[Accelerated Mobile Pages Project](https://www.ampproject.org)') ++ out.append('') ++ ++ out.append('# validator.protoascii') ++ out.append('') ++ ++ rules = validator_pb2.ValidatorRules() ++ text_format.Merge(open(specfile).read(), rules) ++ if rules.HasField('spec_file_revision'): ++ out.append('* spec file revision: %d' % rules.spec_file_revision) ++ if rules.HasField('min_validator_revision_required'): ++ out.append('* minimum validator revision required: %d' % ++ rules.min_validator_revision_required) ++ out.append('') ++ out.append('Allowed Tags') ++ out.append('') ++ out.append('[TOC]') ++ out.append('') ++ for (field_desc, field_val) in rules.ListFields(): ++ if field_desc.name == 'tags': ++ for tag_spec in field_val: ++ PrintTagSpec(validator_pb2, tag_spec, out) ++ ++ ++def GetLayout(validator_pb2, layout_index): ++ """Helper function that returns the AmpLayout.Layout name for a given index. ++ ++ See amp.validator.AmpLayout.Layout in validator.proto for details. ++ ++ Args: ++ validator_pb2: The proto2 Python module generated from validator.proto. ++ layout_index: integer representing a particular AmpLayout.Layout ++ Returns: ++ A string which represents the name for this supported layout. ++ """ ++ amp_layout = validator_pb2.DESCRIPTOR.message_types_by_name['AmpLayout'] ++ layouts = amp_layout.fields_by_name['supported_layouts'].enum_type.values ++ return layouts[layout_index].name ++ ++ ++def PrintAmpLayout(validator_pb2, amp_layout, out): ++ """Prints a Markdown version of the given proto message (AmpLayout). ++ ++ See amp.validator.AmpLayout in validator.proto for details of proto message. ++ ++ Args: ++ validator_pb2: The proto2 Python module generated from validator.proto. ++ amp_layout: The AmpLayout message. ++ out: A list of lines to output (without newline characters), to which this ++ function will append. ++ """ ++ for layout in amp_layout.supported_layouts: ++ out.append('* %s' % UnicodeEscape(GetLayout(validator_pb2, layout))) ++ if amp_layout.defines_default_width: ++ out.append('* Defines Default Width') ++ if amp_layout.defines_default_height: ++ out.append('* Defines Default Height') ++ ++ ++def PrintAttrSpec(attr_spec, out): ++ """Prints a Markdown version of the given proto message (AttrSpec). ++ ++ See amp.validator.AttrSpec in validator.proto for details of proto message. ++ ++ Args: ++ attr_spec: The AttrSpec message. ++ out: A list of lines to output (without newline characters), to which this ++ function will append. ++ """ ++ out.append('* %s' % UnicodeEscape(attr_spec.name)) ++ if attr_spec.alternative_names: ++ out.append(' * Alternative Names: %s' % ++ RepeatedFieldToString(attr_spec.alternative_names)) ++ if attr_spec.mandatory: ++ out.append(' * Mandatory') ++ if attr_spec.mandatory_oneof: ++ out.append(' * Mandatory One of: %s' % attr_spec.mandatory_oneof) ++ if attr_spec.value: ++ out.append(' * Required Value: %s' % attr_spec.value) ++ ++ ++def PrintTagSpec(validator_pb2, tag_spec, out): ++ """Prints a Markdown version of the given proto message (TagSpec). ++ ++ See amp.validator.TagSpec in validator.proto for details of proto message. ++ ++ Args: ++ validator_pb2: The proto2 Python module generated from validator.proto. ++ tag_spec: The TagSpec message. ++ out: A list of lines to output (without newline characters), to which this ++ function will append. ++ """ ++ header = '## %s' % UnicodeEscape(tag_spec.tag_name) ++ if tag_spec.spec_name and (tag_spec.tag_name != tag_spec.spec_name): ++ header += ': %s' % UnicodeEscape(tag_spec.spec_name) ++ if tag_spec.deprecation: ++ header += ' (DEPRECATED)' ++ header += '{#%s_%s}' % (UnicodeEscape(tag_spec.tag_name).replace(' ', '_'), ++ UnicodeEscape(tag_spec.spec_name).replace(' ', '_')) ++ out.append('') ++ out.append(header) ++ out.append('') ++ if tag_spec.deprecation: ++ out.append('This is deprecated.') ++ out.append('Please see [%s](%s)' % ++ (UnicodeEscape(tag_spec.deprecation), tag_spec.deprecation_url)) ++ out.append('') ++ if tag_spec.mandatory: ++ out.append('* Mandatory') ++ if tag_spec.mandatory_alternatives: ++ out.append('* Mandatory Alternatives: %s' % ++ UnicodeEscape(tag_spec.mandatory_alternatives)) ++ if tag_spec.unique: ++ out.append('* Unique') ++ if tag_spec.mandatory_parent: ++ out.append('* Mandatory Parent: %s' % ++ UnicodeEscape(tag_spec.mandatory_parent)) ++ if tag_spec.mandatory_ancestor: ++ out.append('* Mandatory Ancestor: %s' % ++ UnicodeEscape(tag_spec.mandatory_ancestor)) ++ if tag_spec.mandatory_ancestor_suggested_alternative: ++ out.append('* Mandatory Ancestor Alternative: %s' % ++ UnicodeEscape(tag_spec.mandatory_ancestor_suggested_alternative)) ++ if tag_spec.disallowed_ancestor: ++ out.append('* Disallowed Ancestor: %s' % ++ RepeatedFieldToString(tag_spec.disallowed_ancestor)) ++ if tag_spec.attrs: ++ out.append('') ++ out.append('Allowed Attributes:') ++ out.append('') ++ for attr_spec in tag_spec.attrs: ++ PrintAttrSpec(attr_spec, out) ++ if (tag_spec.amp_layout.supported_layouts or ++ tag_spec.amp_layout.defines_default_width or ++ tag_spec.amp_layout.defines_default_height): ++ out.append('') ++ out.append('Allowed Layouts:') ++ out.append('') ++ PrintAmpLayout(validator_pb2, tag_spec.amp_layout, out) ++ if tag_spec.spec_url: ++ out.append('') ++ out.append('[Spec](%s)' % tag_spec.spec_url) ++ out.append('') ++ ++ ++def RepeatedFieldToString(field): ++ """Helper function which converts a list into an escaped string. ++ ++ Args: ++ field: A list of strings. ++ Returns: ++ A string, segmented by commas. ++ """ ++ return ', '.join([UnicodeEscape(s) for s in field]) ++ ++ ++def UnderscoreToTitleCase(under_score): ++ """Helper function which converts under_score names to TitleCase. ++ ++ Args: ++ under_score: A name, segmented by under_scores. ++ Returns: ++ A name, segmented as TitleCase. ++ """ ++ segments = under_score.split('_') ++ return ' '.join([s.title() for s in segments]) ++ ++ ++def UnicodeEscape(string): ++ """Helper function which escapes unicode characters. ++ ++ Args: ++ string: A string which may contain unicode characters. ++ Returns: ++ An escaped string. ++ """ ++ return ('' + string).encode('unicode-escape') diff --git a/bin/amp_wp_build.py b/bin/amphtml-update.py similarity index 100% rename from bin/amp_wp_build.py rename to bin/amphtml-update.py diff --git a/bin/amphtml-update.sh b/bin/amphtml-update.sh new file mode 100644 index 00000000000..ac694434017 --- /dev/null +++ b/bin/amphtml-update.sh @@ -0,0 +1,40 @@ +#!/bin/bash +set -e + +# Go to the right location. +if [[ '.' != $(dirname "$0") ]]; then + cd bin +fi + +BIN_PATH="$(pwd)" +PROJECT_PATH=$(dirname $PWD) +VENDOR_PATH=$PROJECT_PATH/vendor + +# Create and go to vendor. +if [[ ! -e $VENDOR_PATH ]]; then + mkdir $VENDOR_PATH +fi +cd $VENDOR_PATH + +# Clone amphtml repo. +if [[ ! -e $VENDOR_PATH/amphtml ]]; then + git clone https://github.com/ampproject/amphtml amphtml +fi + +# Copy script to location and go there. +cp $BIN_PATH/amphtml-update.py $VENDOR_PATH/amphtml/validator +cd $VENDOR_PATH/amphtml/validator + +# Temporary fix until https://github.com/ampproject/amphtml/issues/12371 is addressed. +if [ ! -f $VENDOR_PATH/amphtml/validator/validator_gen_md.py ]; then + git apply $BIN_PATH/amphtml-fix.diff +fi + +# Install dependencies. +sudo apt-get install python +sudo apt-get install protobuf-compiler +sudo apt-get install python-protobuf + +# Run script. +python amphtml-update.py +cp amp_wp/class-amp-allowed-tags-generated.php ../../../includes/sanitizers/ From f67041d0d7821b7412745b8617701820e9574ad6 Mon Sep 17 00:00:00 2001 From: ThierryA Date: Fri, 8 Dec 2017 17:20:16 +0100 Subject: [PATCH 17/25] [WIP] AMP HTML bash updater improvements --- bin/amphtml-update.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bin/amphtml-update.sh b/bin/amphtml-update.sh index ac694434017..e8097cc436a 100644 --- a/bin/amphtml-update.sh +++ b/bin/amphtml-update.sh @@ -10,6 +10,17 @@ BIN_PATH="$(pwd)" PROJECT_PATH=$(dirname $PWD) VENDOR_PATH=$PROJECT_PATH/vendor +if ! apt-get > /dev/null; then + echo -e "The AMP HTML uses the apt-get, make sure to run this script in a Linux environment" + exit +fi + +# Install dependencies. +sudo apt-get install git +sudo apt-get install python +sudo apt-get install protobuf-compiler +sudo apt-get install python-protobuf + # Create and go to vendor. if [[ ! -e $VENDOR_PATH ]]; then mkdir $VENDOR_PATH @@ -30,11 +41,6 @@ if [ ! -f $VENDOR_PATH/amphtml/validator/validator_gen_md.py ]; then git apply $BIN_PATH/amphtml-fix.diff fi -# Install dependencies. -sudo apt-get install python -sudo apt-get install protobuf-compiler -sudo apt-get install python-protobuf - # Run script. python amphtml-update.py cp amp_wp/class-amp-allowed-tags-generated.php ../../../includes/sanitizers/ From 236968b5e6383c6011dd551e66e682d8db62819c Mon Sep 17 00:00:00 2001 From: ThierryA Date: Fri, 8 Dec 2017 18:21:52 +0100 Subject: [PATCH 18/25] Wrap up AMP HTML bash updater --- bin/amphtml-update.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/bin/amphtml-update.sh b/bin/amphtml-update.sh index e8097cc436a..6ee8b2c66fd 100644 --- a/bin/amphtml-update.sh +++ b/bin/amphtml-update.sh @@ -2,24 +2,19 @@ set -e # Go to the right location. -if [[ '.' != $(dirname "$0") ]]; then - cd bin -fi +cd "$(dirname "$0")" BIN_PATH="$(pwd)" PROJECT_PATH=$(dirname $PWD) VENDOR_PATH=$PROJECT_PATH/vendor -if ! apt-get > /dev/null; then - echo -e "The AMP HTML uses the apt-get, make sure to run this script in a Linux environment" - exit +if ! command -v apt-get >/dev/null 2>&1; then + echo "The AMP HTML uses apt-get, make sure to run this script in a Linux environment" + exit 1 fi # Install dependencies. -sudo apt-get install git -sudo apt-get install python -sudo apt-get install protobuf-compiler -sudo apt-get install python-protobuf +sudo apt-get install git python protobuf-compiler python-protobuf # Create and go to vendor. if [[ ! -e $VENDOR_PATH ]]; then @@ -30,6 +25,9 @@ cd $VENDOR_PATH # Clone amphtml repo. if [[ ! -e $VENDOR_PATH/amphtml ]]; then git clone https://github.com/ampproject/amphtml amphtml +else + cd $VENDOR_PATH/amphtml/validator + git pull fi # Copy script to location and go there. From eab6207eccc7d1089d05c6b3af4c524bf235d292 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Fri, 8 Dec 2017 19:08:48 -0600 Subject: [PATCH 19/25] 804 : Add a contributing.md file, with steps to use build script. This describes how to use the new script amphtml-update.sh. This is mainly modified from another open-source file. It could probably use more information. Including the workflow for submitting pull requests. --- contributing.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 contributing.md diff --git a/contributing.md b/contributing.md new file mode 100644 index 00000000000..712ab93161f --- /dev/null +++ b/contributing.md @@ -0,0 +1,30 @@ +# AMP Contributing Guide + +To clone this repository +``` bash +$ git clone --recursive git@github.com:Automattic/amp-wp.git +``` + +### Updating Allowed Tags And Attributes + +The file `class-amp-allowed-tags-generated.php` has the AMP specification's allowed tags and attributes. It's used in sanitization. +To update that file: +1. `cd` to the root of this plugin +2. run `bash bin/amphtml-update.sh` +That script is intended for a Linux environment like [VVV](https://github.com/Varying-Vagrant-Vagrants/VVV). + +### PHPUnit Testing + +Run tests: + +``` bash +$ phpunit +``` + +Run tests with an HTML coverage report: + +``` bash +$ phpunit --coverage-html /tmp/report +``` + +When you push a commit to your PR, Travis CI will run the PHPUnit tests and sniffs against the WordPress Coding Standards. From eef4b8b5142b54fbb418e706e267f9253b75c851 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sat, 9 Dec 2017 11:47:56 -0600 Subject: [PATCH 20/25] 804 : Test that 'amp-playbuzz' is sanitized properly. As harrisdavid mentioned, before this PR, the 'src' was mandatory. But with the updated AMP spec, it's not. --- tests/test-tag-and-attribute-sanitizer.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test-tag-and-attribute-sanitizer.php b/tests/test-tag-and-attribute-sanitizer.php index 8ee26eff6d9..986e1da8192 100644 --- a/tests/test-tag-and-attribute-sanitizer.php +++ b/tests/test-tag-and-attribute-sanitizer.php @@ -120,6 +120,14 @@ public function get_data() { '', ), + 'amp-playbuzz' => array( + '', + ), + + 'amp-playbuzz_no_src' => array( + '', + ), + 'amp-position-observer' => array( '', ), From ae92a5838ce2951a253bd2d0c47d065ed4c47bcb Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Sat, 9 Dec 2017 15:52:53 -0600 Subject: [PATCH 21/25] 804 : Add allowed protocols to sanitization file. Before, there was an issue in the file that created: class-amp-allowed-tags-generated.php. amphtml-update.sh had a conditional: if isinstance(value, list) But the allowed_protocol attribute has a type of: google.protobuf.internal.containers.RepeatedScalarFieldContainer So that conditional failed. And allowed_protocol wasn't added. So instead, make that an 'else' statement. That change only resulted in 'allowed_tags' being added. --- bin/amphtml-update.py | 2 +- .../class-amp-allowed-tags-generated.php | 285 +++++++++++++++++- tests/test-tag-and-attribute-sanitizer.php | 9 + 3 files changed, 292 insertions(+), 4 deletions(-) diff --git a/bin/amphtml-update.py b/bin/amphtml-update.py index 37d5611ec57..780ba3faf3b 100644 --- a/bin/amphtml-update.py +++ b/bin/amphtml-update.py @@ -282,7 +282,7 @@ def GenerateValuesPHP(out, values, indent_level = 6): if isinstance(value, (str, bool)): out.append('%s\'%s\' => \'%s\',' % (indent, key.lower(), value)) - if isinstance(value, list): + else: out.append('%s\'%s\' => array(' % (indent, key.lower())) sorted_value = sorted(value) for v in sorted_value: diff --git a/includes/sanitizers/class-amp-allowed-tags-generated.php b/includes/sanitizers/class-amp-allowed-tags-generated.php index 19c7e6c3658..f14c46ca135 100644 --- a/includes/sanitizers/class-amp-allowed-tags-generated.php +++ b/includes/sanitizers/class-amp-allowed-tags-generated.php @@ -25,6 +25,25 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'allow_empty' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'bbmi', + 'fb-messenger', + 'ftp', + 'http', + 'https', + 'intent', + 'line', + 'mailto', + 'skype', + 'sms', + 'snapchat', + 'tel', + 'tg', + 'threema', + 'twitter', + 'viber', + 'whatsapp', + ), ), 'hreflang' => array(), 'media' => array(), @@ -123,6 +142,9 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'type' => array( 'mandatory' => true, @@ -153,6 +175,9 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'type' => array( 'mandatory' => true, @@ -202,6 +227,9 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'allow_empty' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'type' => array(), ), @@ -232,6 +260,11 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'data', + 'http', + 'https', + ), ), ), 'tag_spec' => array( @@ -333,6 +366,9 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), ), 'tag_spec' => array( @@ -370,6 +406,9 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), ), 'tag_spec' => array( @@ -402,6 +441,9 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), ), 'tag_spec' => array( @@ -503,6 +545,9 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, + 'allowed_protocol' => array( + 'https', + ), ), 'media' => array(), 'noloading' => array( @@ -607,6 +652,9 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'type' => array( 'mandatory' => true, @@ -638,6 +686,9 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'type' => array( 'mandatory' => true, @@ -717,6 +768,10 @@ class AMP_Allowed_Tags_Generated { 'data-href' => array( 'mandatory' => true, 'allow_relative' => false, + 'allowed_protocol' => array( + 'http', + 'https', + ), ), 'media' => array(), 'noloading' => array( @@ -910,6 +965,10 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'data', + 'https', + ), ), 'srcdoc' => array(), ), @@ -927,10 +986,16 @@ class AMP_Allowed_Tags_Generated { 'data-src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'data-tag' => array( 'mandatory' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'media' => array(), 'noloading' => array( @@ -984,6 +1049,11 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'data', + 'http', + 'https', + ), ), ), 'tag_spec' => array( @@ -1041,11 +1111,17 @@ class AMP_Allowed_Tags_Generated { 'data-iframe-src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), ), 'tag_spec' => array( @@ -1171,6 +1247,9 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'template' => array(), ), @@ -1222,6 +1301,10 @@ class AMP_Allowed_Tags_Generated { ), 'data-origin' => array( 'allow_empty' => true, + 'allowed_protocol' => array( + 'http', + 'https', + ), ), 'data-seek-to' => array(), 'data-streamtype' => array( @@ -1322,6 +1405,9 @@ class AMP_Allowed_Tags_Generated { 'mandatory' => true, 'allow_empty' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), ), 'tag_spec' => array( @@ -1493,6 +1579,24 @@ class AMP_Allowed_Tags_Generated { 'data-share-endpoint' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => false, + 'allowed_protocol' => array( + 'bbmi', + 'fb-messenger', + 'ftp', + 'http', + 'https', + 'intent', + 'line', + 'mailto', + 'skype', + 'sms', + 'snapchat', + 'tel', + 'tg', + 'threema', + 'viber', + 'whatsapp', + ), ), 'media' => array(), 'noloading' => array( @@ -1590,6 +1694,9 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), ), 'tag_spec' => array( @@ -1625,8 +1732,18 @@ class AMP_Allowed_Tags_Generated { 'amp-story' => array( array( 'attr_spec_list' => array( - 'background-audio' => array(), - 'bookend-config-src' => array(), + 'background-audio' => array( + 'allowed_protocol' => array( + 'http', + 'https', + ), + ), + 'bookend-config-src' => array( + 'allowed_protocol' => array( + 'http', + 'https', + ), + ), 'standalone' => array( 'mandatory' => true, 'value' => '', @@ -1662,7 +1779,12 @@ class AMP_Allowed_Tags_Generated { array( 'attr_spec_list' => array( 'auto-advance-after' => array(), - 'background-audio' => array(), + 'background-audio' => array( + 'allowed_protocol' => array( + 'http', + 'https', + ), + ), 'id' => array( 'mandatory' => true, ), @@ -1726,10 +1848,16 @@ class AMP_Allowed_Tags_Generated { 'data-dismiss-href' => array( 'allow_empty' => false, 'allow_relative' => false, + 'allowed_protocol' => array( + 'https', + ), ), 'data-show-if-href' => array( 'allow_empty' => false, 'allow_relative' => false, + 'allowed_protocol' => array( + 'https', + ), ), 'enctype' => array( 'value' => 'application/x-www-form-urlencoded', @@ -1796,6 +1924,9 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), ), 'tag_spec' => array( @@ -1860,6 +1991,9 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), ), 'tag_spec' => array( @@ -1938,6 +2072,9 @@ class AMP_Allowed_Tags_Generated { 'helper-iframe-url' => array( 'mandatory' => true, 'allow_relative' => false, + 'allowed_protocol' => array( + 'https', + ), ), 'id' => array( 'mandatory' => true, @@ -1950,10 +2087,16 @@ class AMP_Allowed_Tags_Generated { 'permission-dialog-url' => array( 'mandatory' => true, 'allow_relative' => false, + 'allowed_protocol' => array( + 'https', + ), ), 'service-worker-url' => array( 'mandatory' => true, 'allow_relative' => false, + 'allowed_protocol' => array( + 'https', + ), ), ), 'tag_spec' => array( @@ -2032,6 +2175,10 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => false, + 'allowed_protocol' => array( + 'data', + 'https', + ), ), ), 'tag_spec' => array( @@ -2087,6 +2234,10 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'allow_empty' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'http', + 'https', + ), ), ), 'tag_spec' => array(), @@ -2502,6 +2653,10 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'allow_empty' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'http', + 'https', + ), ), 'datetime' => array(), ), @@ -3379,6 +3534,10 @@ class AMP_Allowed_Tags_Generated { ), 'allow_empty' => false, 'allow_relative' => true, + 'allowed_protocol' => array( + 'http', + 'https', + ), ), 'xlink:role' => array(), 'xlink:show' => array(), @@ -3508,10 +3667,16 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'action-xhr' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'autocomplete' => array(), 'custom-validation-reporting' => array( @@ -3530,6 +3695,9 @@ class AMP_Allowed_Tags_Generated { 'verify-xhr' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), ), 'tag_spec' => array( @@ -3552,6 +3720,9 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'autocomplete' => array(), 'custom-validation-reporting' => array( @@ -3571,6 +3742,9 @@ class AMP_Allowed_Tags_Generated { 'verify-xhr' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), ), 'tag_spec' => array( @@ -3843,6 +4017,10 @@ class AMP_Allowed_Tags_Generated { ), 'allow_empty' => false, 'allow_relative' => true, + 'allowed_protocol' => array( + 'http', + 'https', + ), ), 'xlink:role' => array(), 'xlink:show' => array(), @@ -3997,6 +4175,10 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => false, + 'allowed_protocol' => array( + 'data', + 'https', + ), ), 'srcdoc' => array(), 'width' => array(), @@ -4096,6 +4278,11 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '(^|\\s)data:image\\/svg\\+xml', 'allow_empty' => false, 'allow_relative' => true, + 'allowed_protocol' => array( + 'data', + 'http', + 'https', + ), ), 'xlink:role' => array(), 'xlink:show' => array(), @@ -4128,6 +4315,10 @@ class AMP_Allowed_Tags_Generated { 'longdesc' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'http', + 'https', + ), ), 'src' => array( 'alternative_names' => array( @@ -4136,6 +4327,10 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'data', + 'https', + ), ), 'width' => array(), ), @@ -4221,6 +4416,10 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'allow_empty' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'http', + 'https', + ), ), 'datetime' => array(), ), @@ -4436,6 +4635,10 @@ class AMP_Allowed_Tags_Generated { ), 'allow_empty' => false, 'allow_relative' => true, + 'allowed_protocol' => array( + 'http', + 'https', + ), ), 'xlink:role' => array(), 'xlink:show' => array(), @@ -4790,6 +4993,12 @@ class AMP_Allowed_Tags_Generated { 'attr_spec_list' => array( 'content' => array( 'mandatory' => true, + 'chrome' => array( + 'value', + ), + 'ie' => array( + 'value', + ), ), 'http-equiv' => array( 'mandatory' => true, @@ -5365,6 +5574,10 @@ class AMP_Allowed_Tags_Generated { ), 'allow_empty' => false, 'allow_relative' => true, + 'allowed_protocol' => array( + 'http', + 'https', + ), ), 'xlink:role' => array(), 'xlink:show' => array(), @@ -5589,6 +5802,10 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'allow_empty' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'http', + 'https', + ), ), ), 'tag_spec' => array(), @@ -5679,6 +5896,10 @@ class AMP_Allowed_Tags_Generated { ), 'allow_empty' => false, 'allow_relative' => true, + 'allowed_protocol' => array( + 'http', + 'https', + ), ), 'xlink:role' => array(), 'xlink:show' => array(), @@ -7329,6 +7550,9 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'type' => array(), ), @@ -7351,6 +7575,9 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'type' => array(), ), @@ -7372,6 +7599,9 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'type' => array( 'mandatory' => true, @@ -7395,6 +7625,9 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'type' => array( 'mandatory' => true, @@ -7419,6 +7652,9 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => true, + 'allowed_protocol' => array( + 'https', + ), ), 'type' => array(), ), @@ -8104,6 +8340,10 @@ class AMP_Allowed_Tags_Generated { ), 'allow_empty' => false, 'allow_relative' => true, + 'allowed_protocol' => array( + 'http', + 'https', + ), ), 'xlink:role' => array(), 'xlink:show' => array(), @@ -8223,6 +8463,9 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, + 'allowed_protocol' => array( + 'https', + ), ), 'srclang' => array(), ), @@ -8250,6 +8493,9 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, + 'allowed_protocol' => array( + 'https', + ), ), 'srclang' => array( 'mandatory' => true, @@ -8278,6 +8524,9 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, + 'allowed_protocol' => array( + 'https', + ), ), 'srclang' => array(), ), @@ -8305,6 +8554,9 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, + 'allowed_protocol' => array( + 'https', + ), ), 'srclang' => array( 'mandatory' => true, @@ -8336,6 +8588,9 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, + 'allowed_protocol' => array( + 'https', + ), ), 'srclang' => array(), ), @@ -8366,6 +8621,9 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, + 'allowed_protocol' => array( + 'https', + ), ), 'srclang' => array( 'mandatory' => true, @@ -8397,6 +8655,9 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, + 'allowed_protocol' => array( + 'https', + ), ), 'srclang' => array(), ), @@ -8427,6 +8688,9 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, + 'allowed_protocol' => array( + 'https', + ), ), 'srclang' => array( 'mandatory' => true, @@ -8459,6 +8723,9 @@ class AMP_Allowed_Tags_Generated { 'blacklisted_value_regex' => '__amp_source_origin', 'mandatory' => true, 'allow_relative' => false, + 'allowed_protocol' => array( + 'https', + ), ), 'srclang' => array( 'mandatory' => true, @@ -8554,6 +8821,10 @@ class AMP_Allowed_Tags_Generated { ), 'allow_empty' => false, 'allow_relative' => true, + 'allowed_protocol' => array( + 'http', + 'https', + ), ), 'xlink:role' => array(), 'xlink:show' => array(), @@ -8775,6 +9046,10 @@ class AMP_Allowed_Tags_Generated { ), 'allow_empty' => false, 'allow_relative' => true, + 'allowed_protocol' => array( + 'http', + 'https', + ), ), 'xlink:role' => array(), 'xlink:show' => array(), @@ -8818,6 +9093,10 @@ class AMP_Allowed_Tags_Generated { 'src' => array( 'blacklisted_value_regex' => '__amp_source_origin', 'allow_relative' => false, + 'allowed_protocol' => array( + 'data', + 'https', + ), ), 'width' => array(), ), diff --git a/tests/test-tag-and-attribute-sanitizer.php b/tests/test-tag-and-attribute-sanitizer.php index 986e1da8192..77d544e5654 100644 --- a/tests/test-tag-and-attribute-sanitizer.php +++ b/tests/test-tag-and-attribute-sanitizer.php @@ -95,6 +95,15 @@ public function get_data() { '', ), + 'amp-iframe' => array( + '' + ), + + 'amp-iframe_incorrect_protocol' => array( + '', + '', + ), + 'amp-ima-video' => array( '', ), From 4597be57a46cd0be7d3941bfb35dc7321622a05f Mon Sep 17 00:00:00 2001 From: ThierryA Date: Mon, 11 Dec 2017 10:15:10 +0100 Subject: [PATCH 22/25] Fix WPCS warning --- tests/test-tag-and-attribute-sanitizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-tag-and-attribute-sanitizer.php b/tests/test-tag-and-attribute-sanitizer.php index 77d544e5654..d844fef1e68 100644 --- a/tests/test-tag-and-attribute-sanitizer.php +++ b/tests/test-tag-and-attribute-sanitizer.php @@ -96,7 +96,7 @@ public function get_data() { ), 'amp-iframe' => array( - '' + '', ), 'amp-iframe_incorrect_protocol' => array( From 44554c543dedffa6c2bf5fa2cb3307c62a6029b8 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 11 Dec 2017 14:15:38 -0600 Subject: [PATCH 23/25] 804 : Add to contributing.md, including unit test information. Add a point that this requires WP unit tests. Also, begin with the welcome that Thierry suggested. Props @ThierryA. --- contributing.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contributing.md b/contributing.md index 712ab93161f..42a970837ef 100644 --- a/contributing.md +++ b/contributing.md @@ -1,5 +1,7 @@ # AMP Contributing Guide +Thanks for taking the time to contribute! + To clone this repository ``` bash $ git clone --recursive git@github.com:Automattic/amp-wp.git @@ -15,6 +17,8 @@ That script is intended for a Linux environment like [VVV](https://github.com/Va ### PHPUnit Testing +Please run these tests in an environment with WordPress unit tests installed, like [VVV](https://github.com/Varying-Vagrant-Vagrants/VVV). + Run tests: ``` bash From 4b3ec53705f644913a92a243b90fa745145d7f9d Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 11 Dec 2017 20:03:33 -0600 Subject: [PATCH 24/25] 804 : Correct PHPUnit test for ', + '', ), 'nodes_with_non_whitelisted_tags_replaced_by_children' => array( From af7b8304e9745a057c6cd810cd5f052914216689 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Mon, 11 Dec 2017 20:37:26 -0600 Subject: [PATCH 25/25] 804 : Add spaces to correct PHPCS errors. In response to a failed Travis build. Also, change == to ===. --- includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php index d17e40f07fb..88f9cfceb8c 100644 --- a/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php +++ b/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php @@ -603,8 +603,8 @@ private function delegated_sanitize_disallowed_attribute_values_in_node( $node, // Remove the disallowed values. foreach ( $attrs_to_remove as $attr_name ) { - if ( isset( $attr_spec_list[$attr_name][AMP_Rule_Spec::ALLOW_EMPTY] ) && - ( true == $attr_spec_list[$attr_name][AMP_Rule_Spec::ALLOW_EMPTY] ) ) { + if ( isset( $attr_spec_list[ $attr_name ][ AMP_Rule_Spec::ALLOW_EMPTY ] ) && + ( true === $attr_spec_list[ $attr_name ][ AMP_Rule_Spec::ALLOW_EMPTY ] ) ) { $node->setAttribute( $attr_name, '' ); } else { $node->removeAttribute( $attr_name );