Skip to content

DomSanitizer should keep style attributes in HTML, but sanitize them if needed #19645

@pcroc

Description

@pcroc

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ x ] 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

DOM sanitizer removes style attribute from all elements.

Expected behavior

DOM santitizer keeps the style attribute on elements, but sanitizes the actual style value if needed, so something innocuous like style="text-align: center" isn't lost.

Minimal reproduction of the problem with instructions

http://plnkr.co/edit/AjJMr2pDz8IxvucnpTbC?p=preview

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

Displaying blog posts or other CMS content which uses inline styles for layout/styling.

Environment


Angular version: 4.3.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtimecore: sanitizationfeatureIssue that requests a new featurefeature: under considerationFeature request for which voting has completed and the request is now under consideration

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions