HTML Templates JavaScript polyfills

后端 未结 4 1731
北荒
北荒 2020-12-31 03:03

I\'m looking for the most standards-compliant / future-proof method for front-end HTML templating.

There exists a relatively new W3C draft specification for HTML Tem

4条回答
  •  梦谈多话
    2020-12-31 03:06

    There is a jsfiddle that demonstrates such a polyfill.

    
    
    
    
    
    

    This is regular old content.

    /* POLYFILL */ (function templatePolyfill(d) { if('content' in d.createElement('template')) { return false; } var qPlates = d.getElementsByTagName('template'), plateLen = qPlates.length, elPlate, qContent, contentLen, docContent; for(var x=0; x

    As for libraries, and I don't know that they support it yet, but try something like Modernizr and Initializr

提交回复
热议问题