Skip to content

Handling of "<" in html #5679

Open
Open

Description

@vicb

#5657 allows "<" in text nodes so that <p>{{ a < b ? c : d }}</p> does not throw.

However this is not valid html - < would have to be &lt; to have a valid html.

One potential issue with the current approach is that in <p>{{ a <b && c > d }}</p> <b && c > would be parsed as an html tag and would not be easy for user to debug.

We could solve this by making the lexer aware of angular expression.

/cc @tbosch

edit {{ "<b>text</b>" }} could also cause pb

Activity

  1. vicb commented on Dec 8, 2015

    @vicb
    ContributorAuthor
  2. added
    featureLabel used to distinguish feature request from other issues
    on Oct 7, 2016
  3. DzmitryShylovich commented on Dec 11, 2016

    @DzmitryShylovich
    Contributor

    @vicb is this still an issue? Can't reproduce https://plnkr.co/edit/zJ2QPw7sTHw5wcl4Nc3h?p=preview

  4. vicb commented on Feb 8, 2017

    @vicb
    ContributorAuthor

    Yep it is still an issue and should not be closed

  5. DzmitryShylovich commented on Feb 8, 2017

    @DzmitryShylovich
    Contributor
  6. vicb commented on Feb 9, 2017

    @vicb
    ContributorAuthor

    Some failing forms are listed in the original report.

  7. added this to the Backlog milestone on Jan 23, 2018
  8. splincode commented on Jul 26, 2018

    @splincode
    Contributor

    @vicb Is the issue relevant?

  9. removed
    area: coreIssues related to the framework runtime
    on May 13, 2021
  10. 9 remaining items

  11. AndrewKushnir commented on Jun 22, 2021

    @AndrewKushnir
    Contributor

    Discussed offline, PR #42605 does not resolve this issue, so I'm reopening this ticket.

  12. added and removed
    featureLabel used to distinguish feature request from other issues
    on Jun 30, 2021
  13. modified the milestones: Backlog, needsTriage on Jun 30, 2021
  14. alxhub commented on Jun 30, 2021

    @alxhub
    Member

    Converting this to a bug, as this is fundamentally a problem with Angular's two-stage template parsing.

  15. added
    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
    on Jul 1, 2021
  16. modified the milestones: needsTriage, Backlog on Jul 1, 2021
  17. Yogu commented on Aug 29, 2023

    @Yogu
    Contributor

    I guess with #48535 (Self-closing component tags) merged, and especially with built-in control flow coming, this probably no longer considered to be a bug? (Angular templates no longer being HTML in general)

    oops sorry for the noise, I misunderstood this issue. The issue is not that an HTML parser would not be able to parse an Angular template, but that Angular itself cannot parse it.

    Here is a StackBlitz with a reproduction of the issue

    Works: {{ "<" + "b>text<" + "/b>" | json }}
        
    Does not work: {{ "<b>text</b>" | json }}
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: compilerIssues related to `ngc`, Angular's template compilercompiler: parsertype: bug/fix

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions