Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snapshot: currently visible elements #20

Open
johanneskiesel opened this issue Apr 8, 2022 · 4 comments
Open

snapshot: currently visible elements #20

johanneskiesel opened this issue Apr 8, 2022 · 4 comments

Comments

@johanneskiesel
Copy link
Member

No description provided.

@johanneskiesel
Copy link
Member Author

Probably as configuration option to the node snapshot. Possibility to turn everything off except the xpath.

@johanneskiesel
Copy link
Member Author

Probably it makes sense to add a numeric value of how much of the element is visible on screen.

But I'm not sure anymore whether such an option makes sense. Straightforward things I come up with can actually be done afterwards based on the information already provided in the snapshot, so that would be rather a downstream feature.

There seems to be a way to get "all text currently visible" using Ranges... but that would likely require a rather sophisticated algorithm that works line-based (or we assume that there is no horizontal scrolling... even then this is not straightforward).

@johanneskiesel
Copy link
Member Author

Ok, probably getting currently visible text works by using ranges and considering all text nodes. Things will get a bit simpler once caretRangeFromPoint or caretPositionFromPoint are no longer experimental. Before that, one can still try and test by creating ranges (and using setStart / setEnd) and checking with getBoundingClientRect (also experimental, but it seems widely supported)... maybe also getClientRects, but that seems to work on Elements, not nodes?!

@johanneskiesel
Copy link
Member Author

Of course, one could just make a range for each character of a page and store that (character, position, font, font size, color, node XPath, node offset, ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant