iabudiab / HTMLKit

An Objective-C framework for your everyday HTML needs.
MIT License
240 stars 27 forks source link

[FR] Add support for innerText #39

Closed dsanghan closed 5 years ago

dsanghan commented 5 years ago

Would be great if we could get support for https://www.w3schools.com/jsref/prop_node_innertext.asp

Example html: nbsp.zip

Text Content shows nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ nbsp;‌ on a hidden div.

Inner Text is much cleaner:

Introducing you to:
 JLL IDEAs
 PropTech Challenge

 
Hi,

JLL IDEAs - A PropTech Innovation Challenge in partnership with AGNIi and Startup India is inviting applications for exciting technologies, ideas, products and tools which have a use case in Real Estate in areas like Sustainability, Smart Buildings, Real Estate Valuation, Occupancy and Space Planning, Transport/Urban mobility, asset management etc.

Top 3 Winners -
- Cash awards up to INR 25 Lacs

Top 10 winners -
- Co-working space for 1 year
- Opportunity to get business orders from JLL, our partners and clients
- Access to mentorship from top Real Estate experts

Last Date: Extended till 30th September 2019

Good luck!

Team - Startup India
Apply Now

You received this email because you subscribed to our list. You can unsubscribe at any time.
iabudiab commented 5 years ago

@dsanghan Hey there, unfortunately I don't think that there is a way to add inneText to HTMLKit without introducing a CSS-capable rendering engine.

You see, this attribute works the way you want it to only when combined with a user agent that interprets CSS and know which elements are rendered and which are not.

According to the spec innerText behaves the same way as textContent for non-CSS user agents, which HTMLKit is.

I'll close this, since it is out of scope for HTMLKit. However, please feel free to reopen if you have any suggestions/ideas to make this work.