html-to-react
Advanced tools
Comparing version 1.4.1 to 1.4.2
# Change Log | ||
## [v1.4.2](https://github.com/aknuds1/html-to-react/tree/v1.4.2) | ||
- Support onclick attribute of HTML elements | ||
## [v1.4.1](https://github.com/aknuds1/html-to-react/tree/v1.4.1) | ||
@@ -3,0 +7,0 @@ |
@@ -22,3 +22,3 @@ // These are all sourced from https://facebook.github.io/react/docs/tags-and-attributes.html - | ||
'step', 'style', 'summary', 'tabIndex', 'target', 'title', 'type', 'useMap', 'value', 'width', | ||
'wmode', 'wrap', | ||
'wmode', 'wrap', 'onClick', | ||
]; | ||
@@ -25,0 +25,0 @@ |
@@ -47,5 +47,2 @@ 'use strict'; | ||
} | ||
if (typeof value === 'string') { | ||
value = value; | ||
} | ||
result[key] = value || key; | ||
@@ -52,0 +49,0 @@ return result; |
{ | ||
"name": "html-to-react", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "A lightweight library that converts raw HTML to a React DOM structure.", | ||
@@ -48,3 +48,3 @@ "main": "index.js", | ||
"coveralls": "^3.0.6", | ||
"eslint": "^6.1.0", | ||
"eslint": "^6.4.0", | ||
"istanbul": "^0.4", | ||
@@ -51,0 +51,0 @@ "mocha": "^6.2.0", |
@@ -270,2 +270,10 @@ 'use strict'; | ||
}); | ||
it('should handle onclick attributes', function () { | ||
const htmlInput = '<button onclick="alert(\'hello!\')">Hello</button>'; | ||
const reactElem = parser.parse(htmlInput); | ||
assert.strictEqual(reactElem.props.onClick, 'alert(\'hello!\')'); | ||
}); | ||
}); | ||
@@ -272,0 +280,0 @@ |
56318
20
708