fela-bindings
Advanced tools
Comparing version 10.2.4 to 10.3.0
@@ -13,5 +13,9 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function hasDOM(renderer) { | ||
return !renderer.isNativeRenderer && typeof window !== 'undefined' && window.document && window.document.createElement; | ||
return renderer && !renderer.isNativeRenderer && typeof window !== 'undefined' && window.document && window.document.createElement; | ||
} | ||
function hasServerRenderedStyle() { | ||
return window.document.querySelectorAll('[data-fela-type]').length > 0; | ||
} | ||
export default function ProviderFactory(BaseComponent, renderChildren, statics) { | ||
@@ -26,4 +30,8 @@ var Provider = function (_BaseComponent) { | ||
if (props.rehydrate && hasDOM(props.renderer)) { | ||
rehydrate(props.renderer); | ||
if (hasDOM(props.renderer)) { | ||
if (props.rehydrate && hasServerRenderedStyle()) { | ||
rehydrate(props.renderer); | ||
} else { | ||
render(props.renderer); | ||
} | ||
} | ||
@@ -34,9 +42,2 @@ return _this; | ||
_createClass(Provider, [{ | ||
key: 'componentWillMount', | ||
value: function componentWillMount() { | ||
if (this.props.renderToDOM && hasDOM(this.props.renderer)) { | ||
render(this.props.renderer); | ||
} | ||
} | ||
}, { | ||
key: 'getChildContext', | ||
@@ -43,0 +44,0 @@ value: function getChildContext() { |
@@ -26,5 +26,9 @@ 'use strict'; | ||
function hasDOM(renderer) { | ||
return !renderer.isNativeRenderer && typeof window !== 'undefined' && window.document && window.document.createElement; | ||
return renderer && !renderer.isNativeRenderer && typeof window !== 'undefined' && window.document && window.document.createElement; | ||
} | ||
function hasServerRenderedStyle() { | ||
return window.document.querySelectorAll('[data-fela-type]').length > 0; | ||
} | ||
function ProviderFactory(BaseComponent, renderChildren, statics) { | ||
@@ -39,4 +43,8 @@ var Provider = function (_BaseComponent) { | ||
if (props.rehydrate && hasDOM(props.renderer)) { | ||
(0, _felaDom.rehydrate)(props.renderer); | ||
if (hasDOM(props.renderer)) { | ||
if (props.rehydrate && hasServerRenderedStyle()) { | ||
(0, _felaDom.rehydrate)(props.renderer); | ||
} else { | ||
(0, _felaDom.render)(props.renderer); | ||
} | ||
} | ||
@@ -47,9 +55,2 @@ return _this; | ||
_createClass(Provider, [{ | ||
key: 'componentWillMount', | ||
value: function componentWillMount() { | ||
if (this.props.renderToDOM && hasDOM(this.props.renderer)) { | ||
(0, _felaDom.render)(this.props.renderer); | ||
} | ||
} | ||
}, { | ||
key: 'getChildContext', | ||
@@ -56,0 +57,0 @@ value: function getChildContext() { |
{ | ||
"name": "fela-bindings", | ||
"version": "10.2.4", | ||
"version": "10.3.0", | ||
"description": "Abstract binding factories for Fela", | ||
@@ -30,8 +30,8 @@ "main": "lib/index.js", | ||
"fast-loops": "^1.0.0", | ||
"fela-dom": "^10.2.4", | ||
"fela-tools": "^10.2.4", | ||
"fela-dom": "^10.3.0", | ||
"fela-tools": "^10.3.0", | ||
"react-addons-shallow-compare": "^15.6.2", | ||
"shallow-equal": "^1.0.0" | ||
}, | ||
"gitHead": "4edeeffc5be2e05473a52c24523dbebcd9e0ef0d" | ||
"gitHead": "da2a0fc432df47617f017bac488bdb40ecddd2a1" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72561
Updatedfela-dom@^10.3.0
Updatedfela-tools@^10.3.0