Skip to content

Adding and then removing "background" from style attribute creates unwanted styles #2407

@WickyNilliams

Description

@WickyNilliams

I have an element and depending on some condition, may set it's background. If the condition is first true, and later false the element is left with some "residual" styles that were never set in code.

Output looks like:

<!-- condition true -->
<div style="background: #ff0000"></div>

<!-- then when condition is false -->
<div style="background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial;"></div>

These styles were never set by user code, and are interfering with styles in my CSS.

Here's a fiddle showing the issue: http://jsfiddle.net/tfKYJ/78/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions