[wp-trac] [WordPress Trac] #19528: HTML editor link quicktag not working in IE9

WordPress Trac wp-trac at lists.automattic.com
Mon Feb 27 08:23:32 UTC 2012


#19528: HTML editor link quicktag not working in IE9
------------------------------------+------------------------------
 Reporter:  JohnP                   |       Owner:
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Editor                  |     Version:  3.2
 Severity:  major                   |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+------------------------------
Changes (by solarissmoke):

 * keywords:  needs-patch => has-patch dev-feedback


Comment:

 Tracked this down to the following code in `wplink.dev.js`:

 {{{
 if ( typeof textarea.selectionStart !== 'undefined' ) {
         start       = textarea.selectionStart;
         end         = textarea.selectionEnd;
         selection   = textarea.value.substring( start, end );
 }}}

 This was originally designed to bypass IE which didn't support
 `selectionStart`/`selectionEnd`. However IE9 does. Problem is it sets both
 attributes to 0 when the textarea loses focus, which is what causes the
 behaviour described above.

 Attached a patch that fixes this by storing the selection information
 **before** the textarea loses focus. This seems to me a better approach
 generally, as from what I can see the HTML5 spec doesn't explicitly say
 what should happen to selection data when focus is lost, so IE9 is not
 necessarily wrong in how it handles it.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19528#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list