Replies: 1 comment
-
Hi :) Maybe you could make use of the direct-children selector Besides that, I guess until you're running into performance issues, traversing the children of every node shouldn't be a problem. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm building a tool which needs to behave similar to what window.getSelected() would do except that I want to grab all of the text of any elements in which the selection has partially covered it.
For example this select would get me the string including the text of that full paragraph and not only the highlighted portion:
I'm using this library to get the elements and then running a textContent over it and I've found that using intersect center works quite well except I was hoping to be able to set some sort of selector such that my selected array only includes the highest level element. As it is now, I'm able to select sibling elements but if they have children for a bolded portion of the paragraph then those elements are also included which I don't want.
Is there a better way of doing this besides just traversing the children of every node and checking it against all other nodes for overlap?
Thanks in advanced!
Awesome library, Simon!
Beta Was this translation helpful? Give feedback.
All reactions