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
window.getSelection().toString()
returns [object Selection]
not the selected text
#319
Comments
will have a look - thanks for the report |
it will be a great help if you can provide some test cases for different selections see com.gargoylesoftware.htmlunit.javascript.host.dom.SelectionTest |
Yes this is clearly a bug, but i fear it will be not that simple to provide a correct selection implementation. Can you please tell me a bit more about your use case - what do you like to do with the selected text, what kind of selections you are doing? |
The implicit conversion was already working, now toString() produces the same result. |
As always will inform on twitter if a new snapshot is available. Many thanks for the report. |
Sorry, for coming back to you just now. I used it for checking whether the user had selected some text in an Thanks a lot for your help! |
Thanks for the feedback, the current snapshot impl. has a fix for the toString() method that should do the job for your case. BTW: i found two more classes with the same error - thanks again for using HtmlUnit and the error report. |
According to MDN
window.getSelection().toString()
is supposed to return the text the user selected.I am using this by checking that the selection is empty that the user is actually clicking and not selecting text.
The problem is that when running in HtmlUnit this method is always returning
[object Selection]
and not the selected text.The text was updated successfully, but these errors were encountered: