A place to cache linked articles (think custom and personal wayback machine)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <!doctype html><!-- This is a valid HTML5 document. -->
  2. <!-- Screen readers, SEO, extensions and so on. -->
  3. <html lang="fr">
  4. <!-- Has to be within the first 1024 bytes, hence before the `title` element
  5. See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset -->
  6. <meta charset="utf-8">
  7. <!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
  8. <!-- The viewport meta is quite crowded and we are responsible for that.
  9. See: https://codepen.io/tigt/post/meta-viewport-for-2015 -->
  10. <meta name="viewport" content="width=device-width,initial-scale=1">
  11. <!-- Required to make a valid HTML5 document. -->
  12. <title>NASA satellites reveal restoration power of beavers (archive) — David Larlet</title>
  13. <meta name="description" content="Publication mise en cache pour en conserver une trace.">
  14. <!-- That good ol' feed, subscribe :). -->
  15. <link rel="alternate" type="application/atom+xml" title="Feed" href="/david/log/">
  16. <!-- Generated from https://realfavicongenerator.net/ such a mess. -->
  17. <link rel="apple-touch-icon" sizes="180x180" href="/static/david/icons2/apple-touch-icon.png">
  18. <link rel="icon" type="image/png" sizes="32x32" href="/static/david/icons2/favicon-32x32.png">
  19. <link rel="icon" type="image/png" sizes="16x16" href="/static/david/icons2/favicon-16x16.png">
  20. <link rel="manifest" href="/static/david/icons2/site.webmanifest">
  21. <link rel="mask-icon" href="/static/david/icons2/safari-pinned-tab.svg" color="#07486c">
  22. <link rel="shortcut icon" href="/static/david/icons2/favicon.ico">
  23. <meta name="msapplication-TileColor" content="#f7f7f7">
  24. <meta name="msapplication-config" content="/static/david/icons2/browserconfig.xml">
  25. <meta name="theme-color" content="#f7f7f7" media="(prefers-color-scheme: light)">
  26. <meta name="theme-color" content="#272727" media="(prefers-color-scheme: dark)">
  27. <!-- Is that even respected? Retrospectively? What a shAItshow…
  28. https://neil-clarke.com/block-the-bots-that-feed-ai-models-by-scraping-your-website/ -->
  29. <meta name="robots" content="noai, noimageai">
  30. <!-- Documented, feel free to shoot an email. -->
  31. <link rel="stylesheet" href="/static/david/css/style_2021-01-20.css">
  32. <!-- See https://www.zachleat.com/web/comprehensive-webfonts/ for the trade-off. -->
  33. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  34. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  35. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  36. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  37. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  38. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  39. <script>
  40. function toggleTheme(themeName) {
  41. document.documentElement.classList.toggle(
  42. 'forced-dark',
  43. themeName === 'dark'
  44. )
  45. document.documentElement.classList.toggle(
  46. 'forced-light',
  47. themeName === 'light'
  48. )
  49. }
  50. const selectedTheme = localStorage.getItem('theme')
  51. if (selectedTheme !== 'undefined') {
  52. toggleTheme(selectedTheme)
  53. }
  54. </script>
  55. <meta name="robots" content="noindex, nofollow">
  56. <meta content="origin-when-cross-origin" name="referrer">
  57. <!-- Canonical URL for SEO purposes -->
  58. <link rel="canonical" href="https://news.mongabay.com/2023/09/nasa-satellites-reveal-restoration-power-of-beavers/">
  59. <body class="remarkdown h1-underline h2-underline h3-underline em-underscore hr-center ul-star pre-tick" data-instant-intensity="viewport-all">
  60. <article>
  61. <header>
  62. <h1>NASA satellites reveal restoration power of beavers</h1>
  63. </header>
  64. <nav>
  65. <p class="center">
  66. <a href="/david/" title="Aller à l’accueil"><svg class="icon icon-home">
  67. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-home"></use>
  68. </svg> Accueil</a> •
  69. <a href="https://news.mongabay.com/2023/09/nasa-satellites-reveal-restoration-power-of-beavers/" title="Lien vers le contenu original">Source originale</a>
  70. </p>
  71. </nav>
  72. <hr>
  73. <p>If humans went extinct tomorrow, who would rule the world? Beavers.</p>
  74. <p>Well, at least in the Northern Hemisphere. These tree-felling, water-slowing, wetland-creating rodent engineers have a massive impact wherever they live. Indeed, when it comes to their power over water flow, Cory Mosby says, “I’m not aware of another species that does this (save humans) on the scale that a beaver population can.”</p>
  75. <p>A biologist with the Idaho Department of Fish and Wildlife, Mosby knows the power of these mammals intimately. And now NASA — yes, the same agency that sends people into space and searches for killer comets — is helping researchers get a more detailed look at how beavers can transform our world for the better, including combating climate change.</p>
  76. <figure id="attachment_273147" class="wp-caption aligncenter"><img decoding="async" fetchpriority="high" class="size-full wp-image-273147" src="https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11142614/DJI_0081-copy.jpg" alt="Beaver dam on an Idaho creek. Image courtesy of Boise State University." width="768" height="512" srcset="https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11142614/DJI_0081-copy.jpg 768w, https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11142614/DJI_0081-copy-610x407.jpg 610w" sizes="(max-width: 768px) 100vw, 768px" /><figcaption class="wp-caption-text">Beaver dam on an Idaho creek. Image courtesy of Boise State University.</figcaption></figure>
  77. <p>“NASA is interested in how satellite Earth observations can be used for natural resource management,” says Cynthia Schmidt, the associate program manager for the NASA Ecological Conservation Program. In this particular case, Schmidt says, NASA is keen to use satellite research to help scientists “better understand the impacts of rewilding for ecosystem restoration.”</p>
  78. <p>Working with Jodi Brandt, a professor of human-environment systems at Boise State University, they are tracking just how quickly and verdantly reintroduced beavers change Idaho’s landscape. Already, the program has been able to produce images taken from space of how areas with reintroduced beavers are greener — i.e. have more vegetation — than areas without them.</p>
  79. <p><strong>Water lords</strong></p>
  80. <p>North America once housed more beavers than humans — by a lot. Even before Europeans showed up and built an entire extractive economy on beaver pelts, estimates put the number in the hundreds of millions (during the Pleistocene, there were even giant species of beaver, as large as bears). The North American fur trade, which lasted for centuries, nearly wiped beavers off the continent — and, unknown to trappers, vastly changed its ecosystems from sea to sea.</p>
  81. <p>“There is evidence that riverscapes across the West were much more complex and ‘anastomosed’ prior to European colonization,” says Nicholas Kolarik, a Ph.D. student working with Brandt, who is focusing on mapping data sets of wetlands. Anastomosis denotes branches connecting two things, like organs in the body, but in this case, he means streams, since waterways in the U.S. West used to be much more interconnected.</p>
  82. <p>Today, they’re “starved of wood,” he says, but by adding wood into streams and rivers, especially by building dams, beavers slow water down significantly.</p>
  83. <p>“In doing so, sediment is stored, water infiltrates into the aquifers, riparian vegetation establishes, habitat is created, and carbon is stored,” Kolarik says.</p>
  84. <figure id="attachment_273150" class="wp-caption aligncenter"><img decoding="async" class="size-full wp-image-273150" src="https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11143804/jodi_cindy_2022.jpg" alt="Researcher Jodi Brandt (l) leads a team studying the re-wetting power of beavers. Image courtesy of Boise State University. " width="768" height="512" srcset="https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11143804/jodi_cindy_2022.jpg 768w, https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11143804/jodi_cindy_2022-610x407.jpg 610w" sizes="(max-width: 768px) 100vw, 768px" /><figcaption class="wp-caption-text">Researcher Jodi Brandt (l) leads a team studying the landscape re-wetting power of beavers. Image courtesy of Boise State University.</figcaption></figure>
  85. <p>Given that Idaho is an arid state, most of the state’s water comes from snowmelt in the mountains. If that water isn’t slowed down, it speeds through streams and into rivers and soon exits the state. During the warm summer, shallow streams and wetlands often dry up completely.</p>
  86. <p>“Any way to retain more water, or keep it a little longer into the season, is typically beneficial,” Fish and Wildlife’s Mosby says. Slowing down water creates new habitats, like marshlands and flooded pasture, and keeps streams flowing later and deeper into the year. This provides vital habitat and forage for innumerable species, from fish to birds and ungulates. In all, Mosby says, there have been “several hundred” beaver reintroductions in Idaho in the last decade.</p>
  87. <p>Kolarik says they don’t yet have any “exhaustive analyses that could speak to an average effect on mesic vegetation or other broad data driven conclusions” on beavers’ impact in Idaho. What they do have is a number of streams that have been transformed by beavers, he says, pointing to the Yankee Fork, a tributary of the Salmon River, which had been degraded by decades of gold mining. After restoration work was done, beavers returned naturally. Unpublished research by Trout Unlimited found that the beavers in Idaho helped maintain the restoration, increasing vegetation and connecting this part of the river back to the floodplain.</p>
  88. <p>Generally, scientists have explored beavers’ impacts in dryland streams less than in other places. A 2014 <a href="https://onlinelibrary.wiley.com/doi/abs/10.1002/aqc.2432" data-wpel-link="external" target="_blank" rel="external">paper</a> in <em>Aquatic Conservation</em> reported that “surprisingly little is known about the ecology of beaver in dryland streams.”</p>
  89. <figure id="attachment_273148" class="wp-caption aligncenter"><img decoding="async" class="size-full wp-image-273148" src="https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11143327/DJI_0084-copy.jpg" alt="Each beaver dam stores a large amount of water. Image courtesy of Boise State University." width="768" height="512" srcset="https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11143327/DJI_0084-copy.jpg 768w, https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11143327/DJI_0084-copy-610x407.jpg 610w" sizes="(max-width: 768px) 100vw, 768px" /><figcaption class="wp-caption-text">Each beaver dam stores a large amount of water. Image courtesy of Boise State University.</figcaption></figure>
  90. <p>That said, scientists are well aware that beavers boost biodiversity and increase wetlands. For example, <a href="https://link.springer.com/article/10.1007/s00442-002-0929-1" data-wpel-link="external" target="_blank" rel="external">research</a> from the Adirondacks in New York, published in <em>Oecologia</em> in 2002, found that the beaver presence the boosted the diversity of plants by one-third.</p>
  91. <p>Despite this, the U.S. Department of Agriculture&#8217;s Wildlife Services has a long history of killing beavers, which have been deemed to be pests, as their dams can lead to flooding of infrastructure and crops. In 2022, the agency killed 26,731 beavers.</p>
  92. <p>However, experts like Peter Busher say that “Any potential negatives are minor in regard to the ecosystem services the beaver wetlands provide.” A professor and beaver expert at Boston University, who was unconnected to this project, Busher says that “beaver activity may be the most cost-effective method of creating functional wetland systems.”</p>
  93. <p>After decades of recovery, the North American beaver population stands at only around 15 million, from subarctic Canada to northern Mexico. That’s still a long, long way from its pre-European population, but it’s a big comeback.</p>
  94. <figure id="attachment_273153" class="wp-caption aligncenter"><img decoding="async" class="size-medium wp-image-273153" src="https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11145921/Beaver_Yearling_Grooming_Alhambra_Creek_2008-768x512.jpeg" alt width="768" height="512" srcset="https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11145921/Beaver_Yearling_Grooming_Alhambra_Creek_2008-768x512.jpeg 768w, https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11145921/Beaver_Yearling_Grooming_Alhambra_Creek_2008-1200x800.jpeg 1200w, https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11145921/Beaver_Yearling_Grooming_Alhambra_Creek_2008-610x407.jpeg 610w, https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11145921/Beaver_Yearling_Grooming_Alhambra_Creek_2008.jpeg 1210w" sizes="(max-width: 768px) 100vw, 768px" /><figcaption class="wp-caption-text">Young beaver grooming itself. Image courtesy of Cheryl Reynolds via Wikimedia Commons.</figcaption></figure>
  95. <p><strong>Rewilding results seen from space</strong></p>
  96. <p>When NASA joined the project in 2020, it brought new data to initiatives already underway. Schmidt says the project is using the satellite data for two main purposes, the first being to find potential locations for future beaver reintroductions.</p>
  97. <p>“It’s difficult and expensive to get people out on the ground to try and figure out where beavers should go, so satellite imagery gives a comprehensive view of a region, which can tell you if it’s appropriate for beaver,” Schmidt says.</p>
  98. <p>Before reintroducing any animals, Mosby says his department has much to consider. First, they have to determine if the area has enough food and year-round water for beavers, and enough wood for their dams. Then they have to make sure there are no concerns over disease or invasive species that could hamper reintroductions.</p>
  99. <p>If the biological conditions look good, then they have to move on to social questions, including land ownership of the location and surrounding areas, water rights, and whether any introduced beavers might negatively impact crops or infrastructure.</p>
  100. <p>Mosby says views on beavers in Idaho are “are all over the board.” But he notes that many ranchers have come around, as they see the tremendous benefits of having beavers on or near their land, including more water and grazing for their cattle. He says the least tolerant people to beavers are often those living in more developed areas.</p>
  101. <figure id="attachment_273143" class="wp-caption aligncenter"><img decoding="async" class="size-full wp-image-273143" src="https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11141835/apbeaversnatclr_oli2_2022175_hires.jpg" alt="NASA Earth Observatory image reveals re-greening power of beavers. Image courtesy of NASA." width="768" height="512" srcset="https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11141835/apbeaversnatclr_oli2_2022175_hires.jpg 768w, https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11141835/apbeaversnatclr_oli2_2022175_hires-610x407.jpg 610w" sizes="(max-width: 768px) 100vw, 768px" /><figcaption class="wp-caption-text">NASA Earth Observatory image reveals re-greening power of beavers. Image courtesy of NASA.</figcaption></figure>
  102. <p>“Transportation infrastructure and their associated culverts and bridges can be put at risk when beavers begin damming these areas,” Mosby says. “When beavers begin cutting large trees next to popular walking paths or residential and commercial buildings, this becomes a safety concern. Also, these same animals will remove and browse the landscaped vegetation. In these situations, people that have never strongly felt one way or the other often want those beavers removed.”</p>
  103. <p>If a reintroduction gets the go-ahead, Mosby says the department will begin to find animals, capture them, and then move them quickly. After that, it’s really about allowing the beavers to do what they do best: shape the ecosystem.</p>
  104. <p>And that’s where the second role of NASA’s data comes in again. From above the clouds, NASA can track the landscape&#8217;s transformation after beavers arrive, helping researchers understand the pace and nuance of beaver impacts without having to send researchers into remote areas. In addition to the data, NASA also helps with funding as a part of its Research Opportunities in Space and Earth Sciences grants. The program doesn’t cover all costs, but shares costs with the research group.</p>
  105. <p><strong>Furry fire fighters</strong></p>
  106. <p>Beavers are also likely to become more important as the world continues to rapidly heat up due to <a href="https://news.mongabay.com/list/climate-change/" data-wpel-link="internal">climate change</a>.</p>
  107. <p>A <a href="/www.epa.gov/sites/default/files/2016-09/documents/climate-change-id.pdf" data-wpel-link="internal">2016 federal report</a> on how climate change will impact Idaho shows that its vital mountain snowpack was already decreasing, lessening the availability of water in late summer. It also predicted that some streams could see 50% less flow by 2050. The report further predicts that global warming will increase the likelihood of fires, which already burn about 1% of the state annually. Climate change could even push some ecosystems into regime shifts: forests could become grasslands, and grasslands, deserts.</p>
  108. <figure id="attachment_273160" class="wp-caption aligncenter"><img decoding="async" class="wp-image-273160 size-full" src="https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11155354/2016s_Pioneer_Fire_in_the_Boise_National_Forest_42399007595.jpeg" alt="The destructive power of events like the 2016 Pioneer Fire in the Boise National Forest could be lessened by beaver activity. Image by Kari Greer/U.S. Forest Service." width="768" height="512" srcset="https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11155354/2016s_Pioneer_Fire_in_the_Boise_National_Forest_42399007595.jpeg 768w, https://imgs.mongabay.com/wp-content/uploads/sites/20/2023/09/11155354/2016s_Pioneer_Fire_in_the_Boise_National_Forest_42399007595-610x407.jpeg 610w" sizes="(max-width: 768px) 100vw, 768px" /><figcaption class="wp-caption-text">The destructive power of events like the 2016 Pioneer Fire in the Boise National Forest, where naturally dry conditions were exacerbated by a lack of late-summer monsoon rains, could be lessened by beaver activity. Image by Kari Greer/U.S. Forest Service.</figcaption></figure>
  109. <p>Beavers could help mitigate all of these issues. By slowing down the flow of water melting from the snowpack, they could allow streams to stay deeper and last longer, perhaps saving habitat for fish, and vegetation for cattle. They could even mitigate forest fires.</p>
  110. <p>“As our collaborator Joe Wheaton [from Utah State University] likes to say, ‘water doesn&#8217;t burn,’” Kolarik says. “Beavers maintain healthy riverscapes which store carbon and water. Consistent access to water is key to mitigating the effects of climate disturbances like drought.”</p>
  111. <p>Beavers’ role as firefighters has already been documented in Idaho. A 2018 <a href="https://www.researchgate.net/figure/The-Sharps-Fire-burned-approximately-75-of-the-Baugh-Creek-watershed-located-in_fig1_331824980" data-wpel-link="external" target="_blank" rel="external">technical report by Anabranch Solutions</a>, a river restoration company, found that beavers were a major factor in decreasing burn intensity along Baugh Creek during that year’s Sharps Fire.</p>
  112. <p>“Where active beaver dams were present, native riparian vegetation persisted, unburnt,” the authors wrote. In our hotter and fierier world, beavers are a buffer.</p>
  113. <p>“I once heard a rancher use the analogy of sponges when referring to valley bottoms. If we can successfully rewet the sponges, the West will be much more resilient to climate change, and beavers can keep those sponges wet,” Kolarik says.</p>
  114. <p>If the species that was once pushed nearly to extinction can help humanity survive the next tumultuous century, that would be a true, full-circle restoration story.</p>
  115. </article>
  116. <hr>
  117. <footer>
  118. <p>
  119. <a href="/david/" title="Aller à l’accueil"><svg class="icon icon-home">
  120. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-home"></use>
  121. </svg> Accueil</a> •
  122. <a href="/david/log/" title="Accès au flux RSS"><svg class="icon icon-rss2">
  123. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-rss2"></use>
  124. </svg> Suivre</a> •
  125. <a href="http://larlet.com" title="Go to my English profile" data-instant><svg class="icon icon-user-tie">
  126. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-user-tie"></use>
  127. </svg> Pro</a> •
  128. <a href="mailto:david%40larlet.fr" title="Envoyer un courriel"><svg class="icon icon-mail">
  129. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-mail"></use>
  130. </svg> Email</a> •
  131. <abbr class="nowrap" title="Hébergeur : Alwaysdata, 62 rue Tiquetonne 75002 Paris, +33184162340"><svg class="icon icon-hammer2">
  132. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-hammer2"></use>
  133. </svg> Légal</abbr>
  134. </p>
  135. <template id="theme-selector">
  136. <form>
  137. <fieldset>
  138. <legend><svg class="icon icon-brightness-contrast">
  139. <use xlink:href="/static/david/icons2/symbol-defs-2021-12.svg#icon-brightness-contrast"></use>
  140. </svg> Thème</legend>
  141. <label>
  142. <input type="radio" value="auto" name="chosen-color-scheme" checked> Auto
  143. </label>
  144. <label>
  145. <input type="radio" value="dark" name="chosen-color-scheme"> Foncé
  146. </label>
  147. <label>
  148. <input type="radio" value="light" name="chosen-color-scheme"> Clair
  149. </label>
  150. </fieldset>
  151. </form>
  152. </template>
  153. </footer>
  154. <script src="/static/david/js/instantpage-5.1.0.min.js" type="module"></script>
  155. <script>
  156. function loadThemeForm(templateName) {
  157. const themeSelectorTemplate = document.querySelector(templateName)
  158. const form = themeSelectorTemplate.content.firstElementChild
  159. themeSelectorTemplate.replaceWith(form)
  160. form.addEventListener('change', (e) => {
  161. const chosenColorScheme = e.target.value
  162. localStorage.setItem('theme', chosenColorScheme)
  163. toggleTheme(chosenColorScheme)
  164. })
  165. const selectedTheme = localStorage.getItem('theme')
  166. if (selectedTheme && selectedTheme !== 'undefined') {
  167. form.querySelector(`[value="${selectedTheme}"]`).checked = true
  168. }
  169. }
  170. const prefersColorSchemeDark = '(prefers-color-scheme: dark)'
  171. window.addEventListener('load', () => {
  172. let hasDarkRules = false
  173. for (const styleSheet of Array.from(document.styleSheets)) {
  174. let mediaRules = []
  175. for (const cssRule of styleSheet.cssRules) {
  176. if (cssRule.type !== CSSRule.MEDIA_RULE) {
  177. continue
  178. }
  179. // WARNING: Safari does not have/supports `conditionText`.
  180. if (cssRule.conditionText) {
  181. if (cssRule.conditionText !== prefersColorSchemeDark) {
  182. continue
  183. }
  184. } else {
  185. if (cssRule.cssText.startsWith(prefersColorSchemeDark)) {
  186. continue
  187. }
  188. }
  189. mediaRules = mediaRules.concat(Array.from(cssRule.cssRules))
  190. }
  191. // WARNING: do not try to insert a Rule to a styleSheet you are
  192. // currently iterating on, otherwise the browser will be stuck
  193. // in a infinite loop…
  194. for (const mediaRule of mediaRules) {
  195. styleSheet.insertRule(mediaRule.cssText)
  196. hasDarkRules = true
  197. }
  198. }
  199. if (hasDarkRules) {
  200. loadThemeForm('#theme-selector')
  201. }
  202. })
  203. </script>
  204. </body>
  205. </html>