After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 795390 - HTML parsing gets confused inside a <script> tag with nested <elements>
HTML parsing gets confused inside a <script> tag with nested <elements>
Status: RESOLVED OBSOLETE
Product: libxml2
Classification: Platform
Component: htmlparser
git master
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2018-04-20 05:00 UTC by Phlip
Modified: 2021-07-05 13:22 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Phlip 2018-04-20 05:00:25 UTC
To reproduce the bug, write these lines to the file lintMe.html:

<script>
  let buttonDelete = $(`<a class="icon icon-del" href="#"></a>`);
</script>

Now lint them with libxml2-2.9.8:

./xmllint --html lintMe.html 
lintMe.html:2: HTML parser error : Unexpected end tag : a
  let buttonDelete = $(`<a class="icon icon-del" href="#"></a>`);
                                                              ^

The parser scanned the JavaScript strings as if they were HTML elements, but did not recognize that they were at least balanced.

While this bug is not earth-shattering, it is indeed preventing me from using Nokogiri to write a Ruby assertion, assert_html, that verifies a string contains valid HTML.
Comment 1 GNOME Infrastructure Team 2021-07-05 13:22:46 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/libxml2/-/issues/

Thank you for your understanding and your help.