cnumr / GreenIT-Analysis

GreenIT-Analysis
GNU Affero General Public License v3.0
147 stars 32 forks source link

#Issue 34 : Ignore SVG stylesheets in the inline stylesheet count #35

Closed m3uusi closed 2 years ago

m3uusi commented 2 years ago

Bonjour,

Ce commit vient corriger le comptage soumis dans l'issue https://github.com/cnumr/GreenIT-Analysis/issues/34 en se basant sur le type du parent de la feuille de style.

Cordialement,

m3uusi commented 2 years ago

Template HTML testé :

<!doctype html>
<html>
  <head>
    <title>This is the title of the webpage!</title>
  </head>
  <body>
  <style>#Inline stylesheet</style>
  <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg">
  <style>
    circle {
      fill: gold;
      stroke: maroon;
      stroke-width: 2px;
    }
  </style>

  <circle cx="5" cy="5" r="4"></circle>
</svg>
<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg">
  <style>
    circle {
      fill: gold;
      stroke: maroon;
      stroke-width: 2px;
    }
  </style>

  <circle cx="5" cy="5" r="4"></circle>
</svg>
<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg">
  <style>
    circle {
      fill: gold;
      stroke: maroon;
      stroke-width: 2px;
    }
  </style>

  <circle cx="5" cy="5" r="4"></circle>
</svg>
  </body>
</html>

Affiche bien 1 feuille de style inline au lieu de 4.