Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 template not working on Internet Explorer, how to solve it?

I made a template in HTML5 which is working with Chrome and Firefox but not working with Internet Explorer (tested on IE 8).

How can I solve this problem?

like image 919
knotty Avatar asked Mar 06 '14 11:03

knotty


2 Answers

You can hide the element using CSS: template { display:none !important; }

And if you need to access/clone the content like natively possible in other browsers, use this polyfill: https://github.com/jeffcarp/template-polyfill

But keep in mind the content of the <template> can still be found in the DOM and is executed - preventing exactly that is the main goal of the tag. No polyfill can stop that from happening, IE is once again slowing down modern web development.

like image 65
Fabian von Ellerts Avatar answered Nov 19 '22 11:11

Fabian von Ellerts


just add "display:none" to your templates. Works for i.e. 11

<template id="fancyTemplate" style="display:none"></template>
like image 39
roof01 Avatar answered Nov 19 '22 11:11

roof01