File: dom.js

package info (click to toggle)
node-react 17.0.1%2Bdfsg%2B~cs106.58.5-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 23,976 kB
  • sloc: javascript: 280,795; cpp: 1,326; sh: 84; makefile: 27
file content (27 lines) | stat: -rw-r--r-- 592 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var UID = +new Date();

exports.uniqueID = function(){
	return (UID++).toString(36);
};
	
var NS = 'http://www.w3.org/2000/svg',
	XLINK = 'http://www.w3.org/1999/xlink',
	XML = 'http://www.w3.org/XML/1998/namespace';

exports.NS = NS;

exports.createElement = function(tag){
    return document.createElementNS(NS, tag);
};

exports.link = function(element, url){
	element.setAttributeNS(XLINK, 'href', url);
};

exports.preserveSpace = function(element){
	element.setAttributeNS(XML, 'space', 'preserve');
};

exports.createTextNode = function(text){
	return document.createTextNode(text);
}