Skip to content

Commit

Permalink
Refactor string parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
jlmakes committed Mar 4, 2021
1 parent eb24048 commit cb9b515
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

## Unreleased

### [4.0.8] - 2021-03-02
### Fixed

- Styles applied using CSSOM don't drop `:` characters.

## [4.0.8] - 2021-03-02

### Fixed

- Avoid Content Security Policy (CSP) violations. [@lambdacasserole](https://github.com/lambdacasserole) [#431](https://github.com/jlmakes/scrollreveal/pull/431)

Expand Down
4 changes: 2 additions & 2 deletions src/instance/functions/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ export default function style(element) {
*/
export function applyStyle (el, declaration) {
declaration.split(';').forEach(pair => {
const [property, value] = pair.split(':').map(s => s.trim())
const [property, ...value] = pair.split(':')
if (property && value) {
el.style[property] = value
el.style[property.trim()] = value.join(':')
}
})
}
Expand Down

0 comments on commit cb9b515

Please sign in to comment.