1
1
var reactProperty = require ( 'react-property' ) ;
2
2
var utilities = require ( './utilities' ) ;
3
3
4
- var setStyleProp = utilities . setStyleProp ;
5
-
6
- var htmlProperties = reactProperty . html ;
7
- var svgProperties = reactProperty . svg ;
8
- var isCustomAttribute = reactProperty . isCustomAttribute ;
9
-
10
4
var hasOwnProperty = Object . prototype . hasOwnProperty ;
11
5
12
6
/**
@@ -28,15 +22,15 @@ function attributesToProps(attributes) {
28
22
attributeValue = attributes [ attributeName ] ;
29
23
30
24
// ARIA (aria-*) or custom data (data-*) attribute
31
- if ( isCustomAttribute ( attributeName ) ) {
25
+ if ( reactProperty . isCustomAttribute ( attributeName ) ) {
32
26
props [ attributeName ] = attributeValue ;
33
27
continue ;
34
28
}
35
29
36
30
// convert HTML attribute to React prop
37
31
attributeNameLowerCased = attributeName . toLowerCase ( ) ;
38
- if ( hasOwnProperty . call ( htmlProperties , attributeNameLowerCased ) ) {
39
- property = htmlProperties [ attributeNameLowerCased ] ;
32
+ if ( hasOwnProperty . call ( reactProperty . html , attributeNameLowerCased ) ) {
33
+ property = reactProperty . html [ attributeNameLowerCased ] ;
40
34
props [ property . propertyName ] =
41
35
property . hasBooleanValue ||
42
36
( property . hasOverloadedBooleanValue && ! attributeValue )
@@ -46,8 +40,8 @@ function attributesToProps(attributes) {
46
40
}
47
41
48
42
// convert SVG attribute to React prop
49
- if ( hasOwnProperty . call ( svgProperties , attributeName ) ) {
50
- property = svgProperties [ attributeName ] ;
43
+ if ( hasOwnProperty . call ( reactProperty . svg , attributeName ) ) {
44
+ property = reactProperty . svg [ attributeName ] ;
51
45
props [ property . propertyName ] = attributeValue ;
52
46
continue ;
53
47
}
@@ -59,7 +53,7 @@ function attributesToProps(attributes) {
59
53
}
60
54
61
55
// transform inline style to object
62
- setStyleProp ( attributes . style , props ) ;
56
+ utilities . setStyleProp ( attributes . style , props ) ;
63
57
64
58
return props ;
65
59
}
0 commit comments