@@ -2,7 +2,6 @@ import prefixAll from './static/prefixAll'
22import getBrowserInformation from './utils/getBrowserInformation'
33import getPrefixedKeyframes from './utils/getPrefixedKeyframes'
44import capitalizeString from './utils/capitalizeString'
5- import assign from './utils/assign'
65import prefixProps from './prefixProps'
76
87import calc from './plugins/calc'
@@ -82,11 +81,9 @@ export default class Prefixer {
8281 return styles
8382 }
8483
85- styles = assign ( { } , styles )
86-
8784 Object . keys ( styles ) . forEach ( property => {
8885 let value = styles [ property ]
89- if ( value instanceof Object ) {
86+ if ( value instanceof Object && ! Array . isArray ( value ) ) {
9087 // recurse through nested style objects
9188 styles [ property ] = this . prefix ( value )
9289 } else {
@@ -101,24 +98,24 @@ export default class Prefixer {
10198 } )
10299
103100 Object . keys ( styles ) . forEach ( property => {
104- const value = styles [ property ]
105- // resolve plugins
106- plugins . forEach ( plugin => {
107- // generates a new plugin interface with current data
108- const resolvedStyles = plugin ( {
109- property : property ,
110- value : value ,
111- styles : styles ,
112- browserInfo : this . _browserInfo ,
113- prefix : {
114- js : this . jsPrefix ,
115- css : this . cssPrefix ,
116- keyframes : this . prefixedKeyframes
117- } ,
118- keepUnprefixed : this . _keepUnprefixed ,
119- requiresPrefix : this . _requiresPrefix
101+ [ ] . concat ( styles [ property ] ) . forEach ( value => {
102+ // resolve plugins
103+ plugins . forEach ( plugin => {
104+ // generates a new plugin interface with current data
105+ assignStyles ( styles , plugin ( {
106+ property : property ,
107+ value : value ,
108+ styles : styles ,
109+ browserInfo : this . _browserInfo ,
110+ prefix : {
111+ js : this . jsPrefix ,
112+ css : this . cssPrefix ,
113+ keyframes : this . prefixedKeyframes
114+ } ,
115+ keepUnprefixed : this . _keepUnprefixed ,
116+ requiresPrefix : this . _requiresPrefix
117+ } ) , value , this . _keepUnprefixed )
120118 } )
121- assign ( styles , resolvedStyles )
122119 } )
123120 } )
124121
@@ -134,3 +131,18 @@ export default class Prefixer {
134131 return prefixAll ( styles )
135132 }
136133}
134+
135+ function assignStyles ( base , extend = { } , value , keepUnprefixed ) {
136+ Object . keys ( extend ) . forEach ( property => {
137+ const baseValue = base [ property ]
138+ if ( Array . isArray ( baseValue ) ) {
139+ [ ] . concat ( extend [ property ] ) . forEach ( val => {
140+ if ( base [ property ] . indexOf ( val ) === - 1 ) {
141+ base [ property ] . splice ( baseValue . indexOf ( value ) , keepUnprefixed ? 0 : 1 , val )
142+ }
143+ } )
144+ } else {
145+ base [ property ] = extend [ property ]
146+ }
147+ } )
148+ }
0 commit comments