Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.

Commit f97f66f

Browse files
committed
build 1.1.3
1 parent 258cbaf commit f97f66f

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

dist/vue-wc-wrapper.global.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,11 @@ function wrap (Vue, Component) {
127127

128128
constructor () {
129129
super();
130+
this.attachShadow({ mode: 'open' });
130131
const wrapper = this._wrapper = new Vue({
131132
name: 'shadow-root',
132133
customElement: this,
134+
shadowRoot: this.shadowRoot,
133135
data () {
134136
return {
135137
props: getInitialProps(camelizedPropsList),
@@ -144,8 +146,7 @@ function wrap (Vue, Component) {
144146
}
145147
});
146148

147-
// in Chrome, this.childNodes will be empty when connectedCallback
148-
// is fired, so it's necessary to use a mutationObserver
149+
// Use MutationObserver to react to slot content change
149150
const observer = new MutationObserver(() => {
150151
wrapper.slotChildren = Object.freeze(toVNodes(
151152
wrapper.$createElement,
@@ -167,8 +168,6 @@ function wrap (Vue, Component) {
167168
connectedCallback () {
168169
const wrapper = this._wrapper;
169170
if (!wrapper._isMounted) {
170-
this._shadowRoot = this.attachShadow({ mode: 'open' });
171-
wrapper.$options.shadowRoot = this._shadowRoot;
172171
// initialize children
173172
wrapper.slotChildren = Object.freeze(toVNodes(
174173
wrapper.$createElement,
@@ -179,7 +178,7 @@ function wrap (Vue, Component) {
179178
camelizedPropsList.forEach(key => {
180179
wrapper.props[key] = this.vueComponent[key];
181180
});
182-
this._shadowRoot.appendChild(wrapper.$el);
181+
this.shadowRoot.appendChild(wrapper.$el);
183182
} else {
184183
callHooks(this.vueComponent, 'activated');
185184
}

dist/vue-wc-wrapper.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,11 @@ function wrap (Vue, Component) {
124124

125125
constructor () {
126126
super();
127+
this.attachShadow({ mode: 'open' });
127128
const wrapper = this._wrapper = new Vue({
128129
name: 'shadow-root',
129130
customElement: this,
131+
shadowRoot: this.shadowRoot,
130132
data () {
131133
return {
132134
props: getInitialProps(camelizedPropsList),
@@ -141,8 +143,7 @@ function wrap (Vue, Component) {
141143
}
142144
});
143145

144-
// in Chrome, this.childNodes will be empty when connectedCallback
145-
// is fired, so it's necessary to use a mutationObserver
146+
// Use MutationObserver to react to slot content change
146147
const observer = new MutationObserver(() => {
147148
wrapper.slotChildren = Object.freeze(toVNodes(
148149
wrapper.$createElement,
@@ -164,8 +165,6 @@ function wrap (Vue, Component) {
164165
connectedCallback () {
165166
const wrapper = this._wrapper;
166167
if (!wrapper._isMounted) {
167-
this._shadowRoot = this.attachShadow({ mode: 'open' });
168-
wrapper.$options.shadowRoot = this._shadowRoot;
169168
// initialize children
170169
wrapper.slotChildren = Object.freeze(toVNodes(
171170
wrapper.$createElement,
@@ -176,7 +175,7 @@ function wrap (Vue, Component) {
176175
camelizedPropsList.forEach(key => {
177176
wrapper.props[key] = this.vueComponent[key];
178177
});
179-
this._shadowRoot.appendChild(wrapper.$el);
178+
this.shadowRoot.appendChild(wrapper.$el);
180179
} else {
181180
callHooks(this.vueComponent, 'activated');
182181
}

0 commit comments

Comments
 (0)