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

VERIFIED INVALID

Status

()

defect
VERIFIED INVALID
8 years ago
8 years ago

People

(Reporter: srazzano, Unassigned)

Tracking

({regression, testcase})

7 Branch
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

253 bytes, text/html
Details
(Reporter)

Description

8 years ago
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.
(Reporter)

Updated

8 years ago
Hardware: x86_64 → x86
(Reporter)

Updated

8 years ago
Hardware: x86 → x86_64

Comment 1

8 years ago
Mozilla/5.0 (Windows NT 5.1; rv:10.0a1) Gecko/20111006 Firefox/10.0a1
This works for me:
" TEST ".replace(/^\s+|\s+$/g, "")
(Reporter)

Comment 2

8 years ago
" 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, ""));
}

Updated

8 years ago
Component: General → General
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)

Comment 3

8 years ago
Posted file testcase
document.getSelection() returns "object" in Nightly 10 instead of "string"

Comment 4

8 years ago
This is intended, see bug 636512
Blocks: 636512
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → INVALID

Comment 5

8 years ago
Workaround:
 var getText = document.getSelection().toString();
or something
(Reporter)

Comment 6

8 years ago
Yes, toString() is the ticket. Thank you.
Thanks, j.j.!
Status: RESOLVED → VERIFIED

Updated

8 years ago
Duplicate of this bug: 690997
You need to log in before you can comment on or make changes to this bug.