Selectors dialog garbles css style with comments

Summary:

Opening CSS dialog breaks styling if the document has CSS style with comments.

Steps to reproduce:

  • open Inkscape, make sure CSS dialog is closed
  • open attached minimal file
  • Open CSS dialog

What happened?

Rectangle turned grey, and the style element changes from

/* comment */
 #rect1 { 
    fill:#d3a4d3;
}

to

.comment { fill:#d3a4d3; }

What should have happened?

No such changes, rectangle should have remained pink

Sample attachments:

css_mini_example.svg

Version info

Inkscape 1.4-beta3 (01c8a1ca8f, 2024-08-28, custom)

                      Compile  (Run)
    GLib version:     2.80.3
    GTK version:      3.24.43 (3.24.43)
    glibmm version:   2.66.7
    gtkmm version:    3.24.9
    libxml2 version:  2.12.8
    libxslt version:  1.1.42
    Cairo version:    1.18.0 (1.18.0)
    Pango version:    1.54.0 (1.54.0)
    HarfBuzz version: 8.5.0 (8.5.0)

    OS version:       Fedora Linux 40 (Workstation Edition)