How to get text from element without whitespace normalization and trimmed
dhanrajbhandari opened this issue ยท 3 comments
dhanrajbhandari commented
Currently, element.text() method gives trimmed and whitespace normalised text.
Any other way to get element text without trimmed and whitespace normalised?
thanhdiqit commented
Look like in my case. I have filtered TextNode and get original text
node.children()
.filter {
$0.hasText()
}
.compactMap {
print("๐๐๐")
print($0.ownText())
}
aehlke commented
@thanhdiqit good except delete hasText()
as this reintroduces the behavior OP doesn't want (check the source code - it will exclude whitespace text nodes)
bozek-lu commented
Is there any option to disable trimming whitespaces?