MCPcopy Index your code
hub / github.com/angular/angular / DefaultDomRenderer2

Class DefaultDomRenderer2

packages/platform-browser/src/dom/dom_renderer.ts:260–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260class DefaultDomRenderer2 implements Renderer2 {
261 data: {[key: string]: any} = Object.create(null);
262
263 /**
264 * By default this renderer throws when encountering synthetic properties
265 * This can be disabled for example by the AsyncAnimationRendererFactory
266 */
267 throwOnSyntheticProps = true;
268
269 constructor(
270 private readonly eventManager: EventManager,
271 private readonly doc: Document,
272 protected readonly ngZone: NgZone,
273 private readonly tracingService: TracingService<TracingSnapshot> | null,
274 ) {}
275
276 destroy(): void {}
277
278 destroyNode = null;
279
280 createElement(name: string, namespace?: string): any {
281 if (namespace) {
282 // TODO: `|| namespace` was added in
283 // https://github.com/angular/angular/commit/2b9cc8503d48173492c29f5a271b61126104fbdb to
284 // support how Ivy passed around the namespace URI rather than short name at the time. It did
285 // not, however extend the support to other parts of the system (setAttribute, setAttribute,
286 // and the ServerRenderer). We should decide what exactly the semantics for dealing with
287 // namespaces should be and make it consistent.
288 // Related issues:
289 // https://github.com/angular/angular/issues/44028
290 // https://github.com/angular/angular/issues/44883
291 return this.doc.createElementNS(NAMESPACE_URIS[namespace] || namespace, name);
292 }
293
294 return this.doc.createElement(name);
295 }
296
297 createComment(value: string): any {
298 return this.doc.createComment(value);
299 }
300
301 createText(value: string): any {
302 return this.doc.createTextNode(value);
303 }
304
305 appendChild(parent: any, newChild: any): void {
306 const targetParent = isTemplateNode(parent) ? parent.content : parent;
307 targetParent.appendChild(newChild);
308 }
309
310 insertBefore(parent: any, newChild: any, refChild: any): void {
311 if (parent) {
312 const targetParent = isTemplateNode(parent) ? parent.content : parent;
313 targetParent.insertBefore(newChild, refChild);
314 }
315 }
316
317 removeChild(_parent: any, oldChild: any): void {

Callers

nothing calls this directly

Calls 1

createMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…