mediawiki.action.edit: Support dynamically inserted form fields
authorAlex Monk <krenair@gmail.com>
Mon, 6 May 2013 14:20:35 +0000 (15:20 +0100)
committerKrinkle <krinklemail@gmail.com>
Mon, 6 May 2013 20:42:10 +0000 (20:42 +0000)
This fixes CharInsert in LQT. LQT dynamically creates its own text boxes
and this code should take that into account.

Bug: 41220
Change-Id: Id9469f9dfcbb92854780c63252cd9c5069e94487

resources/mediawiki.action/mediawiki.action.edit.js

index 2835c9c..fc1b18d 100644 (file)
                        }
                }() );
 
-               $( 'textarea, input:text' ).focus( function () {
-                       currentFocused = $(this);
-               });
+               // Apply to dynamically created textboxes as well as normal ones
+               $( document ).on( 'focus', 'textarea, input:text', function () {
+                       currentFocused = $( this );
+               } );
 
                // HACK: make currentFocused work with the usability iframe
                // With proper focus detection support (HTML 5!) this'll be much cleaner