MCPcopy Create free account
hub / github.com/VitoHowe/glm-coding / createElement

Function createElement

app/services/tdc_vm_runner.cjs:98–156  ·  view source on GitHub ↗
(tag)

Source from the content-addressed store, hash-verified

96 documentElement: createElementStub({ clientWidth: 1920, clientHeight: 1080 }),
97 body: createElementStub({ clientWidth: 1920, clientHeight: 1080 }),
98 createElement(tag) {
99 const normalized = String(tag).toLowerCase();
100 if (normalized === 'canvas') {
101 return createElementStub({
102 getContext() {
103 return makeNoopProxy({
104 fillRect() {},
105 clearRect() {},
106 getImageData() {
107 return { data: new Uint8ClampedArray(4) };
108 },
109 putImageData() {},
110 createImageData() {
111 return [];
112 },
113 setTransform() {},
114 drawImage() {},
115 save() {},
116 fillText() {},
117 restore() {},
118 beginPath() {},
119 moveTo() {},
120 lineTo() {},
121 closePath() {},
122 stroke() {},
123 translate() {},
124 scale() {},
125 rotate() {},
126 arc() {},
127 fill() {},
128 measureText(text) {
129 return { width: String(text).length * 8 };
130 },
131 transform() {},
132 rect() {},
133 clip() {},
134 });
135 },
136 toDataURL() {
137 return 'data:image/png;base64,AAAA';
138 },
139 width: 300,
140 height: 150,
141 });
142 }
143 if (normalized === 'audio' || normalized === 'video') {
144 return createElementStub({
145 canPlayType() {
146 return 'probably';
147 },
148 });
149 }
150 return createElementStub({
151 tagName: normalized.toUpperCase(),
152 getContext() {
153 return makeNoopProxy({});
154 },
155 });

Callers

nothing calls this directly

Calls 1

createElementStubFunction · 0.85

Tested by

no test coverage detected