Comments (2)
Chrome seems to be able to parse HTML like this correctly.
You seem to be mistaken. I find HtmlAgility's parsing behavior in this case to broadly match the parsing behavior of browsers like Chrome and Firefox.
Chrome 118.0.5993.118 behavior is equivalent to what you observed with HtmlAgilityPack. Loading your example HTML into Chrome yields this result:
Note how the part of the intended Javascript code after the first occurence of </script>
is treated as text content for the HTML body, more or less like HAP does (there might or might not be differences in how the browsers and HAP handle the "stray" secondary </script>
closing element, but that's not really relevant regarding the point i am making here).
Firefox 118.0.2 behaves in the same manner as Chrome and HtmlAgilityPack:
Also, in case you aren't already aware of it, worth of note in this context are also the restrictions the HTML standard places on the content of script elements: https://html.spec.whatwg.org/multipage/scripting.html#restrictions-for-contents-of-script-elements
P.S.: I am just a user and not associated with the HAP project nor its authors/maintainers.
from html-agility-pack.
Hello @shravan2x ,
Let me know if the answer from @elgonzo is good.
I tested it also on Firefox and got the same behavior as him and HAP
.
Best Regards,
Jon
from html-agility-pack.
Related Issues (20)
- (2) The html rendering result is different from the html output result HOT 4
- Can't find a node with a long id HOT 1
- it happened again after a Rolled back to version HtmlAgilityPack 1.11.50, then again to HtmlAgilityPack 1.11.57 and it worked. HOT 2
- Can't find a node used HtmlAgilityPack 1.11.57 HOT 2
- How to make the DocumentNode.SelectNodes(XPath) for both text and img content together in the correct sequence? HOT 3
- ??? HOT 2
- Double <p> <p> open tags leave one <p> open even with option setted HOT 6
- The html rendering result is different from the html output result when we have two unclosed tbody tags HOT 2
- When we have a closing tag before the current open tag is closed we have different results between HAP and Chrome rendering
- The formatting is a bit interesting HOT 1
- Set PackageLicenseExpression on nuget HOT 5
- page source code HOT 19
- [HtmlAgilityPack version 1.11.60] request: add HtmlWeb Load() exception HOT 5
- bug: SelectSingleNode not returning anything HOT 7
- Modify a `#text` node name causes a `StackOverflowException` HOT 2
- Memory leak? Or is it just my code? HOT 1
- System.Net.Http 4.3.3 vulnerability HOT 5
- Is is possible to update just the attribute value but leave the rest html unchanged? HOT 2
- Creating empty value for attributte HOT 8
- Inconsistency between `node.OuterHtml`, `node.EndNode.OuterHtml`, and `node.Closed` HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html-agility-pack.