Skip to content

Small refactor for template parser #4613

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

Merged
merged 3 commits into from
Jan 2, 2017
Merged

Small refactor for template parser #4613

merged 3 commits into from
Jan 2, 2017

Conversation

defcc
Copy link
Member

@defcc defcc commented Dec 30, 2016

  1. Remove the unnecessary argument of parseEndTag.
  2. Store the lowerCasedTag in the stack and use it directly.
  3. Remove isSpecialTag logic for simplification.

As for isSpecialTag logic, the original implementation checks the tagName and its attribute. If it's a template with lang attribute, it will skip to parse the content inside the template. I think maybe we could simplify it, because the template element is guaranteed by the SFC parser.

const hasLang = attr => attr.name === 'lang' && attr.value !== 'html'

For this line, is it an edge case? There is no proper test case about it, I am not very sure.

Please let me know if anything I missed.

@yyx990803
Copy link
Member

Ah cool. For the template tag, the special check was introduced here, but it is no longer necessary because we have improved the HTML parser to forgivingly handle < symbols inside templates now.

@yyx990803 yyx990803 merged commit d3768c0 into vuejs:dev Jan 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants