Open
Bug 787305
Opened 13 years ago
Updated 3 years ago
nslSelection.collapse causes error when contenteditable container not active
Categories
(Core :: DOM: Selection, defect, P5)
Tracking
()
UNCONFIRMED
People
(Reporter: testing9999, Unassigned)
Details
(Keywords: testcase)
Attachments
(2 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.82 Safari/537.1
Steps to reproduce:
Open the following page in FF, click on the contentEditable div, press a key, and wait two seconds.
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script>
$(function() {
var r;
$("#mydiv").keypress(function() {
r = document.getSelection().getRangeAt(0);
$("#mytext").focus();
setTimeout(function() {
var sel = window.getSelection();
var div = $("#mydiv")[0];
var c = r.endContainer;
var o = r.endOffset;
// Uncomment this line to fix the error
//$("#mydiv")[0].focus();
if (r.collapsed) {
sel.collapse(c, o);
}
$("#mydiv")[0].focus();
}, 2000);
});
});
</script>
</head>
<body>
<div contenteditable="true" id="mydiv" style="border: 1px solid black; width: 200px;">
<br/>
</div>
<input type="text" id="mytext"></input>
</body>
</html>
Actual results:
NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISelection.collapse]
[Break On This Error]
sel.collapse(c, o);
Expected results:
No errors. Note that if the line to focus the div is uncommented, then the error doesn't happen.
Reporter | ||
Updated•13 years ago
|
Hardware: x86 → x86_64
Reporter | ||
Comment 1•13 years ago
|
||
The error is copied from Firebug console ("[break on this error]" was from the button beside the error).
(I am trying to attach a screenshot, but can't seem to be able to do so when adding this comment?)
Reporter | ||
Comment 2•13 years ago
|
||
Attachment #657131 -
Attachment mime type: text/plain → text/html
![]() |
||
Comment 3•13 years ago
|
||
Reproduced with:
Fx 15.0: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0 20120824154833
Nightly: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/18.0 Firefox/18.0 20120903030551
Comment 4•11 years ago
|
||
bug 773137 has similar symptoms.
Comment 5•7 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046
Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.
If you have questions, please contact :mdaly.
Priority: -- → P5
Updated•7 years ago
|
Component: DOM → Selection
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•