using window.find fails to find multiple matches in textarea



15 years ago
11 years ago


(Reporter: smacvicar, Unassigned)


Windows XP

Firefox Tracking Flags

(Not tracked)



(1 attachment, 1 obsolete attachment)

508 bytes, text/html


15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a3) Gecko/20040822
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a3) Gecko/20040822

The use of window.find fails to find multiple values in a textarea where using
Find in page from the Edit menu will.

See attached testcase.

Push button, the first entry of foo will be highlighted. Pressing multiple times
wont match the following entries. Using ctrl+f and searching for foo will find
all 3 entries.

Reproducible: Always
Steps to Reproduce:

Comment 1

15 years ago
Created attachment 156805 [details]

Comment 2

15 years ago
Can you make it to work in IE?

I have debugged your testcase. What is happening in Mozilla is this: when you
click the button, it clears the selection -- this is reminiscent to what happens
when you click on the content window, any current selection is cleared on the
window. Therefore, the same (first) match is re-found again.


15 years ago
Attachment #156805 - Attachment is obsolete: true

Comment 3

15 years ago
Created attachment 156858 [details]
better testcase

better testcase.

the three instances of foo outside the textarea will be found with each button
press, it then hits the textarea and finds the first entry. It then doesn't
match any of the others after that and goes back to the start.

There isn't an IE behaviour since window.find isn't supported.

Comment 4

15 years ago
Is it an important problem for a real application that you have?
Ever confirmed: true

Comment 5

15 years ago
Yeah, we have a template editor that allows searching in IE using an IE specific

bug 241053 fixed searching within textarea using the "Find in Page". I was under
the impression that window.find was the same system just with a scripted wrapper.

Comment 6

15 years ago
It is not a simple problem to fix in the back-end. The fact that the focus is
switching to the <button> element in the same page confuses the special

As a work-around in your first example

you can change
<button onclick="doFind('foo');">Run Find</button>

<button onclick="document.getElementById('foo').focus();doFind('foo');">Run

then position the caret on the first character in the textarea before starting
to find.
Product: Core → Mozilla Application Suite
Filter "spam" on "guifeatures-nobody-20080610".
Assignee: guifeatures → nobody
QA Contact: guifeatures


11 years ago
Component: XP Apps: GUI Features → UI Design
You need to log in before you can comment on or make changes to this bug.