Page MenuHomePhabricator

Check for OOUI breakage caused by addItems change for non-array parameters
Open, Needs TriagePublic


I have a few scripts that recently broke because (I think?) of this change:

They were doing thing.addItems( item ), rather than thing.addItems( [ item ] ) and I have corrected them, after tracing the breakage.

While the change linked above is perfectly valid, it's possible more scripts may break here if they have accidentally been using a wrong, but previously working, call without the square brackets. Whether this ever worked is probably up to the widget in question (in my case: FieldsetLayout and ButtonSelectWidget). However lots of JS APIs have an item-or-array style, so it doesn't look obviously wrong to do so, and the type annotation in the docs said items, not [items], so it might have both worked and looked plausible. So this issue can be a place to hang such reports.

For example, a quick trawl though Wikipedia finds a few things like this:

        var dropMenu = new OO.ui.DropdownWidget();
	for (var count = 2; count < replyListC.length; count++) {
		var newOption = new OO.ui.MenuOptionWidget({

Event Timeline

Someone could "check", but what would this change exactly / what's the outcome?

(Bug T299818 is exactly this kind of a problem)