Comments (3)
It seems the behavior was broken in this commit 9170b1d where cssSelectorComponent
isn't executed for element of instance Document
where previously it was.
cssSelectorComponent
contains the line
@jhy was there any reason behind that?
from jsoup.
@jhy was there any reason behind that?
Yes, as noted in the comment if you're getting a selector for an element it is going to descend from html
and so it doesn't need the #root
selector. And the #root
nodename is not really documented, or supported outside of jsoup. I felt it was wrong to be leaking in to the selector.
Can you tell me more about your use case - what do need a Document selector generated from a Document for?
Perhaps we could change the cssSelector method to return #root
if it's called on a Document directly, or there's no other contents to the selector.
from jsoup.
Also - returning #root
is just wrong as it won't match anything - it would look for elements with an ID of root
, which won't match.
So I'm confused that you're hitting an issue here; would be great to get some more details.
from jsoup.
Related Issues (20)
- Parsing a part of an html string HOT 2
- Minor performance optimizations HOT 2
- Problems with Elements class array methods updating the DOM
- Force JSoup to ignore custom HTML tags HOT 2
- Empty HTML tags are not removed by .text()
- text() is missing a separator space between <button> text nodes HOT 1
- Negative source range start/end positions for first text node HOT 1
- Some html tags didn't support by Jsoup? HOT 1
- [API] [Question] Why is StructuralEvaluator not public?
- bash: syntax error near unexpected token HOT 1
- Fatal Exception: java.lang.NoSuchMethodError: No static method withInitial HOT 2
- 9dec1 HOT 1
- Missing class when building release on Android in 1.17.2
- :empty selector bug [1.17.2]
- nested :has() selector not working [v1.17.2]
- org.jsoup.nodes.Node; HOT 1
- Bugs HOT 1
- Element HOT 1
- Parsing error
- :has doesn't work with sibling combiner
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 jsoup.