什么是HTML5 template模板標簽?
光陰似箭催人老,日月如移越少年。
You can read this chrome bloghttp://blog.chromium.org/2013/02/chro...
The template tag is first a tag<template></template>
As the name suggests, this is a template. For example, if ajax is needed to refresh a list, the previous method was to generate html returns on the back end, or add it after the front end is built with DOM. But now with the template tag, the html structure does not need to be managed by the program. You only need to add ajax at a specific location. Just request the requested data, such as img's src or other text, then clone the DOM and add it to the list.
In fact, many people should have done similar things before, hiding a piece of HTML, then cloning it and modifying the attributes or content inside, getting a DOM, adding it to the list and displaying it, to refresh the ajax list.
I found two English resources today, and I can only understand them roughly.
http://html5-demos.appspot.com/static...
https://dvcs.w3.org/hg/webcomponents/...
Because there are various problems with HTML and CSS, modularization cannot be expanded,
So W3C has a Draft about Web Components, which is the link above. <template>
tag, Shadow DOM, scoped CSS, custom tags, and Object.observe
are all born for this,
The purpose is to realize the front-end modularization plan...<template>
As the name suggests, it is a front-end template. The scripts and images inside will not be executed until they are used.
Chrome’s news seems to have just been updated, I’m not sure how strong the browser support is,
Anyway, I am looking forward to modularity
I figured it out myself, that is to say, HTML5 has many tags to help structure web pages, which can save many p HTML5 Boilerplates (HTML 5 templates) in web pages
http://html5doctor.com/html-5-boilerp...