question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Please support self close script

See original GitHub issue

Bug Report

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version of AngleSharp?
  • Did you check the FAQs to see if that helps you?
  • Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g., AngleSharp.Css for CSS support)
  • Did you perform a search in the issues?

For more information, see the CONTRIBUTING guide.

Description

Please support some self close tag such as script and title. I know that is nonstandard writing. But there are quite a lot of things like that in the Internet and most of modern browsers (Firefox, Chrome, MSIE) can parse that.

Steps to Reproduce

<del>
  1. run code
    //Create a new context for evaluating webpages with the default config
    var context = BrowsingContext.New(Configuration.Default);

    //Create a document from a virtual request / response pattern
    var document = await context.OpenAsync(req => req.Content("<script/><ul><li>First item<li>Second item<li class='blue'>Third item!<li class='blue red'>Last item!</ul>"));

    //Do something with LINQ
    var blueListItemsLinq = document.All.Where(m => m.LocalName == "li" && m.ClassList.Contains("blue"));
</del>

Expected behavior: get the blueListItemsLinq Actual behavior: blueListItemsLinq’s count is 0

Possible Solution

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
FlorianRapplcommented, Jun 17, 2020

One last remark @yinyue200 - just that I closed this issue (bug) does not mean I am opposed to having XHTML support (as a feature) in there. Maybe AngleSharp.Xml can have / provide support for this?

I would love to see support for scenarios such as the outlined one. I am right now not sure if it already works out of the box (e.g., when incl. AngleSharp.Xml with WithXml() in the config) [I guess it does not], but it should (i.e., would be ideal to) just work.

1reaction
FlorianRapplcommented, Jun 17, 2020

@yinyue200 This is a different element (your OP used the standard script element).

That is not the script element from HTML, but an XHTML element. AngleSharp does not support the XHTML DTO.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML Script tag self closing?
Can script tags in HTML be closed by simply using: <script src="https://abc.js"/>. Or do I have to close this script tag like so:....
Read more >
Why don't self-closing script elements work
In summary, self-closing script elements do not work in HTML because the browser does not know where the script ends and will not...
Read more >
Why don t self-closing script elements work - Edureka
Hello @kartik,. That's because SCRIPT TAG is not a VOID ELEMENT. In an HTML Document - VOID ELEMENTS do not need a "closing...
Read more >
Cannot use self-closing <style /> or <script /> tags #196
I try to run format svelte files but have an error. [error] lobby\Armory.svelte: Expected > [error] > 1 | <style type="text/scss" src=".
Read more >
How to close script? - Ask for Help
I need to close script when it fnished its work. The script I use reconnects my ... Maybe I don't need bat file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found