question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EOF error when using svg:title tag in component template

See original GitHub issue

🐞 Bug report

Command

- [ ] new
- [X] build
- [X] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 7.x.x

Description

Using the svg title tag in a different component (using the namespace like svg:title) than the svg root tag component will cause a template parse error. (using title inside a component with svg root tag works fine) This is working fine:

<!-- demo.component.ts -->
<svg>
    <g>
        <rect x="10" y="10" width="50" height="50">
            <title>I'm a title tag</title>
        </rect>
    </g>
</svg>

While this isn’t working:

<!-- demo.component.ts -->
<svg>
    <g svg-title-test></g>
</svg>

<!-- svg-title-test.component.ts -->
<svg:rect x="10" y="10" width="50" height="50">
    <!-- Commenting this line out will show the rect -->
    <svg:title>I'm a title tag</svg:title>
</svg:rect>

🔬 Minimal Reproduction

  1. Creating a new angular app (ng new)
  2. Creating a component with a svg root tag inside
  3. Creating a component with a rect and a title inside the rect (using namespace prefix svg:rect and svg:title)

I’ve prepared a working example of this issue on stackblitz: https://stackblitz.com/edit/angular-rqi6k5

🔥 Exception or Error



Error in
node_modules/@angular/compiler@8.0.0/bundles/compiler.umd.js (2479:21)
Template parse errors:
Unexpected character "EOF" ("ommenting this line out will show the rect -->
<svg:title>I'm a title tag</svg:title>
</svg:rect>[ERROR ->]"): ng:///AppModule/SvgTitleTestComponent.html@3:11

🌍 Your Environment


Angular CLI: 8.0.1
Node: 10.15.3
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.800.1
@angular-devkit/core         8.0.1
@angular-devkit/schematics   8.0.1
@schematics/angular          8.0.1
@schematics/update           0.800.1
rxjs                         6.4.0

Anything else relevant?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
alexzuzacommented, Jul 11, 2019

Angular tokenizer takes into account only tagName when trying to get the type of a token.

https://github.com/angular/angular/blob/304a12f0271a08c447c1d1c12fa7dd99baf1f983/packages/compiler/src/ml_parser/lexer.ts#L511

The title tag has predefined mapping

https://github.com/angular/angular/blob/018477e2c4a31de69554c377ed25ba291636050a/packages/compiler/src/ml_parser/html_tags.ts#L104

So for svg:title we get TagContentType.ESCAPABLE_RAW_TEXT while it should be TagContentType.PARSABLE_DATA

1reaction
mgechevcommented, Jul 11, 2019

Seems like this issue belongs to the angular/angular monorepo // cc @alan-agius4

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular 2 Template parse errors unexpected character EOF
This error is fixed by closing a tag which is missing its closing tag. Sometimes, like in my case of <textarea> , this...
Read more >
<title> — the SVG accessible name element - MDN Web Docs
The element provides an accessible, short-text description of any SVG container element or graphics element.
Read more >
HTML 5.2: 8. The HTML syntax - W3C
HTML elements all have names that only use alphanumeric ASCII characters. In the HTML syntax, tag names, even those for foreign elements, ...
Read more >
Fix list for IBM WebSphere Application Server V8.5
PH43573, WebSphere Application Server 8.5.5.20 may use a default cipher list ... exception java.io.eofexception: unexpected end of zlib input stream error.
Read more >
Changelog - Sphinx documentation
jquery extension, which has been developed by the Sphinx team and contributors. To use this, add sphinxcontrib.jquery to the extensions list in conf.py...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found