Internet explorer 11 window.getSelection().toString() will display inline JavaScript as part of the text node

Fixed Issue #989382


Oct 24, 2014
This issue is public.
Reported by 0 people

Sign in to watch or report this issue.

Steps to reproduce


Repro Steps:

You need to have a body of text with one or multiple javascript tags intermingled which have some code in them, not the ones that reference a url. Have a JS that gets the selection and displays it somehow. Select the text make sure to get one of the script tags with your selection, although it’s invisible and see the results.

See this fiddle for a working example and select some text from both paragraphs at the same time:

Expected Results:

Only return visible text in the selection.

Please note that all browsers behave the “wrong” way (like Internet Explorer) if before .toString() you also .getRangeAt(0) on the selection but return proper visible text only when directly converting the selection object to string.

Actual Results:

Dev Channel specific:



0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Tony S.”

      Changed Assigned To to “Travis L.”

      Changed Assigned To from “Travis L.” to “Eugene V.”

      Changed Status to “Confirmed”

      Changed Status from “Confirmed” to “Won’t fix”

      Changed Assigned To from “Eugene V.” to “Louis S.”

      Changed Status from “Won’t fix” to “Fixed”

    You need to sign in to your Microsoft account to add a comment.

    Sign in