@@ -223,15 +223,14 @@ function extractProps (data: VNodeData, Ctor: Class<Component>): ?Object {
223
223
}
224
224
const res = { }
225
225
const { attrs , props, domProps, staticAttrs } = data
226
- if ( ! attrs && ! props && ! domProps && ! staticAttrs ) {
227
- return res
228
- }
229
- for ( const key in propOptions ) {
230
- const altKey = hyphenate ( key )
231
- checkProp ( res , attrs , key , altKey ) ||
232
- checkProp ( res , props , key , altKey ) ||
233
- checkProp ( res , domProps , key , altKey ) ||
234
- checkProp ( res , staticAttrs , key , altKey )
226
+ if ( attrs || props || domProps || staticAttrs ) {
227
+ for ( const key in propOptions ) {
228
+ const altKey = hyphenate ( key )
229
+ checkProp ( res , props , key , altKey , true ) ||
230
+ checkProp ( res , attrs , key , altKey ) ||
231
+ checkProp ( res , domProps , key , altKey ) ||
232
+ checkProp ( res , staticAttrs , key , altKey )
233
+ }
235
234
}
236
235
return res
237
236
}
@@ -240,16 +239,21 @@ function checkProp (
240
239
res : Object ,
241
240
hash : ?Object ,
242
241
key : string ,
243
- altKey: string
242
+ altKey : string ,
243
+ preserve ?: boolean
244
244
) : boolean {
245
245
if ( hash ) {
246
246
if ( hasOwn ( hash , key ) ) {
247
247
res [ key ] = hash [ key ]
248
- delete hash [ key ]
248
+ if ( ! preserve ) {
249
+ delete hash [ key ]
250
+ }
249
251
return true
250
252
} else if ( hasOwn ( hash , altKey ) ) {
251
253
res [ key ] = hash [ altKey ]
252
- delete hash [ altKey ]
254
+ if ( ! preserve ) {
255
+ delete hash [ altKey ]
256
+ }
253
257
return true
254
258
}
255
259
}
0 commit comments