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

Components with with names of native elements throw compilation error #18530

Closed
Exelord opened this issue Oct 29, 2019 · 6 comments · Fixed by #18714
Closed

Components with with names of native elements throw compilation error #18530

Exelord opened this issue Oct 29, 2019 · 6 comments · Fixed by #18714

Comments

@Exelord
Copy link
Contributor

Exelord commented Oct 29, 2019

Creating components with names of some native elements like Script, Title etc results with an error :
Unclosed element `Title` - glimmer-engine
when using them as a block:

<Title>
  It is closed
</Title>

Is it expected behavior?

Tested in Ember 3.13

Copy link
Member

rwjblue commented Oct 30, 2019

Creating components with names of self-closing native elements like Script, Title

Not sure what you mean here. Script and title both require closing tags (e.g. are not “self closing”).

Is it expected behavior?

Hmm, no I don’t think this is expected. Is it limited to title/script/noscript/style though? Does (for example) <Span>Foo</Span> have an issue?

@Exelord
Copy link
Contributor Author

Exelord commented Oct 30, 2019

Not sure what you mean here. Script and title both require closing tags (e.g. are not “self closing”).
My mistake sorry

Hmm, no I don’t think this is expected. Is it limited to title/script/noscript/style though? Does (for example) Foo have an issue?

Not all of them. Im not sure about Span but Div works fine.

also you can use title as <Title />. It just doesn't work as block.

@rwjblue
Copy link
Member

rwjblue commented Nov 1, 2019

I suspect the issue is with the changes from tildeio/simple-html-tokenizer#69. Since (in the spec) element tag names are case insensitive, this patch does tagName.toLowerCase() to normalize. Unfortunately, this means that we treat <Title> and <Style> the exact same way that we treat <title> and <style>.

In addition, that PR lowercases the tag name and looks for a closing tag that is also lowercase (IOW it will match <Title> but not match </Title>). I think this is the reason for the specific error you see here.

@rwjblue
Copy link
Member

rwjblue commented Nov 1, 2019

The fix is most likely to fix that PR over in simple-html-tokenizer to specifically only look for the lowercase variants (removing that .toLowerCase() call).

@rwjblue
Copy link
Member

rwjblue commented Nov 1, 2019

@CvX - Do you think you might have any time to poke at this? To confirm my suspicion and/or send in a patch?

@dcyriller
Copy link
Contributor

@rwjblue I gave it at try here: tildeio/simple-html-tokenizer#81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants