Skip to content

Commit 3b3bfb9

Browse files
committed
Exclude data-ampdevmode attribute exclusion rule
1 parent 48a8a55 commit 3b3bfb9

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

bin/amphtml-update.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,13 @@ def GetAttrs(attrs):
680680

681681
if value_dict is not None:
682682

683+
# Skip rules for dev mode attributes since the AMP plugin will allow them to pass through.
684+
# See <https://github.com/ampproject/amphtml/pull/27174#issuecomment-601391161> for how the rules are
685+
# defined in a way that they can never be satisfied, and thus to make the attribute never allowed.
686+
# This runs contrary to the needs of the AMP plugin, as the internal sanitizers are built to ignore them.
687+
if 'data-ampdevmode' == attr_spec.name:
688+
continue
689+
683690
# Normalize bracketed amp-bind attribute syntax to data-amp-bind-* syntax.
684691
name = attr_spec.name
685692
if name[0] == '[':

includes/sanitizers/class-amp-allowed-tags-generated.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5153,12 +5153,6 @@ class AMP_Allowed_Tags_Generated {
51535153
'amp-script' => array(
51545154
array(
51555155
'attr_spec_list' => array(
5156-
'data-ampdevmode' => array(
5157-
'blacklisted_value_regex' => 'false',
5158-
'value' => array(
5159-
'false',
5160-
),
5161-
),
51625156
'max-age' => array(
51635157
'value_regex' => '[0-9]+',
51645158
),

tests/php/test-tag-and-attribute-sanitizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2143,7 +2143,7 @@ static function() {
21432143

21442144
'amp-script-5' => [
21452145
'
2146-
<amp-script script="myScript" layout="container"></amp-script>
2146+
<amp-script script="myScript" layout="container" data-ampdevmode></amp-script>
21472147
<script type="text/plain" target="amp-script" id="myScript">
21482148
document.body.textContent += \'Hello world!\';
21492149
</script>

0 commit comments

Comments
 (0)