DevTools should inject itself for XHTML pages too (not just HTML) (#22932)
Brian Vaughn committed
Dec 9, 2021 at 15:32 UTC
2c1cf5618a24238136e3bd6139fb7f359dffe0f9
1 file changed
+12
-8
packages/react-devtools-extensions/src/injectGlobalHook.js
+12
-8
@@ -135,14 +135,18 @@ if (sessionStorageGetItem(SESSION_STORAGE_RELOAD_AND_PROFILE_KEY) === 'true') {
135
// We need to inject this code because content scripts (ie injectGlobalHook.js) don't have access
136
// to the webpage's window, so in order to access front end settings
137
// and communicate with React, we must inject this code into the webpage
138
-if ('text/html' === document.contentType) {
139
- injectCode(
140
- ';(' +
141
- installHook.toString() +
142
- '(window))' +
143
- saveNativeValues +
144
- detectReact,
145
- );
138
+switch (document.contentType) {
139
+ case 'text/html':
140
+ case 'application/xhtml+xml': {
141
+ injectCode(
142
+ ';(' +
143
+ installHook.toString() +
144
+ '(window))' +
145
+ saveNativeValues +
146
+ detectReact,
147
+ );
148
+ break;
149
+ }
150
}
151
152
if (typeof exportFunction === 'function') {