* 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 {dataObject}
(modifiers, data, ends)
| 3853 | |
| 3854 | |
| 3855 | function runModifiers(modifiers, data, ends) { |
| 3856 | var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); |
| 3857 | modifiersToRun.forEach(function (modifier) { |
| 3858 | if (modifier['function']) { |
| 3859 | // eslint-disable-line dot-notation |
| 3860 | console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); |
| 3861 | } |
| 3862 | |
| 3863 | var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation |
| 3864 | |
| 3865 | if (modifier.enabled && isFunction(fn)) { |
| 3866 | // Add properties to offsets to make them a complete clientRect object |
| 3867 | // we do this before each modifier to make sure the previous one doesn't |
| 3868 | // mess with these values |
| 3869 | data.offsets.popper = getClientRect(data.offsets.popper); |
| 3870 | data.offsets.reference = getClientRect(data.offsets.reference); |
| 3871 | data = fn(data, modifier); |
| 3872 | } |
| 3873 | }); |
| 3874 | return data; |
| 3875 | } |
| 3876 | /** |
| 3877 | * Updates the position of the popper, computing the new offsets and applying |
| 3878 | * the new style.<br /> |
no test coverage detected
searching dependent graphs…