Closed Bug 307783 Opened 15 years ago Closed 15 years ago
.find fails to find text unless an alert is executed before the find
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6 Window.find fails to find text on the page most of the time. I discovered that putting up an alert box containing arbitrary text before the window.find statement causes the find to succeed. Reproducible: Always Steps to Reproduce: 1. Make a web page with the following content. <html> <head> <title>Test page</title> </head> <body> <H1> Test page for Mozilla FireFox. </H1> </body> <SCRIPT> alert('any text'); var string1 = window.find('Mozilla'); </SCRIPT> </html> 2. Load the page with Mozilla or FireFox, click OK on the alert box, and notice that 'Mozilla' is hi-lighted. 3. Comment out or remove the alert line, then reload the page. 'Mozilla' is not found. Actual Results: When an alert statement preceeds window.find, the search is successful. When the alert is removed, the search fails. Expected Results: Window.find should search the page regardless of the presence of an alert statement. The example above fails reliably. In a complex production environment, SFX, it fails most of the time, but occasionally succeeds.
It's not quite as simple as that. I need to conditionally insert a link at the end of the page based on the presence or absence of text already included in the page previous to the script. -Rich
try: <SCRIPT> document.body.offsetHeight; var string1 = window.find('Mozilla'); </SCRIPT> You need to force gecko to reflow the page it has received so far. ==> DOM
Assignee: general → general
Component: General → DOM
Product: Mozilla Application Suite → Core
QA Contact: general → ian
Version: unspecified → Trunk
OS: Windows XP → All
Priority: -- → P3
Hardware: PC → All
Target Milestone: --- → mozilla1.8.1
Comment on attachment 207686 [details] [diff] [review] Proposed fix r+sr=jst
Comment on attachment 207686 [details] [diff] [review] Proposed fix It might be worth taking this for 1.8.1. I think this should be safe (esp. with some bake time).
Attachment #207686 - Flags: approval1.8.1?
Fixed on trunk.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: mozilla1.8.1 → mozilla1.9alpha
Attachment #207686 - Flags: approval1.8.1? → branch-1.8.1?(jst)
Attachment #207686 - Flags: branch-1.8.1?(jst) → branch-1.8.1+
Fixed on branch.
You need to log in before you can comment on or make changes to this bug.