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.

HTMLParser should ignore not native HTML attributes

See original GitHub issue

Attributes not native to HTML (such in vue or react & attributes with non completly string values) should be ignored by HTMLParser completly instead giving back as classes.

<input :checked="isCheckbox ? value : undefined" />
<div class={isRead ? "red": "green"} />

running with following,

const parser = new HTMLParser(text);
const classes = parser.parseClasses();

will give back the classes

isCheckbox ? value : undefined
isRead ? "red": "green"

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
alexanderniebuhrcommented, Apr 5, 2021

const parser = new HTMLParser(text);

1reaction
antfucommented, Apr 1, 2021

Yes, that’s exactly what I mean 😛. We can have a block list and add more as we go.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why was strict parsing not chosen for HTML?
The HTML parser will ignore tags which it does not understand, and will ignore attributes which it does not understand of CERN-SGML tags....
Read more >
Strip HTML from strings in Python - Stack Overflow
When printing a line in an HTML file, I'm trying to find a way to only show the contents of each HTML element...
Read more >
Parsing HTML: a guide to select the right library
Parsing HTML. The goal of this article is helping you to find the right library to process HTML: we consider Java, C#, Python,...
Read more >
HTML 5.2: 8. The HTML syntax - W3C
Attribute names must consist of one or more characters other than the space characters, U+0000 NULL, U+0022 QUOTATION MARK ("), U+0027 ...
Read more >
htmlparser2 - npm
htmlparser2 is the fastest HTML parser, and takes some shortcuts to ... Closing tags without corresponding * opening tags will be ignored.
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