Comments (3)
I think childNodes
is a good idea. NSOrderedSet
isn't a very common collection so the weirdness with the array
property isn't obvious, and I doubt you're the first person to hesitate when looking for an array of child nodes.
I'll keep this issue open while pondering and then probably adding childNodes
.
from htmlreader.
Hello! I’m not sure I understand 100% so forgive me if I'm off base here.
I think you reached for childElementNodes
because you needed an NSArray
but had an NSOrderedSet
. What you ended up doing is exactly right: ask the ordered set for its contents as an array. (Happily this is cheap; if I recall correctly, the array you get back just proxies the ordered set, there’s no copying going on.)
childElementNodes
does filter out out non-element nodes such as text nodes, and is tended as a convenience property for that (presumably) common need. Do you find that children
does not include text nodes? Because it absolutely should. HTMLTextNode
is a subclass of HTMLNode
so the declared types don’t indicate any kind of filtering here.
I’m always happy to fix any documentation that’s not doing its job. Once we sort this out I’ll do another pass and see if I can clear things up!
from htmlreader.
My main issue with childElementNodes
is that it doesn't have a variant that returns text nodes, but I suppose children
is a valid substitute for what I'm trying to achieve. I guess I was just expecting there would be something like a childNodes
property that would be like childElementNodes
except with all nodes, but then it would be a bit redundant when children
exists.
from htmlreader.
Related Issues (20)
- Elements after self-closing tag will be added as child of previous tag HOT 1
- Does not work with latest SPM HOT 3
- Can't upload to Itunes bacause of "No CFBundleVersion " HOT 6
- Build issues with Xcode 8.3 HOT 3
- Class name prefix? HOT 7
- Carthage Xcode 9 beta build fail HOT 2
- Xcode 9 build errors HOT 2
- Could HTMLReader detect the page dismiss? HOT 2
- Xcode 9.3 build errors HOT 2
- values of type 'NSUInteger' should not be used as format arguments HOT 1
- "Duplicate symbol" linker error with TapjoySDK HOT 2
- Crash in CFStringGetCharactersPtr HOT 1
- Xcode 11 build errors HOT 4
- Combining certain selectors doesn't work HOT 1
- How to save a web page as an html file, including pictures? HOT 5
- Can jsoup support HOT 3
- Unable to clone project because of deprecated git protocol for submodule
- documentation missing HOT 10
- Crash within runAdoptionAgencyAlgorithmForTagName 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 htmlreader.