Bug 848660 - Fix Gaia selector. r=fabrice
authorYuan Xulei <xyuan@mozilla.com>
Fri, 08 Mar 2013 23:14:16 -0500
changeset 124292 be905015b2535382160108b99f6b7a49595cd855
parent 124291 48c7bf114f1d2ae23e315334f8dbc7131feaa6fb
child 124293 edf62f27b3c00105179e4759adb0fb591b1924f9
push id24332
push userryanvm@gmail.com
push dateSat, 09 Mar 2013 04:15:25 +0000
treeherdermozilla-inbound@edf62f27b3c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs848660
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 848660 - Fix Gaia selector. r=fabrice
b2g/chrome/content/forms.js
--- a/b2g/chrome/content/forms.js
+++ b/b2g/chrome/content/forms.js
@@ -589,17 +589,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;