Skip to content

Commit 56c20fa

Browse files
feat(property-config): get property configs from react-dom-core
Because `react-dom` v16 no longer exposes `lib`, `react-dom-core` is used. See issue: facebook/react#10391 Resolves #43
1 parent bb7e688 commit 56c20fa

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

lib/property-config.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
var utilities = require('./utilities');
77

88
// HTML and SVG DOM Property Configs
9-
var HTMLDOMPropertyConfig = require('react-dom/lib/HTMLDOMPropertyConfig');
10-
var SVGDOMPropertyConfig = require('react-dom/lib/SVGDOMPropertyConfig');
9+
var HTMLDOMPropertyConfig = require('react-dom-core/lib/HTMLDOMPropertyConfig');
10+
var SVGDOMPropertyConfig = require('react-dom-core/lib/SVGDOMPropertyConfig');
1111

1212
var config = {
1313
html: {},
@@ -18,44 +18,42 @@ var propertyName;
1818

1919
/**
2020
* HTML DOM property config.
21+
* https://github.com/facebook/react/blob/master/src/renderers/dom/shared/HTMLDOMPropertyConfig.js
2122
*/
2223

23-
// first map out the HTML DOM attribute names
24+
// first map out the HTML attribute names
2425
// e.g., { className: 'class' } => { 'class': 'className' }
25-
// https://github.com/facebook/react/blob/master/src/renderers/dom/shared/HTMLDOMPropertyConfig.js#L204
2626
config.html = utilities.invertObject(
2727
HTMLDOMPropertyConfig.DOMAttributeNames
2828
);
2929

30-
// then map out the rest of the HTML DOM properties
31-
// e.g., { charSet: 0 } => { charset: 'charSet' }
32-
// https://github.com/facebook/react/blob/master/src/renderers/dom/shared/HTMLDOMPropertyConfig.js#L28
30+
// then map out the rest of the HTML properties
31+
// e.g., { readOnly: 0 } => { readonly: 'readOnly' }
3332
for (propertyName in HTMLDOMPropertyConfig.Properties) {
3433
// lowercase to make matching property names easier
3534
config.html[propertyName.toLowerCase()] = propertyName;
3635
}
3736

3837
/**
3938
* SVG DOM property config.
39+
* https://github.com/facebook/react/blob/master/src/renderers/dom/shared/SVGDOMPropertyConfig.js
4040
*/
4141

42-
// first map out the SVG DOM attribute names
42+
// first map out the SVG attribute names
4343
// e.g., { fontSize: 'font-size' } => { 'font-size': 'fontSize' }
44-
// https://github.com/facebook/react/blob/master/src/renderers/dom/shared/SVGDOMPropertyConfig.js#L36
4544
config.svg = utilities.invertObject(
4645
SVGDOMPropertyConfig.DOMAttributeNames
4746
);
4847

49-
// then map out the rest of the SVG DOM properties
50-
// e.g., { preserveAlpha: 0 } => { preserveAlpha: 'preserveAlpha' }
51-
// https://github.com/facebook/react/blob/master/src/renderers/dom/shared/HTMLDOMPropertyConfig.js#L28
48+
// then map out the rest of the SVG properties
49+
// e.g., { fillRule: 0 } => { fillRule: 'fillRule' }
5250
for (propertyName in SVGDOMPropertyConfig.Properties) {
5351
// do not lowercase as some svg properties are camel cased
5452
config.html[propertyName] = propertyName;
5553
}
5654

5755
/**
58-
* Export React property configs.
56+
* Export property configs.
5957
*/
6058
module.exports = {
6159
config: config,

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"converter"
3030
],
3131
"dependencies": {
32-
"html-dom-parser": "0.1.2"
32+
"html-dom-parser": "0.1.2",
33+
"react-dom-core": "0.0.2"
3334
},
3435
"devDependencies": {
3536
"coveralls": "^2.13.1",

0 commit comments

Comments
 (0)