create-element-if-not-defined.mjs 693 B

123456789101112131415161718192021
  1. import { e as elementChildren, c as createElement } from './utils.mjs';
  2. function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
  3. if (swiper.params.createElements) {
  4. Object.keys(checkProps).forEach(key => {
  5. if (!params[key] && params.auto === true) {
  6. let element = elementChildren(swiper.el, `.${checkProps[key]}`)[0];
  7. if (!element) {
  8. element = createElement('div', checkProps[key]);
  9. element.className = checkProps[key];
  10. swiper.el.append(element);
  11. }
  12. params[key] = element;
  13. originalParams[key] = element;
  14. }
  15. });
  16. }
  17. return params;
  18. }
  19. export { createElementIfNotDefined as c };