Last Comment Bug 561664 - document.activeElement should never return native anonymous content
: document.activeElement should never return native anonymous content
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: x86 Mac OS X
: -- normal (vote)
: ---
Assigned To: Olli Pettay [:smaug]
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-25 14:08 PDT by Olli Pettay [:smaug]
Modified: 2012-05-04 09:27 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (2.06 KB, patch)
2012-05-03 13:17 PDT, Olli Pettay [:smaug]
enndeakin: review+
Details | Diff | Review
+fix to test_bug430351.html (5.00 KB, patch)
2012-05-04 04:19 PDT, Olli Pettay [:smaug]
enndeakin: review+
Details | Diff | Review

Description Olli Pettay [:smaug] 2010-04-25 14:08:10 PDT
Currently document.activeElement may return the input element inside type="file". 
Content JS gets then an exception when it tries to access the element.
Comment 2 Scott González 2012-05-03 07:13:55 PDT
This is causing problems for us in jQuery UI. We wrap elements for certain animations, and the wrapping causes elements to lose focus, so we reset focus after wrapping. However, if a file input has focus, then we try setting the focus on the exposed text input, which is no longer in the document (not sure why).

jQuery UI bug: http://bugs.jqueryui.com/ticket/8288
Reduced test case using jQuery UI: http://jsfiddle.net/2efq2/8/
Reduced test case using plain JavaScript/DOM: http://dev-test.nemikor.com/bugs/firefox/input-type-file-activeelement.html
Comment 3 Olli Pettay [:smaug] 2012-05-03 13:17:27 PDT
Created attachment 620830 [details] [diff] [review]
patch
Comment 4 Olli Pettay [:smaug] 2012-05-03 13:18:04 PDT
Comment on attachment 620830 [details] [diff] [review]
patch

https://tbpl.mozilla.org/?tree=Try&rev=52113d2992a5
Comment 5 Olli Pettay [:smaug] 2012-05-03 15:49:42 PDT
Bah, the patch revealed another bug.
Comment 6 Olli Pettay [:smaug] 2012-05-04 04:19:46 PDT
Created attachment 621005 [details] [diff] [review]
+fix to test_bug430351.html

https://tbpl.mozilla.org/?tree=Try&rev=527d379c12aa
Comment 7 Olli Pettay [:smaug] 2012-05-04 04:51:06 PDT
Neil, the patch doesn't change the focusing behavior, but it is just that
test_bug430351.html tests currently  the_native_anon_button_inside_file_input != <input type="file">
With the patch that becomes <input type="file"> != <input type="file">
Comment 8 Olli Pettay [:smaug] 2012-05-04 09:27:31 PDT
https://hg.mozilla.org/mozilla-central/rev/032d43b1770f

Note You need to log in before you can comment on or make changes to this bug.