remy / mit-license

Hosted MIT License with details controlled through this repo

Home Page:mit-license.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creation of article & footer via javascript, is it needed here ?

kcak11 opened this issue · comments

<script>document.createElement('article');document.createElement('footer');</script>

is the creation of article and footer needed via JS here. This seemed to me as unnecessary hence reported.

<script>document.createElement('article');document.createElement('footer');</script>

The created article and footer are nowhere used in the page because as such there is no reference to these. Hence wondering if they actually serve a real purpose.

@remy ??

@kcak11 Thanks for taking the time to write this question! I will do my best to answer it:

Older versions of Internet Explorer do not support the modern HTML5 element names, such as "<article>" and "<footer>". In addition to not recognising them by default, it also does not allow these elements to be styled with CSS.

Luckily, there is a trick you can do with Internet Explorer, which is to create an element with the same name in JavaScript, before it appears in your HTML or CSS. When you do that, the rendering of stylesheet will work without problems. The element created by this JavaScript code is not used, and that is intentional.

This technique is known as the "html5 shim". Look it up if you're interested in learning more!

Thanks @Krinkle, guess I missed that point.