From: Alex Monk Date: Mon, 6 May 2013 14:20:35 +0000 (+0100) Subject: mediawiki.action.edit: Support dynamically inserted form fields X-Git-Tag: 1.31.0-rc.0~19756^2 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=187ca4bb379006528f0fcfcd3a9b435d71cd599c;p=lhc%2Fweb%2Fwiklou.git 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 --- 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