From 1aeffcc0da61f13a1185bc518afaa575f67ed784 Mon Sep 17 00:00:00 2001 From: hellopao Date: Wed, 20 Apr 2016 18:18:01 +0800 Subject: [PATCH] add "data-" prefix for custom attributes --- src/htmltojsx.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/htmltojsx.js b/src/htmltojsx.js index b7efa54..72118dc 100644 --- a/src/htmltojsx.js +++ b/src/htmltojsx.js @@ -485,7 +485,7 @@ HTMLtoJSX.prototype = { (ELEMENT_ATTRIBUTE_MAPPING[tagName] && ELEMENT_ATTRIBUTE_MAPPING[tagName][attribute.name]) || ATTRIBUTE_MAPPING[attribute.name] || - attribute.name; + ("data-" + attribute.name.replace(/^data-/,"")); var result = name; // Numeric values should be output as {123} not "123"