Page MenuHomePhabricator

Infusing a widget should be able to reuse existing DOM rather than recreate from scratch
Closed, ResolvedPublic

Description

Infusing a widget should reuse existing DOM rather than recreate from scratch, when possible (for widgets where the DOM is the same, or very similar, in PHP and JS).

Event Timeline

matmarex raised the priority of this task from to Low.
matmarex updated the task description. (Show Details)
matmarex added a project: OOUI.
matmarex added subscribers: matmarex, cscott, Catrope.

I'm not sure I agree with the "should" here, at least not without qualifiers.

"There should be a mechanism to allow..." I agree with. But we need to trade off implementation complexity -- we introduce a whole bunch of new ways to break things if we try to reuse the DOM blindly. So I think it's best to concentrate on high-reward areas where its worth the extra maintenance costs, and of course, not infusing any more widgets than we actually need to.

But input widgets do seem to be a special case worth accomodating.

Change 244047 had a related patch set uploaded (by Cscott):
WIP: Preserve DOM node of InputWidget's $input when infusing.

https://gerrit.wikimedia.org/r/244047

matmarex renamed this task from Infusing a widget should reuse existing DOM rather than recreate from scratch to Infusing a widget should be able to reuse existing DOM rather than recreate from scratch.Oct 15 2015, 7:59 PM
matmarex set Security to None.

Change 243082 had a related patch set uploaded (by Bartosz Dziewoński):
Allow widgets to reuse parts of the DOM when infusing, use it for InputWidget's $input

https://gerrit.wikimedia.org/r/243082

Change 243082 merged by jenkins-bot:
Allow widgets to reuse parts of the DOM when infusing, use it for InputWidget's $input

https://gerrit.wikimedia.org/r/243082

Note that this patch is basically the minimal useful thing. We still recreate all the DOM in almost all widgets, and almost all DOM in the rest of the widgets (InputWidget subclasses).

Change 244047 abandoned by Bartosz Dziewoński:
WIP: Preserve DOM node of InputWidget's $input when infusing.

Reason:
Folded into https://gerrit.wikimedia.org/r/#/c/243082/ , thanks!

https://gerrit.wikimedia.org/r/244047

This doesn't work… what the hell was I thinking. It obviously doesn't work and I deserve a trouting.

(Even thought it's completely broken, this patch still fixed T114134 somehow. I wish I knew why.)

Change 277437 had a related patch set uploaded (by Bartosz Dziewoński):
InputWidget: Actually reuse parts of the DOM when infusing

https://gerrit.wikimedia.org/r/277437

Change 277437 merged by Jforrester:
InputWidget: Actually reuse parts of the DOM when infusing

https://gerrit.wikimedia.org/r/277437