Leon Atherton Leon is a developer at IDRsolutions and product manager for BuildVu. He is responsible for managing the BuildVu product strategy and roadmap, and also spends a lot of his time writing code to build new features, improve functionality, fix bugs, and improve the testing for BuildVu.

Why canvas is not a self closing HTML5 tag

39 sec read

While debugging a page produced by our PDF to HTML5 Converter, I noticed that Firefox was showing some of the tags in the HTML source in red.

Specifically, there was a closing div tag.

 

The solution I thought was quite obvious – there must be no opening div tag for it to close.
But scrolling up, indeed there was a div tag for it to close.

The problem itself was actually in the line above – the canvas tag.

The line used was <canvas id=”pdf15″ width=”1053″ height=”813″ >. Although our canvas tag has nothing inside it because of the way that the canvas works, that doesn’t mean that we are allowed to self close it like we would an </canvas>.

The reason that canvas tag requires a separate closing tag is because it’s actually possible to put content inside that will display instead of the canvas if the user’s browser does not support HTML5.

 

Problem solved!

This post is part of our “HTML5 Article index” in these articles, we aim to help you understand the world of HTML5.

IDRsolutions develop a Java PDF Viewer and SDK, an Adobe forms to HTML5 forms converter, a PDF to HTML5 converter and a Java ImageIO replacement. On the blog our team post anything interesting they learn about.

Leon Atherton Leon is a developer at IDRsolutions and product manager for BuildVu. He is responsible for managing the BuildVu product strategy and roadmap, and also spends a lot of his time writing code to build new features, improve functionality, fix bugs, and improve the testing for BuildVu.

Converting your PDF files to HTML5 with BuildVu 

Recently we announced our updated product range for 2018 and are rebranding some existing products, like JPDF2HTML5 which has been renamed to BuildVu. It...
Georgia Ingham
2 min read

Favourite resources from our HTML development team

As the web progresses and grows, so do the technologies that come along with it. Trying to keep on top of everything you need...
Ovidijus Okinskas
1 min read

How HTML5 Javadocs in Java 9 will make your…

Here at IDRsolutions we are very excited about Java 9 and have written a series of articles explaining some of the main features. In...
Rob
1 min read

Leave a Reply

Your email address will not be published. Required fields are marked *