diff --git a/lib/element.js b/lib/element.js index 640d8c7..a8e78b7 100644 --- a/lib/element.js +++ b/lib/element.js @@ -129,7 +129,7 @@ function attribute(ctx, key, value) { /* Stringify the attribute name. */ function attributeName(ctx, key) { var info = information(key) || {}; - var name = info.name || kebab(key); + var name = info.name || (ctx.allowCamelCased ? key : kebab(key)); if ( name.slice(0, DATA.length) === DATA && diff --git a/lib/index.js b/lib/index.js index 5e78c8f..c756944 100644 --- a/lib/index.js +++ b/lib/index.js @@ -82,6 +82,7 @@ function toHTML(node, options) { dangerous: settings.allowDangerousHTML, voids: settings.voids || voids.concat(), entities: settings.entities || {}, - close: settings.closeSelfClosing + close: settings.closeSelfClosing, + allowCamelCased: settings.allowCamelCasedAttributes || false }, node); } diff --git a/test/element.js b/test/element.js index 9d7181d..aa4ac80 100644 --- a/test/element.js +++ b/test/element.js @@ -75,5 +75,13 @@ test('`element`', function (t) { 'should support `