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

Validator rollup #6391

Merged
merged 5 commits into from
Nov 29, 2016
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ tags: { # <amp-accordion>
tag_name: "AMP-ACCORDION"
also_requires_tag: "amp-accordion extension .js script"
attrs: { name: "animate" value: "" }
attrs: { name: "disable-session-states" value: "" }
child_tags: {
child_tag_name_oneof: "SECTION"
}
Expand Down
13 changes: 10 additions & 3 deletions validator/engine/htmlparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ class TagNameStack {
if (this.handler_.markManufacturedBody)
this.handler_.markManufacturedBody();
this.startTag('BODY', []);
} else {
this.region_ = TagRegion.IN_BODY;
}
}
break;
Expand Down Expand Up @@ -836,8 +838,9 @@ amp.htmlparser.HtmlParser.HEX_ESCAPE_RE_ = /^#x([0-9A-Fa-f]+)$/;
* @private
*/
amp.htmlparser.HtmlParser.INSIDE_TAG_TOKEN_ = new RegExp(
// Don't capture space.
'^\\s*(?:' +
// Don't capture space. In this case, we don't use \s because it includes a
// nonbreaking space which gets included as an attribute in our validation.
'^[ \\t\\n\\f\\r\\v]*(?:' +
// Capture an attribute name in group 1, and value in group 3.
// We capture the fact that there was an attribute in group 2, since
// interpreters are inconsistent in whether a group that matches nothing
Expand Down Expand Up @@ -889,7 +892,11 @@ amp.htmlparser.HtmlParser.OUTSIDE_TAG_TOKEN_ = new RegExp(
// Comments not captured.
'|<[!]--[\\s\\S]*?(?:-->|$)' +
// '/' captured in group 2 for close tags, and name captured in group 3.
'|<(/)?([a-z!\\?][a-z0-9_:-]*)' +
// The first character of a tag (after possibly '/') can be A-Z, a-z,
// '!' or '?'. The remaining characters are more easily expressed as a
// negative set of: '\0', ' ', '\n', '\r', '\t', '\f', '\v', '>', or
// '/'.
'|<(/)?([a-z!\\?][^\\0 \\n\\r\\t\\f\\v>/]*)' +
// Text captured in group 4.
'|([^<&>]+)' +
// Cruft captured in group 5.
Expand Down
4 changes: 1 addition & 3 deletions validator/engine/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4890,9 +4890,7 @@ amp.validator.validateSaxEvents = function(saxEvents, htmlFormat) {
for (const e of saxEvents) {
switch (e[0]) {
case 'startTag':
e.shift();
const tagName = e.shift();
handler.startTag(tagName, e);
handler.startTag(/*tagName=*/e[1], e.slice(2));
break;
case 'endTag':
handler.endTag(e[1]);
Expand Down
2 changes: 1 addition & 1 deletion validator/validator-main.protoascii
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ min_validator_revision_required: 189
# newer versions of the spec file. This is currently a Google internal
# mechanism, validator.js does not use this facility. However, any
# change to this file (validator-main.js) requires updating this revision id.
spec_file_revision: 315
spec_file_revision: 316

# Validator extensions.
# =====================
Expand Down