File tree Expand file tree Collapse file tree 3 files changed +29
-8
lines changed
packages/react-devtools-extensions Expand file tree Collapse file tree 3 files changed +29
-8
lines changed Original file line number Diff line number Diff line change 1- function cloneStyleTags ( ) {
2- const linkTags = [ ] ;
1+ /**
2+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ *
7+ * @flow
8+ */
9+
10+ export function cloneStyleTags ( ) : Array < HTMLLinkElement | HTMLStyleElement > {
11+ const tags : Array < HTMLLinkElement | HTMLStyleElement > = [ ] ;
312
413 // eslint-disable-next-line no-for-of-loops/no-for-of-loops
514 for ( const linkTag of document . getElementsByTagName ( 'link' ) ) {
@@ -11,11 +20,23 @@ function cloneStyleTags() {
1120 newLinkTag . setAttribute ( attribute . nodeName , attribute . nodeValue ) ;
1221 }
1322
14- linkTags . push ( newLinkTag ) ;
23+ styleTags . push ( newLinkTag ) ;
1524 }
1625 }
1726
18- return linkTags ;
19- }
27+ // eslint-disable-next-line no-for-of-loops/no-for-of-loops
28+ for ( const styleTag of document . getElementsByTagName ( 'style' ) ) {
29+ const newStyleTag = document . createElement ( 'style' ) ;
30+
31+ // eslint-disable-next-line no-for-of-loops/no-for-of-loops
32+ for ( const attribute of styleTag . attributes ) {
33+ newStyleTag . setAttribute ( attribute . nodeName , attribute . nodeValue ) ;
34+ }
2035
21- export default cloneStyleTags ;
36+ newStyleTag . textContent = styleTag . textContent ;
37+
38+ tags . push ( newStyleTag ) ;
39+ }
40+
41+ return tags ;
42+ }
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import {
3333import { viewAttributeSource } from './sourceSelection' ;
3434
3535import { startReactPolling } from './reactPolling' ;
36- import cloneStyleTags from './cloneStyleTags' ;
36+ import { cloneStyleTags } from './cloneStyleTags' ;
3737import fetchFileWithCaching from './fetchFileWithCaching' ;
3838import injectBackendManager from './injectBackendManager' ;
3939import registerEventsLogger from './registerEventsLogger' ;
Original file line number Diff line number Diff line change @@ -285,7 +285,7 @@ module.exports = {
285285 {
286286 loader : 'css-loader' ,
287287 options : {
288- sourceMap : true ,
288+ sourceMap : __DEV__ ,
289289 modules : true ,
290290 localIdentName : '[local]___[hash:base64:5]' ,
291291 } ,
You can’t perform that action at this time.
0 commit comments