question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v13.2.0] Renderer2 createElement method ignores namespace.

See original GitHub issue

Which @angular/* package(s) are the source of the bug?

core, platform-browser

Is this a regression?

Yes

Description

In v13.2.0, Renderer2 creates an element without namespace even if namespace has been specified. It doesn’t failed with error, however further usage of such element becomes unpredictable. For example, the following code tries to create an svg and set position style:

const svg = this._renderer.createElement('svg', 'http://www.w3.org/2000/svg');
this._renderer.appendChild(hostElement, svg);
this._renderer.setStyle(svg, 'position', 'fixed');

The error occurs in the last line, since svg element has been created incorrectly.

After quick investigation, I found that the following line has been changed: https://github.com/angular/angular/blob/13.2.0/packages/platform-browser/src/dom/dom_renderer.ts#L148 image This change was introduced in v13.2.0, it works fine in v13.1.3

As I understood, NAMESPACE_URIS contains namespace shortcuts, but what about specifying “full” namespace or any other namespace that is not in NAMESPACE_URIS?

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

ERROR TypeError: Cannot set properties of undefined (setting 'width')
    at DefaultDomRenderer2.setStyle (platform-browser.mjs:618:13)
    at AnimationRenderer.setStyle (animations.mjs:282:23)

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 13.2.0
Node: 16.13.1
Package Manager: npm 8.1.2
OS: win32 x64

Angular: 13.2.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... elements, forms, language-service, localize, material
... material-moment-adapter, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1302.0
@angular-devkit/build-angular   13.2.0
@angular-devkit/core            13.2.0
@angular-devkit/schematics      13.2.0
@schematics/angular             13.2.0
ng-packagr                      13.2.0
rxjs                            6.6.7
typescript                      4.5.5

Anything else?

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AndrewKushnircommented, Jan 31, 2022

This issue is resolved by #44914 and the change will be available in v13.2.1 release.

0reactions
angular-automatic-lock-bot[bot]commented, Mar 3, 2022

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Renderer2 - Angular
Use a custom renderer to bypass Angular's templating and make custom UI changes that can't ... abstract createElement(name: string, namespace?: string): any ...
Read more >
How do I use Renderer2 to create an element as a child?
I was hoping someone can provide me with an example of how to use Renderer2's createElement method in an attribute-directive.
Read more >
vue-server-renderer | Yarn - Package Manager
This package offers Node.js server-side rendering for Vue 2.0. API Reference · Vue.js Server-Side Rendering Guide. Display full readme ...
Read more >
Pylimph Node V2.0.6 - Khan Academy
<br><br>This method requires a 3D renderer. You need to pass P3D or OPENGL as a third parameter into the <b>size()</b> method as shown...
Read more >
Diff - external/github.com/airbnb/lottie-web - Google Git
+ Transformation Matrix v2.0 + (c) Epistemex 2014-2015 + ... +// +// The g(count) method returns a pseudorandom integer that ... Try the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found