Closed Bug 692412 Opened 13 years ago Closed 13 years ago

Firefox 10.0a1 Nightly not recognizing the replace() javascript method (typeof document.getSelection() == object)

Categories

(Core :: General, defect)

7 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: srazzano, Unassigned)

References

Details

(Keywords: regression, testcase)

Attachments

(1 file)

253 bytes, text/html
Details
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
Build ID: 20110928134238

Steps to reproduce:

String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g, "");
 }


Actual results:

Nothing


Expected results:

Trim leading and trailing spaces.
Hardware: x86_64 → x86
Hardware: x86 → x86_64
Mozilla/5.0 (Windows NT 5.1; rv:10.0a1) Gecko/20111006 Firefox/10.0a1
This works for me:
" TEST ".replace(/^\s+|\s+$/g, "")
" TEST ".replace(/^\s+|\s+$/g, "") works here as well but this does not:

window.addEventListener('mouseup', getMe, false);
function getMe() {
  var getText = document.getSelection();
  alert(getText);
  alert(getText.replace(/^\s+|\s+$/g, ""));
}
Keywords: regression, testcase
Product: Firefox → Core
QA Contact: general → general
Summary: Firefox 10.0a1 Nightly not recognizing the replace() javascript method → Firefox 10.0a1 Nightly not recognizing the replace() javascript method (typeof document.getSelection() == object)
Attached file testcase
document.getSelection() returns "object" in Nightly 10 instead of "string"
This is intended, see bug 636512
Blocks: 636512
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
Workaround:
 var getText = document.getSelection().toString();
or something
Yes, toString() is the ticket. Thank you.
Thanks, j.j.!
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: