Skip to content

bug(platform-server): dynamic styles do not get converted from camelCase to kebab-case #19235

Closed
Xenira/Shashki
#73
@CaerusKaru

Description

@CaerusKaru

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ x ] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

Using HostBinding or NgStyle with platform-server appends the style to the correct element, but does not convert the name of the style to kebab-case as platform-browser does. This leads the browser to not recognize the name of the style.

Expected behavior

The dynamically applied styles should be transferred to the DOM as kebab-case, not camelCase.

Minimal reproduction of the problem with instructions

  1. Create a component and add a HostBinding for marginRight
  2. Use @angular/cli to build a commonjs package
  3. Render the package using nguniversal/express-engine
  4. Turn off JS to prevent bootstrapping
  5. Inspect the DOM to find the component with the incorrect styles

What is the motivation / use case for changing the behavior?

If a user has JS disabled, or if bootstrapping is particularly slow, UX is greatly impacted as styles are not correctly applied throughout the DOM.

Environment


Angular version: 5.0.0-beta.7


Browser:
- [ x ] Chrome (desktop) version 61.0.3163.79
 
For Tooling issues:
- Node version: 8.5.0  
- Platform: Linux 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions