I am building Chrome extension which at some point should determine current page language. In order to do that, my plan is to extract text content of the page (or at least a part of it) and pass it to translation api. However I couldn't find any strait forward way to just get all textNode
s of the document.
There is a backup plan which is to recursively analyze $('body').contents()
until there is enough text content, but it feels a bit flaky. Perhaps there is a better way?
Note: Chrome extensions api allows your script to access user page dom as if it was the part of it.