diff --git a/src/ReactVersion.js b/src/ReactVersion.js index 4972f9494..cf91b4c58 100644 --- a/src/ReactVersion.js +++ b/src/ReactVersion.js @@ -13,2 +13,2 @@ -module.exports = '15.6.0'; +module.exports = '15.6.1'; diff --git a/src/addons/link/ReactLink.js b/src/addons/link/ReactLink.js index 273c4fdcc..d91345e69 100644 --- a/src/addons/link/ReactLink.js +++ b/src/addons/link/ReactLink.js @@ -36,4 +36,2 @@ -var React = require('React'); - /** diff --git a/src/isomorphic/classic/types/__tests__/ReactPropTypes-test.js b/src/isomorphic/classic/types/__tests__/ReactPropTypes-test.js index 092d2b6f8..c12cc1c29 100644 --- a/src/isomorphic/classic/types/__tests__/ReactPropTypes-test.js +++ b/src/isomorphic/classic/types/__tests__/ReactPropTypes-test.js @@ -91,3 +91,13 @@ function typeCheckPass(declaration, value) { +function resetWarningCache() { + jest.resetModules(); + PropTypes = require('ReactPropTypes'); + React = require('React'); + ReactFragment = require('ReactFragment'); + ReactTestUtils = require('ReactTestUtils'); + ReactPropTypesSecret = require('ReactPropTypesSecret'); +} + function expectWarningInDevelopment(declaration, value) { + resetWarningCache(); var props = {testProp: value}; @@ -107,7 +117,3 @@ describe('ReactPropTypes', () => { beforeEach(() => { - PropTypes = require('ReactPropTypes'); - React = require('React'); - ReactFragment = require('ReactFragment'); - ReactTestUtils = require('ReactTestUtils'); - ReactPropTypesSecret = require('ReactPropTypesSecret'); + resetWarningCache(); }); diff --git a/src/renderers/dom/client/inputValueTracking.js b/src/renderers/dom/client/inputValueTracking.js index f5fa806e3..f0086f03a 100644 --- a/src/renderers/dom/client/inputValueTracking.js +++ b/src/renderers/dom/client/inputValueTracking.js @@ -64,6 +64,11 @@ var inputValueTracking = { - // if someone has already defined a value bail and don't track value - // will cause over reporting of changes, but it's better then a hard failure - // (needed for certain tests that spyOn input values) - if (node.hasOwnProperty(valueField)) { + // if someone has already defined a value or Safari, then bail + // and don't track value will cause over reporting of changes, + // but it's better then a hard failure + // (needed for certain tests that spyOn input values and Safari) + if ( + node.hasOwnProperty(valueField) || + typeof descriptor.get !== 'function' || + typeof descriptor.set !== 'function' + ) { return; diff --git a/src/renderers/dom/shared/CSSPropertyOperations.js b/src/renderers/dom/shared/CSSPropertyOperations.js index 2bc2ae174..0af3b0980 100644 --- a/src/renderers/dom/shared/CSSPropertyOperations.js +++ b/src/renderers/dom/shared/CSSPropertyOperations.js @@ -130,6 +130,2 @@ if (__DEV__) { var warnValidStyle = function(name, value, component) { - // Don't warn for CSS variables - if (name.indexOf('--') === 0) { - return; - } var owner; @@ -175,5 +171,8 @@ var CSSPropertyOperations = { } + var isCustomProperty = styleName.indexOf('--') === 0; var styleValue = styles[styleName]; if (__DEV__) { - warnValidStyle(styleName, styleValue, component); + if (!isCustomProperty) { + warnValidStyle(styleName, styleValue, component); + } } @@ -182,3 +181,8 @@ var CSSPropertyOperations = { serialized += - dangerousStyleValue(styleName, styleValue, component) + ';'; + dangerousStyleValue( + styleName, + styleValue, + component, + isCustomProperty, + ) + ';'; } @@ -210,4 +214,7 @@ var CSSPropertyOperations = { } + var isCustomProperty = styleName.indexOf('--') === 0; if (__DEV__) { - warnValidStyle(styleName, styles[styleName], component); + if (!isCustomProperty) { + warnValidStyle(styleName, styles[styleName], component); + } } @@ -217,2 +224,3 @@ var CSSPropertyOperations = { component, + isCustomProperty, ); @@ -221,3 +229,3 @@ var CSSPropertyOperations = { } - if (styleName.indexOf('--') === 0) { + if (isCustomProperty) { style.setProperty(styleName, styleValue); diff --git a/src/renderers/dom/shared/__tests__/CSSPropertyOperations-test.js b/src/renderers/dom/shared/__tests__/CSSPropertyOperations-test.js index e383549ec..21029d00c 100644 --- a/src/renderers/dom/shared/__tests__/CSSPropertyOperations-test.js +++ b/src/renderers/dom/shared/__tests__/CSSPropertyOperations-test.js @@ -103,2 +103,10 @@ describe('CSSPropertyOperations', () => { + it('should create markup with unitless css custom property', () => { + expect( + CSSPropertyOperations.createMarkupForStyles({ + '--foo': 5, + }), + ).toBe('--foo:5;'); + }); + it('should set style attribute when styles exist', () => { @@ -256,3 +264,3 @@ describe('CSSPropertyOperations', () => { - it('should not warn when setting CSS variables', () => { + it('should not warn when setting CSS custom properties', () => { class Comp extends React.Component { @@ -269,2 +277,15 @@ describe('CSSPropertyOperations', () => { }); + + it('should not add units to CSS custom properties', () => { + class Comp extends React.Component { + render() { + return
; + } + } + + var root = document.createElement('div'); + ReactDOM.render(