Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Allow <script> templates to be referenced by id. #26747

Merged
merged 1 commit into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
262 changes: 258 additions & 4 deletions extensions/amp-mustache/validator-amp-mustache.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,132 @@ tags: {
disallowed_ancestor: "FORM DIV [submitting][template]"
disallowed_ancestor: "FORM DIV [verify-error][template]"
requires_extension: "amp-mustache"
attrs: {
name: "id"
add_value_to_set: TEMPLATE_IDS
# When updating this blacklisted_value_regex, also update elsewhere in this
# file, and in mandatory-id-attr and $GLOBAL_ATTRS in
# validator-main.protoascii, and validator-amp-script.protoascii.
blacklisted_value_regex: "(^|\\s)(" # Values are space separated
"__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|$)"
}
attrs: {
name: "type"
mandatory: true
Expand Down Expand Up @@ -114,6 +240,132 @@ tags: {
# AMP4EMAIL addition.
disallowed_ancestor: "FORM DIV [submitting]"
requires_extension: "amp-mustache"
attrs: {
name: "id"
add_value_to_set: TEMPLATE_IDS
# When updating this blacklisted_value_regex, also update elsewhere in this
# file, and in mandatory-id-attr and $GLOBAL_ATTRS in
# validator-main.protoascii, and validator-amp-script.protoascii.
blacklisted_value_regex: "(^|\\s)(" # Values are space separated
"__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|$)"
}
attrs: {
name: "type"
mandatory: true
Expand Down Expand Up @@ -156,8 +408,9 @@ tags: {
attrs: {
name: "id"
add_value_to_set: TEMPLATE_IDS
# When updating this blacklisted_value_regex, also update below, and in
# mandatory-id-attr and $GLOBAL_ATTRS in validator-main.protoascii.
# When updating this blacklisted_value_regex, also update elsewhere in this
# file, and in mandatory-id-attr and $GLOBAL_ATTRS in
# validator-main.protoascii, and validator-amp-script.protoascii.
blacklisted_value_regex: "(^|\\s)(" # Values are space separated
"__amp_\\S*|"
"__count__|"
Expand Down Expand Up @@ -308,8 +561,9 @@ tags: {
attrs: {
name: "id"
add_value_to_set: TEMPLATE_IDS
# When updating this blacklisted_value_regex, also update above, and in
# mandatory-id-attr and $GLOBAL_ATTRS in validator-main.protoascii.
# When updating this blacklisted_value_regex, also update elsewhere in this
# file, and in mandatory-id-attr and $GLOBAL_ATTRS in
# validator-main.protoascii, and validator-amp-script.protoascii.
blacklisted_value_regex: "(^|\\s)(" # Values are space separated
"__amp_\\S*|"
"__count__|"
Expand Down
3 changes: 3 additions & 0 deletions extensions/amp-script/validator-amp-script.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ tags: { # <amp-script> (local script)
name: "id"
add_value_to_set: AMP_SCRIPT_IDS
mandatory: true
# When updating this blacklisted_value_regex, also update for
# mandatory-id-attr and $GLOBAL_ATTRS in validator-main.protoascii, and
# validator-amp-mustache.protoascii.
blacklisted_value_regex: "(^|\\s)(" # Values are space separated
"__amp_\\S*|"
"__count__|"
Expand Down
6 changes: 4 additions & 2 deletions validator/validator-main.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -5485,7 +5485,8 @@ attr_lists: {
name: "id"
mandatory: true
# When updating this blacklisted_value_regex, also update the entry for
# "id" in $GLOBAL_ATTRS and "id" in "amp-script extension local script".
# "id" in $GLOBAL_ATTRS, and also validator-amp-script.protoascii and
# validator-amp-mustache.protoascii.
blacklisted_value_regex: "(^|\\s)(" # Values are space separated
"__amp_\\S*|"
"__count__|"
Expand Down Expand Up @@ -6517,7 +6518,8 @@ attr_lists: {
attrs: {
name: "id"
# When updating this blacklisted_value_regex, also update for
# mandatory-id-attr and validator-amp-mustache.protoascii.
# mandatory-id-attr, validator-amp-script.protoascii, and
# validator-amp-mustache.protoascii.
blacklisted_value_regex: "(^|\\s)(" # Values are space separated
"__amp_\\S*|"
"__count__|"
Expand Down