Revert "Merge pull request #6184 from gaearon/fix-svg-warning"
This reverts commit 36798f7395d9b2e1cfaed988133d11fa88afa8f1, reversing changes made to b89e7d25d5695952f7d201f516451c4dc241c023.
Paul O’Shannessy committed
Mar 9, 2016 at 10:50 UTC
2fb74cd1acdc785aa8b2560fb892f316a992dc2d
2 files changed
+4
-40
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
-33
@@ -449,39 +449,6 @@ describe('ReactDOMComponent', function() {
449
expect(console.error.argsForCall[0][0]).toContain('clip-path');
450
});
451
452
- it('should only warn once about deprecated SVG attributes', function() {
453
- spyOn(console, 'error');
454
- var container = document.createElement('div');
455
- ReactDOM.render(
456
- <svg clipPath="0 0 100 100">
457
- <rect strokeWidth={1} />
458
- <rect strokeWidth={10} />
459
- </svg>,
460
- container
461
- );
462
- expect(console.error.argsForCall.length).toBe(2);
463
- expect(console.error.argsForCall[0][0]).toContain('clipPath');
464
- expect(console.error.argsForCall[0][0]).toContain('clip-path');
465
- expect(console.error.argsForCall[1][0]).toContain('strokeWidth');
466
- expect(console.error.argsForCall[1][0]).toContain('stroke-width');
467
-
468
- ReactDOM.render(
469
- <svg clipPath="0 0 100 100">
470
- <rect strokeWidth={1} strokeOpacity={0.5} />
471
- <rect strokeWidth={10} />
472
- <rect strokeWidth={100} />
473
- </svg>,
474
- container
475
- );
476
- expect(console.error.argsForCall.length).toBe(3);
477
- expect(console.error.argsForCall[0][0]).toContain('clipPath');
478
- expect(console.error.argsForCall[0][0]).toContain('clip-path');
479
- expect(console.error.argsForCall[1][0]).toContain('strokeWidth');
480
- expect(console.error.argsForCall[1][0]).toContain('stroke-width');
481
- expect(console.error.argsForCall[2][0]).toContain('strokeOpacity');
482
- expect(console.error.argsForCall[2][0]).toContain('stroke-opacity');
483
- });
484
-
452
it('should update arbitrary hyphenated attributes for SVG tags', function() {
453
var container = document.createElement('div');
454
src/renderers/dom/shared/devtools/ReactDOMSVGDeprecatedAttributeDevtool.js
+4
-7
@@ -25,23 +25,20 @@ if (__DEV__) {
25
var warnedSVGAttributes = {};
26
27
var warnDeprecatedSVGAttribute = function(name) {
28
- if (reactProps.hasOwnProperty(name) && reactProps[name]) {
28
+ if (!DOMProperty.properties.hasOwnProperty(name)) {
29
return;
30
}
31
32
- if (!DOMProperty.properties.hasOwnProperty(name)) {
32
+ if (reactProps.hasOwnProperty(name) && reactProps[name] ||
33
+ warnedSVGAttributes.hasOwnProperty(name) && warnedSVGAttributes[name]) {
34
return;
35
}
36
+
37
var { attributeName, attributeNamespace } = DOMProperty.properties[name];
38
if (attributeNamespace || name === attributeName) {
39
return;
40
}
41
40
- if (warnedSVGAttributes.hasOwnProperty(name) && warnedSVGAttributes[name]) {
41
- return;
42
- }
43
- warnedSVGAttributes[name] = true;
44
-
42
warning(
43
false,
44
'SVG property %s is deprecated. Use the original attribute name ' +