Skip to content
This repository was archived by the owner on Oct 12, 2021. It is now read-only.

design(AppShell): case sensitivity of the App Shell Runtime Parser marker #60

Closed
mgechev opened this issue Jun 13, 2016 · 4 comments
Closed
Assignees

Comments

@mgechev
Copy link
Member

mgechev commented Jun 13, 2016

Using case sensitive attribute names as markers in the generated by the Universal template will not work with the app shell runtime parser. Currently the runtime parser uses parse5 which serializes the HTML AST without keeping the case sensitivity.

Options to proceed:

  • Short term solution is using class name as a marker.
  • For longer term solution consider:
    • Using the Angular template parser for producing the AST.
    • Forking parse5 and introducing case sensitivity, ES2015 modules (allow easier tree-shaking), and payload reduction.
@mgechev mgechev added this to the Iteration Ending 2016-06-25 milestone Jun 13, 2016
@mgechev mgechev self-assigned this Jun 13, 2016
@mgechev
Copy link
Member Author

mgechev commented Jun 15, 2016

Today I did some experiments with the Angular's TemplateParser. Everything seems to work well, even without existing in the schema attributes.

We do not have serializer for the produced AST so we can reuse the one from Parse5, which is not destructive in sense of case sensitivity (and is also quite minimalistic). In order to pass the produced by the TemplateParser AST to the Parse5 serializer we'd have to adapt it.

In recap, as optimal solution at this point I see:

  • Producing an AST with the Angular's TemplateParser.
  • Adapting the AST to fit the shape required by the serializer of parse5.
  • Serializing the AST with parse5.

We'll be able to tree-shake everything (even parse5 with this plugin), and maintain as less code as possible.

@jeffbcross
Copy link
Contributor

We'll be able to tree-shake everything (even parse5 with this plugin), and maintain as less code as possible.

Do you have an idea how small the minified output would be (and how it compares to just using parse5, without case-sensitivity)?

Overall sounds good. I'm wondering what cases might break Angular's TemplateParser. Doesn't it blacklist certain tags, like <script>?

@mgechev
Copy link
Member Author

mgechev commented Jun 24, 2016

Based on the latest in-depth research I did, the best option right now is to slightly modify parse5's lexer runtime. This way we will enable case-sensitive parsing. I opened a PR with the case sensitive run-time parser here #68. Here are some brief notes that I did.

@mgechev
Copy link
Member Author

mgechev commented Jul 4, 2016

Fixed by fb9673a

@mgechev mgechev closed this as completed Jul 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants