Skip to content

Commit

Permalink
DevTools should inject itself for XHTML pages too (not just HTML) (#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn authored Dec 9, 2021
1 parent f2a59df commit 2c1cf56
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/react-devtools-extensions/src/injectGlobalHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,18 @@ if (sessionStorageGetItem(SESSION_STORAGE_RELOAD_AND_PROFILE_KEY) === 'true') {
// We need to inject this code because content scripts (ie injectGlobalHook.js) don't have access
// to the webpage's window, so in order to access front end settings
// and communicate with React, we must inject this code into the webpage
if ('text/html' === document.contentType) {
injectCode(
';(' +
installHook.toString() +
'(window))' +
saveNativeValues +
detectReact,
);
switch (document.contentType) {
case 'text/html':
case 'application/xhtml+xml': {
injectCode(
';(' +
installHook.toString() +
'(window))' +
saveNativeValues +
detectReact,
);
break;
}
}

if (typeof exportFunction === 'function') {
Expand Down

0 comments on commit 2c1cf56

Please sign in to comment.