From 187ca4bb379006528f0fcfcd3a9b435d71cd599c Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Mon, 6 May 2013 15:20:35 +0100 Subject: [PATCH] mediawiki.action.edit: Support dynamically inserted form fields 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/mediawiki.action/mediawiki.action.edit.js b/resources/mediawiki.action/mediawiki.action.edit.js index 2835c9cccf..fc1b18d45a 100644 --- a/resources/mediawiki.action/mediawiki.action.edit.js +++ b/resources/mediawiki.action/mediawiki.action.edit.js @@ -148,9 +148,10 @@ } }() ); - $( '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 -- 2.20.1