File: dom.js

package info (click to toggle)
node-react 18.2.0%2Bdfsg%2B~cs87.31.26-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 30,356 kB
  • sloc: javascript: 361,793; cpp: 1,326; sh: 52; makefile: 46
file content (37 lines) | stat: -rw-r--r-- 979 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
28
29
30
31
32
33
34
35
36
37
var VMLCSS = 'behavior:url(#default#VML);display:inline-block;position:absolute;left:0px;top:0px;';

var styleSheet, styledTags = {}, styleTag = function(tag){
	if (styleSheet) styledTags[tag] = styleSheet.addRule('av\\:' + tag, VMLCSS);
};

exports.init = function(document){

	var namespaces;
	try { // IE9 workaround: sometimes it throws here
		namespaces = document.namespaces;
	} catch (e) {
	}
	if (!namespaces) return false;

	namespaces.add('av', 'urn:schemas-microsoft-com:vml');
	namespaces.add('ao', 'urn:schemas-microsoft-com:office:office');

	styleSheet = document.createStyleSheet();
	styleSheet.addRule('vml', 'display:inline-block;position:relative;overflow:hidden;');
/*	styleTag('skew');
	styleTag('fill');
	styleTag('stroke');
	styleTag('path');
	styleTag('textpath');
	styleTag('group');*/

	styleTag('vml');

	return true;

};

exports.createElement = function(tag){
	if (!(tag in styledTags)) styleTag(tag);
	return document.createElement('av:' + tag);
};