Do not automatically infuse any OOjs UI widgets
authorBartosz Dziewoński <matma.rex@gmail.com>
Tue, 26 Jul 2016 12:12:21 +0000 (14:12 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Fri, 19 Aug 2016 01:29:31 +0000 (03:29 +0200)
commitf50cee1375201a5d3fd76c0c262cfc7e66bd5d42
treedecd02f9f7d8058042e45e523be81a94fc9e3f45
parente1959b29741761edf413256becd63fe692351f6c
Do not automatically infuse any OOjs UI widgets

This is not really what we had in mind when developing the infusion
feature and I think it's not helpful. Most of the time there is just
no benefit; a ButtonWidget generated in PHP and in JS behaves and
looks pretty much the same, and rebuilding it through infusion is a
small performance hit. If you're not adding any event handlers, it only
makes sense for various dropdowns, which have themed styling.

For the primary use case of adding JS behaviors to PHP widgets you
need to call OO.ui.infuse() anyway to get a reference to the JS
widget, and not infusing automatically should make it easier to reason
about your code. Infusion tries to be very transparent, but it can't
hide the fact that the DOM is re-built, making your references to DOM
nodes from before infusion useless and losing anything from PHP that
wasn't included in the config (e.g. custom attributes).

This commit removes automated infusion from mediawiki.page.ready
and adds some custom code in mediawiki.special.movePage and
mediawiki.htmlform. I see only two extensions using infusable OOjs UI
widgets in Gerrit (ArticlePlaceholder and ExtensionDistributor) and
neither should be affected by this change.

Change-Id: I56608c537fc57c5c54960b0603694f2612f45618
13 files changed:
RELEASE-NOTES-1.28
includes/htmlform/HTMLFormField.php
includes/htmlform/fields/HTMLComboboxField.php
includes/htmlform/fields/HTMLRadioField.php
includes/htmlform/fields/HTMLSelectField.php
includes/htmlform/fields/HTMLSelectNamespace.php
includes/htmlform/fields/HTMLTitleTextField.php
includes/htmlform/fields/HTMLUserTextField.php
includes/specials/SpecialMovepage.php
resources/Resources.php
resources/src/mediawiki.special/mediawiki.special.movePage.js
resources/src/mediawiki/htmlform/autoinfuse.js [new file with mode: 0644]
resources/src/mediawiki/page/ready.js