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

Suitability for document objects #463

Open
pickle-weasle opened this issue Jan 23, 2020 · 1 comment
Open

Suitability for document objects #463

pickle-weasle opened this issue Jan 23, 2020 · 1 comment

Comments

@pickle-weasle
Copy link

Hi there, I was looking for a library that would allow me to identify html ranges based off index in the plaintext, and Rangy looked like a good fit.

Unfortunately I need to use it on html that is not currently rendered, and I'm not sure that's supported. When trying to implement a proof of concept that used a Document object that I created (rather than the current document or a document in an iframe or other window) I ran into issues where Rangy was trying to get info on the window, to determine computedStyles for elements , I think.

This caused an error
ERROR TypeError: "getWindow(...) is null"
which occurs in this file
after running moveStart method.

I can't seem to find others who've encountered the same issue and wonder if I'm missing something or if there may be another tool that will allow me to do something like the following:
Give me the range within this Document/document-fragment Object that contains the text that starts X characters in (not including HTML tags etc, just plain text) and ends Y characters in.

It looks to me that Rangy could accomplish this using the textModules moveStart and moveEnd methods.. if they'd only work on DocumentObjects and not require access to the window.

If I've got something wrong, or if this doesn't quite constitute an issue, my apologies! not sure where else to ask the question
Would love to hear any suggestions
Thanks!

@MimmyJau
Copy link

@pickle-weasle I have a similar issue. I get the error when running .restoreCharacterRanges() also from the Text Range module.

Did you ever find a workaround?

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

2 participants