How to use the react-dom-core/lib/HTMLDOMPropertyConfig.DOMAttributeNames function in react-dom-core

To help you get started, we’ve selected a few react-dom-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github remarkablemark / html-react-parser / lib / property-config.js View on Github external
var config = {
    html: {},
    svg: {}
};

var propertyName;

/**
 * HTML DOM property config.
 * https://github.com/facebook/react/blob/master/src/renderers/dom/shared/HTMLDOMPropertyConfig.js
 */

// first map out the HTML attribute names
// e.g., { className: 'class' } => { 'class': 'className' }
config.html = utilities.invertObject(
    HTMLDOMPropertyConfig.DOMAttributeNames
);

// then map out the rest of the HTML properties
// e.g., { readOnly: 0 } => { readonly: 'readOnly' }
for (propertyName in HTMLDOMPropertyConfig.Properties) {
    // lowercase to make matching property names easier
    config.html[propertyName.toLowerCase()] = propertyName;
}

/**
 * SVG DOM property config.
 * https://github.com/facebook/react/blob/master/src/renderers/dom/shared/SVGDOMPropertyConfig.js
 */

// first map out the SVG attribute names
// e.g., { fontSize: 'font-size' } => { 'font-size': 'fontSize' }