Skip to content

Commit ac06016

Browse files
committed
handle !important in static styles (fix vuejs#4306)
1 parent 6034c3e commit ac06016

File tree

1 file changed

+3
-0
lines changed
  • src/platforms/web/runtime/modules

1 file changed

+3
-0
lines changed

src/platforms/web/runtime/modules/style.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ import { cached, camelize, extend } from 'shared/util'
44
import { normalizeStyleBinding, getStyle } from 'web/util/style'
55

66
const cssVarRE = /^--/
7+
const importantRE = /\s*!important$/
78
const setProp = (el, name, val) => {
89
/* istanbul ignore if */
910
if (cssVarRE.test(name)) {
1011
el.style.setProperty(name, val)
12+
} else if (importantRE.test(val)) {
13+
el.style.setProperty(name, val.replace(importantRE, ''), 'important')
1114
} else {
1215
el.style[normalize(name)] = val
1316
}

0 commit comments

Comments
 (0)