File tree Expand file tree Collapse file tree 3 files changed +24
-34
lines changed Expand file tree Collapse file tree 3 files changed +24
-34
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 3
3
/**
4
4
* Module dependencies.
5
5
*/
6
- var HTMLDOMPropertyConfig = require ( './DOMPropertyConfig' ) . HTMLDOMPropertyConfig ;
7
6
var utilities = require ( './utilities' ) ;
8
7
var propertyConfig = require ( './property-config' ) ;
8
+ var config = propertyConfig . config ;
9
+ var isCustomAttribute = propertyConfig . HTMLDOMPropertyConfig . isCustomAttribute ;
9
10
10
11
/**
11
12
* Make attributes compatible with React props.
@@ -24,20 +25,20 @@ function attributesToProps(attributes) {
24
25
propertyValue = attributes [ propertyName ] ;
25
26
26
27
// custom attributes (`data-` and `aria-`)
27
- if ( HTMLDOMPropertyConfig . isCustomAttribute ( propertyName ) ) {
28
+ if ( isCustomAttribute ( propertyName ) ) {
28
29
props [ propertyName ] = propertyValue ;
29
30
continue ;
30
31
}
31
32
32
33
// make HTML DOM attribute/property consistent with React attribute/property
33
- reactProperty = propertyConfig . html [ propertyName . toLowerCase ( ) ] ;
34
+ reactProperty = config . html [ propertyName . toLowerCase ( ) ] ;
34
35
if ( reactProperty ) {
35
36
props [ reactProperty ] = propertyValue ;
36
37
continue ;
37
38
}
38
39
39
40
// make SVG DOM attribute/property consistent with React attribute/property
40
- reactProperty = propertyConfig . svg [ propertyName ] ;
41
+ reactProperty = config . svg [ propertyName ] ;
41
42
if ( reactProperty ) {
42
43
props [ reactProperty ] = propertyValue ;
43
44
}
Original file line number Diff line number Diff line change 4
4
* Module dependencies.
5
5
*/
6
6
var utilities = require ( './utilities' ) ;
7
- var DOMPropertyConfig = require ( './DOMPropertyConfig' ) ;
8
- var HTMLDOMPropertyConfig = DOMPropertyConfig . HTMLDOMPropertyConfig ;
9
- var SVGDOMPropertyConfig = DOMPropertyConfig . SVGDOMPropertyConfig ;
7
+
8
+ // HTML and SVG DOM Property Configs
9
+ // originally in `react/lib/` but moved to `react-dom/lib/` in 15.4
10
+ var HTMLDOMPropertyConfig ;
11
+ var SVGDOMPropertyConfig ;
12
+
13
+ try {
14
+ HTMLDOMPropertyConfig = require ( 'react-dom/lib/HTMLDOMPropertyConfig' ) ;
15
+ SVGDOMPropertyConfig = require ( 'react-dom/lib/SVGDOMPropertyConfig' ) ;
16
+ } catch ( error ) {
17
+ HTMLDOMPropertyConfig = require ( 'react/lib/HTMLDOMPropertyConfig' ) ;
18
+ SVGDOMPropertyConfig = require ( 'react/lib/SVGDOMPropertyConfig' ) ;
19
+ }
10
20
11
21
var config = {
12
22
html : { } ,
@@ -54,6 +64,10 @@ for (propertyName in SVGDOMPropertyConfig.Properties) {
54
64
}
55
65
56
66
/**
57
- * Export React property config .
67
+ * Export React property configs .
58
68
*/
59
- module . exports = config ;
69
+ module . exports = {
70
+ config : config ,
71
+ HTMLDOMPropertyConfig : HTMLDOMPropertyConfig ,
72
+ SVGDOMPropertyConfig : SVGDOMPropertyConfig
73
+ } ;
You can’t perform that action at this time.
0 commit comments