* Loop trough the list of modifiers and run them in order, * each of them will then edit the data object. * @method * @memberof Popper.Utils * @param {dataObject} data * @param {Array} modifiers * @param {String} ends - Optional modifier name used as stopper * @returns {dataObje
(modifiers, data, ends)
| 2373 | * @returns {dataObject} |
| 2374 | */ |
| 2375 | function runModifiers(modifiers, data, ends) { |
| 2376 | var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); |
| 2377 | |
| 2378 | modifiersToRun.forEach(function (modifier) { |
| 2379 | if (modifier['function']) { |
| 2380 | // eslint-disable-line dot-notation |
| 2381 | console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); |
| 2382 | } |
| 2383 | var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation |
| 2384 | if (modifier.enabled && isFunction(fn)) { |
| 2385 | // Add properties to offsets to make them a complete clientRect object |
| 2386 | // we do this before each modifier to make sure the previous one doesn't |
| 2387 | // mess with these values |
| 2388 | data.offsets.popper = getClientRect(data.offsets.popper); |
| 2389 | data.offsets.reference = getClientRect(data.offsets.reference); |
| 2390 | |
| 2391 | data = fn(data, modifier); |
| 2392 | } |
| 2393 | }); |
| 2394 | |
| 2395 | return data; |
| 2396 | } |
| 2397 | |
| 2398 | /** |
| 2399 | * Updates the position of the popper, computing the new offsets and applying |
no test coverage detected