Skip to content

Commit b24d23d

Browse files
authored
Update DOM warning wording and link (facebook#10819)
* Update DOM warning wording and link * Consistently use "Invalid" for known misspellings
1 parent 6e8c09c commit b24d23d

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

src/renderers/dom/shared/__tests__/ReactDOMAttribute-test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ describe('ReactDOM unknown attribute', () => {
112112

113113
testUnknownAttributeRemoval(Symbol('foo'));
114114
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
115-
'Warning: Invalid prop `unknown` on <div> tag. Either remove this ' +
116-
'prop from the element, or pass a string or number value to keep it ' +
117-
'in the DOM. For details, see https://fb.me/react-unknown-prop\n' +
115+
'Warning: Invalid value for prop `unknown` on <div> tag. Either remove it ' +
116+
'from the element, or pass a string or number value to keep it ' +
117+
'in the DOM. For details, see https://fb.me/react-attribute-behavior\n' +
118118
' in div (at **)',
119119
);
120120
expectDev(console.error.calls.count()).toBe(1);
@@ -125,10 +125,10 @@ describe('ReactDOM unknown attribute', () => {
125125

126126
testUnknownAttributeRemoval(function someFunction() {});
127127
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
128-
'Warning: Invalid prop `unknown` on <div> tag. Either remove this ' +
129-
'prop from the element, or pass a string or number value to ' +
128+
'Warning: Invalid value for prop `unknown` on <div> tag. Either remove ' +
129+
'it from the element, or pass a string or number value to ' +
130130
'keep it in the DOM. For details, see ' +
131-
'https://fb.me/react-unknown-prop\n' +
131+
'https://fb.me/react-attribute-behavior\n' +
132132
' in div (at **)',
133133
);
134134
expectDev(console.error.calls.count()).toBe(1);

src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ describe('ReactDOMComponent', () => {
148148
ReactDOM.render(<div foo={() => {}} />, container);
149149
expectDev(console.error.calls.count(0)).toBe(1);
150150
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
151-
'Warning: Invalid prop `foo` on <div> tag. Either remove this prop ' +
151+
'Warning: Invalid value for prop `foo` on <div> tag. Either remove it ' +
152152
'from the element, or pass a string or number value to keep ' +
153-
'it in the DOM. For details, see https://fb.me/react-unknown-prop' +
153+
'it in the DOM. For details, see https://fb.me/react-attribute-behavior' +
154154
'\n in div (at **)',
155155
);
156156
});
@@ -161,9 +161,9 @@ describe('ReactDOMComponent', () => {
161161
ReactDOM.render(<div foo={() => {}} baz={() => {}} />, container);
162162
expectDev(console.error.calls.count(0)).toBe(1);
163163
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
164-
'Warning: Invalid props `foo`, `baz` on <div> tag. Either remove these ' +
165-
'props from the element, or pass a string or number value to keep ' +
166-
'them in the DOM. For details, see https://fb.me/react-unknown-prop' +
164+
'Warning: Invalid values for props `foo`, `baz` on <div> tag. Either remove ' +
165+
'them from the element, or pass a string or number value to keep ' +
166+
'them in the DOM. For details, see https://fb.me/react-attribute-behavior' +
167167
'\n in div (at **)',
168168
);
169169
});
@@ -174,7 +174,7 @@ describe('ReactDOMComponent', () => {
174174
ReactDOM.render(<div onDblClick={() => {}} />, container);
175175
expectDev(console.error.calls.count(0)).toBe(1);
176176
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
177-
'Warning: Unknown event handler property `onDblClick`. Did you mean `onDoubleClick`?\n in div (at **)',
177+
'Warning: Invalid event handler property `onDblClick`. Did you mean `onDoubleClick`?\n in div (at **)',
178178
);
179179
});
180180

@@ -1732,7 +1732,7 @@ describe('ReactDOMComponent', () => {
17321732
'Warning: Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
17331733
);
17341734
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
1735-
'Warning: Unknown event handler property `onclick`. Did you mean ' +
1735+
'Warning: Invalid event handler property `onclick`. Did you mean ' +
17361736
'`onClick`?\n in input (at **)',
17371737
);
17381738
});
@@ -1746,7 +1746,7 @@ describe('ReactDOMComponent', () => {
17461746
'Warning: Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
17471747
);
17481748
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
1749-
'Warning: Unknown event handler property `onclick`. Did you mean ' +
1749+
'Warning: Invalid event handler property `onclick`. Did you mean ' +
17501750
'`onClick`?\n in input (at **)',
17511751
);
17521752
});
@@ -2115,7 +2115,7 @@ describe('ReactDOMComponent', () => {
21152115
expect(el.hasAttribute('whatever')).toBe(false);
21162116

21172117
expectDev(console.error.calls.argsFor(0)[0]).toContain(
2118-
'Warning: Invalid prop `whatever` on <div> tag',
2118+
'Warning: Invalid value for prop `whatever` on <div> tag',
21192119
);
21202120
});
21212121

@@ -2186,7 +2186,7 @@ describe('ReactDOMComponent', () => {
21862186
expect(el.hasAttribute('whatever')).toBe(false);
21872187

21882188
expectDev(console.error.calls.argsFor(0)[0]).toContain(
2189-
'Warning: Invalid prop `whatever` on <div> tag.',
2189+
'Warning: Invalid value for prop `whatever` on <div> tag.',
21902190
);
21912191
});
21922192

src/renderers/dom/shared/hooks/ReactDOMUnknownPropertyHook.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ if (__DEV__) {
7373
if (registrationName != null) {
7474
warning(
7575
false,
76-
'Unknown event handler property `%s`. Did you mean `%s`?%s',
76+
'Invalid event handler property `%s`. Did you mean `%s`?%s',
7777
name,
7878
registrationName,
7979
getStackAddendum(debugID),
@@ -234,19 +234,19 @@ var warnUnknownProperties = function(type, props, debugID) {
234234
if (unknownProps.length === 1) {
235235
warning(
236236
false,
237-
'Invalid prop %s on <%s> tag. Either remove this prop from the element, ' +
237+
'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' +
238238
'or pass a string or number value to keep it in the DOM. ' +
239-
'For details, see https://fb.me/react-unknown-prop%s',
239+
'For details, see https://fb.me/react-attribute-behavior%s',
240240
unknownPropString,
241241
type,
242242
getStackAddendum(debugID),
243243
);
244244
} else if (unknownProps.length > 1) {
245245
warning(
246246
false,
247-
'Invalid props %s on <%s> tag. Either remove these props from the element, ' +
247+
'Invalid values for props %s on <%s> tag. Either remove them from the element, ' +
248248
'or pass a string or number value to keep them in the DOM. ' +
249-
'For details, see https://fb.me/react-unknown-prop%s',
249+
'For details, see https://fb.me/react-attribute-behavior%s',
250250
unknownPropString,
251251
type,
252252
getStackAddendum(debugID),

0 commit comments

Comments
 (0)