Bug 811164

Summary: editarea does not work properly with IE9
Product: [Fedora] Fedora Reporter: Stephen Herr <sherr>
Component: editareaAssignee: Colin Coe <colin.coe>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: colin.coe
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Windows   
Whiteboard:
Fixed In Version: editarea-0.8.2-5.fc17 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 811167 (view as bug list) Environment:
Last Closed: 2012-04-22 03:41:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 810991, 811167    
Attachments:
Description Flags
Updates to make editarea work well with IE9 none

Description Stephen Herr 2012-04-10 10:17:10 UTC
Description of problem:
The javascript in the editarea RPM does not play nicely with IE9. Selecting text / moving the cursor is flat out broken and the text looks fuzzy. See http://sourceforge.net/tracker/?func=detail&aid=3081703&group_id=164008&atid=829997

Version-Release number of selected component (if applicable):
All

How reproducible:
Every time.

Steps to Reproduce:
1. Make sure that IE9's "document mode" is set to IE9 standards.
2. Attempt to edit text in an editarea window
  
Actual results:
Cursor always moves to the end of the text, you can't select text, text looks fuzzy.

Expected results:
It works as expected

Additional info:
The problem comes because IE9 actually correctly implements something that no other version of IE has correctly implemented. Editarea has some hack in it to do something like:
if ( usingIE ) {
  do some stupid hack to make it work right
}

and the stupid hack actually breaks IE 9. The following updates should fix the issue:

diff -uNr editarea.old/edit_area/edit_area.css editarea/edit_area/edit_area.css
--- editarea.old/edit_area/edit_area.css        2010-01-14 01:56:34.000000000 -0500
+++ editarea/edit_area/edit_area.css    2012-04-09 17:27:12.995918527 -0400
@@ -143,7 +143,7 @@
 }^M
 ^M
 .hidden{^M
-       opacity: 0.2; ^M
+       opacity: 0; ^M
        filter:alpha(opacity=20);^M
 }^M
 ^M
diff -uNr editarea.old/edit_area/manage_area.js editarea/edit_area/manage_area.js
--- editarea.old/edit_area/manage_area.js       2010-01-14 01:56:34.000000000 -0500
+++ editarea/edit_area/manage_area.js   2012-04-09 17:29:33.775855141 -0400
@@ -200,11 +200,14 @@
                return sel;             ^M
        };^M
        ^M
+       // IE < 9 ^M
+       var need_createRange = !("selectionStart" in document.createElement("textarea"));^M
+       ^M
        // set IE position in Firefox mode (textarea.selectionStart and textarea.selectionEnd)^M
        EditArea.prototype.getIESelection= function(){^M
                var selectionStart, selectionEnd, range, stored_range;^M
                ^M
-               if( !this.isIE )^M
+               if( !this.isIE || !need_createRange )^M
                        return false;^M
                        ^M
                // make it work as nowrap mode (easier for range manipulation with lineHeight)^M
@@ -246,7 +249,7 @@
        EditArea.prototype.setIESelection= function(){^M
                var a = this.textarea, nbLineStart, nbLineEnd, range;^M
                ^M
-               if( !this.isIE )^M
+               if( !this.isIE || !need_createRange )^M
                        return false;^M
                ^M
                nbLineStart     = a.value.substr(0, a.selectionStart).split("\n").length - 1;^M

Comment 1 Stephen Herr 2012-04-10 10:19:50 UTC
Created attachment 576438 [details]
Updates to make editarea work well with IE9

Adding proposed patch listed in description.

Comment 2 Fedora Update System 2012-04-10 13:31:30 UTC
editarea-0.8.2-5.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/editarea-0.8.2-5.fc16

Comment 3 Fedora Update System 2012-04-10 13:32:28 UTC
editarea-0.8.2-5.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/editarea-0.8.2-5.fc17

Comment 4 Fedora Update System 2012-04-10 20:21:24 UTC
Package editarea-0.8.2-5.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing editarea-0.8.2-5.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-5614/editarea-0.8.2-5.fc17
then log in and leave karma (feedback).

Comment 5 Stephen Herr 2012-04-11 13:48:12 UTC
I don't have a Windows machine to test on normally, but I might be able to take a look tomorrow.

Comment 6 Stephen Herr 2012-04-12 18:21:43 UTC
Looks good. I verified the Fedora 16 version, but I don't suppose it makes much difference.

Comment 7 Fedora Update System 2012-04-22 03:41:51 UTC
editarea-0.8.2-5.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2012-04-22 04:20:27 UTC
editarea-0.8.2-5.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.