Bug 848660 - Fix Gaia selector. r=fabrice, a=leo+
authorYuan Xulei <xyuan@mozilla.com>
Fri, 08 Mar 2013 23:14:16 -0500
changeset 118708 a56593f84577
parent 118707 0cdbed626f6d
child 118709 29c8694183c1
push id539
push userryanvm@gmail.com
push date2013-03-11 16:48 +0000
reviewersfabrice, leo
bugs848660
milestone18.0
Bug 848660 - Fix Gaia selector. r=fabrice, a=leo+
b2g/chrome/content/forms.js
--- a/b2g/chrome/content/forms.js
+++ b/b2g/chrome/content/forms.js
@@ -588,17 +588,17 @@ function getContentEditableText(element)
 function getSelectionRange(element) {
   let start = 0;
   let end = 0;
   if (element instanceof HTMLInputElement ||
       element instanceof HTMLTextAreaElement) {
     // Get the selection range of <input> and <textarea> elements
     start = element.selectionStart;
     end = element.selectionEnd;
-  } else {
+  } else if (isContentEditable(element)){
     // Get the selection range of contenteditable elements
     let win = element.ownerDocument.defaultView;
     let sel = win.getSelection();
 
     let range = win.document.createRange();
     range.setStart(element, 0);
     range.setEnd(sel.anchorNode, sel.anchorOffset);
     let encoder = FormAssistant.documentEncoder;