Welcome to mirror list, hosted at ThFree Co, Russian Federation.

legacy_container.vue « components « new_namespace « vue_shared « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e42720bf1db7b55912006fd6a4d50c979f71eb51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<script>
export default {
  inheritAttrs: false,
  props: {
    selector: {
      type: String,
      required: true,
    },
  },
  mounted() {
    const legacyEntry = document.querySelector(this.selector);
    if (legacyEntry.tagName === 'TEMPLATE') {
      // eslint-disable-next-line no-unsanitized/property
      this.$el.innerHTML = legacyEntry.innerHTML;
    } else {
      this.source = legacyEntry.parentNode;
      this.$el.appendChild(legacyEntry);
      legacyEntry.classList.add('active');
    }
  },

  beforeDestroy() {
    if (this.source) {
      this.$el.firstChild.classList.remove('active');
      this.source.appendChild(this.$el.firstChild);
    }
  },
};
</script>
<template>
  <div></div>
</template>