Comments (3)
Hello @pycxu ,
I would recommend you create your own extension methods. So your could use it this way:
node.GetAttributeValue("style", "").GetComputedStyle("left");
You pretty much already have the code you want for this method.
I do not believe at this moment we will add it on our side.
Best Regards,
Jon
Sponsorship
Help us improve this library
Performance Libraries
context.BulkInsert(list, options => options.BatchSize = 1000);
Entity Framework Extensions • Dapper Plus
Runtime Evaluation
Eval.Execute("x + y", new {x = 1, y = 2}); // return 3
C# Eval Function
from html-agility-pack.
Just an FYI: Using the function name GetComputedStyle
here is likely misleading. Getting a computed style properly is not simply done by parsing the source HTML document and extracting the style values from the "style" attribute. To get actual computed styles would require more or less a layout engine plus possibly a Javascript engine, something that is well beyond a "simple" HTML parser.
If you would really need computed style properties of an element in your HTML document (emphasis on "computed"), the best approach would be probably using a head-less browser engine, something like CEF (for which there is also a .NET wrapper: CefSharp)
from html-agility-pack.
Just an FYI: Using the function name
GetComputedStyle
here is likely misleading. Getting a computed style properly is not simply done by parsing the source HTML document and extracting the style values from the "style" attribute. To get actual computed styles would require more or less a layout engine plus possibly a Javascript engine, something that is well beyond a "simple" HTML parser.If you would really need computed style properties of an element in your HTML document (emphasis on "computed"), the best approach would be probably using a head-less browser engine, something like CEF (for which there is also a .NET wrapper: CefSharp)
Thanks for the heads up. That makes so much sense. I will do that with Puppeteer Sharp.
from html-agility-pack.
Related Issues (20)
- update System.Net.Http to 4.3.4 HOT 2
- The html rendering result is different from the html output result HOT 5
- The html rendering result is different from the html output result when tbody is added inside unclosed th HOT 3
- After applying HAP1.11.57, InnerText cannot be obtained correctly. HOT 11
- (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
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.