Closed
Bug 232004
Opened 21 years ago
Closed 17 years ago
Inline scripts in XHTML can't set focus (workaround: setTimeout)
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: dzy, Unassigned)
References
Details
(Keywords: testcase, xhtml, Whiteboard: [ignore comments 4-8])
Attachments
(2 files, 2 obsolete files)
203 bytes,
application/xhtml+xml
|
Details | |
2.36 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 this minimal test case worked in 1.5 and 1.6a, the input field gets focus after page load, but not in 1.6b and 1.6 final. test.xhtml <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>test</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <form action="http://www.google.com/search" id="f"> <input maxlength="256" size="55" name="q" /> </form> <script type="text/javascript"> <![CDATA[ document.getElementById("f").q.focus(); ]]> </script> </body> </html> Reproducible: Always Steps to Reproduce: 1. 2. 3. Actual Results: the input field doesn't get focus Expected Results: the input field gets focus after page load
Comment 1•21 years ago
|
||
Not a JS engine bug. Please don't file bugs in random DOM functionality on the JS engine....
Assignee: general → general
Component: JavaScript Engine → DOM: Level 0
QA Contact: PhilSchwartau → ian
Comment 2•21 years ago
|
||
Comment 3•21 years ago
|
||
Are you sure this worked in 1.6a? I just tried builds back to July and in none of them does the textfield have focus.... (all on Linux). For that matter, it doesn't work in non-XHTML documents either; things work fine if the focus() call is made from onload(), though.
Comment 4•20 years ago
|
||
Comment 5•20 years ago
|
||
Comment 6•20 years ago
|
||
Testcases v2 and v3 WORKFORME in Mozilla 1.7b 2004032208 and Firefox 0.8 20040206 under XP Pro SP1. The use of <![CDATA[ ... unescaped script content ... ]]> is only needed if the javascript code uses <, > and & characters. The // is to indicate that the <!CDATA[ and ]]> strings are actually not part of the javascript code. So, <script type="text/javascript"> document.getElementById("q").focus(); </script> in Testcase v2 and <script type="text/javascript"> document.getElementById("f").q.focus(); </script> in Testcase v3 also WORKFORME. I'm all for RESOLVING this bug as INVALID or WORKSFORME.
Keywords: testcase
Comment 7•20 years ago
|
||
Those last two attachments aren't XHTML. This but is only an issue in XHTML, not HTML. The bug is most definitely present, not matter what you're all for.
Whiteboard: [ignore comments 4-7]
Updated•20 years ago
|
Attachment #144835 -
Attachment is obsolete: true
Updated•20 years ago
|
Attachment #144836 -
Attachment is obsolete: true
Comment 8•20 years ago
|
||
>Those last two attachments aren't XHTML.
Sorry I got that wrong.
Updated•20 years ago
|
Keywords: xhtml
OS: Windows XP → All
Hardware: PC → All
Whiteboard: [ignore comments 4-7] → [ignore comments 4-8]
Comment 9•20 years ago
|
||
At a guess, the problem is that the focus() call happens before layout has started, so there is no layout object to focus (non-incremental content sink and all that).....
Updated•19 years ago
|
Summary: xhtml javascript set focus doesn't work → Inline scripts in XHTML can't set focus (workaround: setTimeout)
Updated•19 years ago
|
Depends on: incrementalxml
Comment 10•19 years ago
|
||
Marking NEW based on bz's comments and the fact that his testcase does in fact fail.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 11•18 years ago
|
||
Fixed by bug 18333? The blinking caret is mysteriously misplaced (it appears at the end of the textbox rather than at the beginning) but typing into the textbox works normally.
Comment 12•18 years ago
|
||
I think the caret bogosity is an unrelated regression. See bug 368861.
Comment 13•17 years ago
|
||
Comment 14•17 years ago
|
||
Fixed by checkin for 18333. Added the test.
Status: NEW → RESOLVED
Closed: 17 years ago
Flags: in-testsuite? → in-testsuite+
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•