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.

HTMLMinifier will delete <canvas> tags - fix?

See original GitHub issue

<canvas> tag will be erased with HTMLMinifier but it should not! Working e.g. with chart.js needs the <canvas> tag to draw the chart. Is it possible to fix it?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
DanielRufcommented, Feb 3, 2020

Well, there is an option enabled in Formatter which removes empty elements:

https://github.com/bitst0rm-pub/Formatter/blob/27dea0804c73b0d2ef43ed6cc25a98ba0399d41e/config/htmlminifierrc.json#L35

"removeEmptyElements": true,

grafik

So please report this at https://github.com/bitst0rm-pub/Formatter

0reactions
hirschferkelcommented, Feb 4, 2020

Oh you made it! GREAT. With these settings it’s even possible to get Minifyer to keep attributes which contain spaces. Perfect. "removeEmptyAttributes": false,

thus

<div id="htmllegend"></div>
<canvas id="Macro "></canvas>

will get <div id=htmllegend></div><canvas id="Macro "></canvas>

that’s exactly what it should. thanx a lot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing html closing tag & both body tags. #1020 - GitHub
Dropping empty html, head and body tags is by design since they are nominally redundant, and Google encourages their removal in plain HTML5...
Read more >
HTML minifier
Remove tag whitespace Remove space between attributes whenever possible. Note that this will result in invalid HTML! Sort attributes Sort attributes by ...
Read more >
HTMLCanvasElement.toDataURL() - Web APIs | MDN
The HTMLCanvasElement.toDataURL() method returns a data URL containing a representation of the image in the format specified by the type ...
Read more >
html canvas table
The Canvas tag is basically an IMG tag without any data. ... It's very easy to compose, edit, format and minify the web...
Read more >
HTML Paragraphs - W3Schools
The browser will automatically remove any extra spaces and lines when the page ... Use the correct HTML tag to add a paragraph...
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