diff --git a/index.js b/index.js index c85e599..a6df2e2 100644 --- a/index.js +++ b/index.js @@ -20,6 +20,8 @@ try { var own = {}.hasOwnProperty +var tableElements = ['table', 'thead', 'tbody', 'tfoot', 'tr'] + function react(options) { var settings = options || {} var createElement = settings.createElement || globalCreateElement @@ -34,6 +36,18 @@ function react(options) { // Wrapper around `createElement` to pass components in. function h(name, props, children) { + // Currently, a warning is triggered by react for *any* white space in + // tables. + // So we remove the pretty lines for now. + // See: . + // See: . + // See: . + if (children && tableElements.indexOf(name) !== -1) { + children = children.filter(function(child) { + return child !== '\n' + }) + } + return createElement( own.call(components, name) ? components[name] : name, props, diff --git a/test/react/v16/fixtures/tables/output.html b/test/react/v16/fixtures/tables/output.html index 09ee6a4..08fe121 100644 --- a/test/react/v16/fixtures/tables/output.html +++ b/test/react/v16/fixtures/tables/output.html @@ -1,42 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AlphaBravoCharlieDelta
EchoFoxtrotGolf
IndiaJuliettKiloLima
MikeNovemberOscarPapa
QuebecRomeoSierraTango
UniformVictorWhiskey
+
AlphaBravoCharlieDelta
EchoFoxtrotGolf
IndiaJuliettKiloLima
MikeNovemberOscarPapa
QuebecRomeoSierraTango
UniformVictorWhiskey