Please support self close script
See original GitHub issueBug 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>- 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:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
withWithXml()
in the config) [I guess it does not], but it should (i.e., would be ideal to) just work.@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.