Home Dashboard Directory Help
Search

window.getSelection and document.selection legacy support by IECustomizer


Status: 

Closed
 as By Design Help for as By Design


Type: Bug
ID: 795325
Opened: 7/29/2013 8:07:12 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description


document.selection support was removed in IE10 and replaced with window.getSelection.

This is incorrect and document.selection should be continued to be supported for legacy markup and script that render in a 'standards' or IE10 Quirks document mode.

similarly this was done for addEventListener and attachEvent.

Cross interoperable applications should feature detect I/o browser sniff.
if (window.getSelection) { // all browsers, except IE before version 9
    var selectionRange = window.getSelection();                                        
    return selectionRange.toString ());
}
else {
    if (document.selection.type == 'None') {
        alert ("No content is selected, or the selected content is not available!");
    }
    else {
        var textRange = document.selection.createRange ();
        return textRange.text;
    }
}
Details
Sign in to post a comment.
Posted by Christian Stockwell [MSFT] on 9/3/2013 at 7:42 PM
Thank you for your feedback. This is actually an intentional choice. In general, when a standards-compliant or interoperable API is available to replace proprietary behavior, we prefer to remove support for that legacy behavior in our most recent standard mode. We preserved attachEvent in previous releases of IE only because at that time it was necessary to preserve compatibility for some sites. In IE11, we even removed support for attachEvent in our Edge document mode.

What you propose would yield diminishing returns over time as developers move to more appropriate APIs and would continue to hamper the IE team's ability to provide meaningful value in our most compliant document modes. Instead, we've opted to preserve that old functionality where necessary in older document modes, which developers can use while they plan to move to more modern functionality.
Posted by Microsoft on 8/1/2013 at 12:39 PM
Thank you for your feedback.

We are currently unable to reproduce this issue as described.


We value your feedback. If you have additional information that can help us recreate this issue — such as a specific url, more detailed steps, test results from different machines, or additional conditions — please reactivate the bug or submit a new bug with more details on how to reproduce the issue. You can also read the guidelines at https://connect.microsoft.com/IE/content/content.aspx?ContentID=16254 regarding filing a good bug report.

Best regards,

The Internet Explorer Team
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
CreateRangeErr.png 7/30/2013 127 KB