Project

General

Profile

« Previous | Next » 

Revision 826b4fd8

Added by koszko about 2 years ago

start using `' tag

View differences:

html/DOM_helpers.js
10 10
    return document.getElementById(id);
11 11
}
12 12

  
13
const known_templates = new Map();
14

  
15
function get_template(template_id)
16
{
17
    let template = known_templates.get(template_id) || null;
18
    if (template)
19
	return template;
20

  
21
    for (const template_node of document.getElementsByTagName("TEMPLATE")) {
22
	template = template_node.content.getElementById(template_id);
23
	if (template)
24
	    break;
25
    }
26

  
27
    known_templates.set(template_id, template);
28
    return template;
29
}
30

  
13 31
function clone_template(template_id)
14 32
{
15
    const clone = document.getElementById(template_id).cloneNode(true);
33
    const clone = get_template(template_id).cloneNode(true);
16 34
    const result_object = {};
17 35
    const to_process = [clone];
18 36

  
......
36 54
/*
37 55
 * EXPORTS_START
38 56
 * EXPORT by_id
57
 * EXPORT get_template
39 58
 * EXPORT clone_template
40 59
 * EXPORTS_END
41 60
 */

Also available in: Unified diff