@@ -163,6 +163,11 @@ function Compiler (vm, options) {
163
163
164
164
// COMPILE ----------------------------------------------------------------
165
165
166
+ // before compiling, resolve content insertion points
167
+ if ( options . template ) {
168
+ this . resolveContent ( )
169
+ }
170
+
166
171
// now parse the DOM and bind directives.
167
172
// During this stage, we will also create bindings for
168
173
// encountered keypaths that don't have a binding yet.
@@ -237,7 +242,6 @@ CompilerProto.setupElement = function (options) {
237
242
el . appendChild ( template . cloneNode ( true ) )
238
243
}
239
244
240
- this . setupContent ( el )
241
245
}
242
246
243
247
// apply element options
@@ -257,9 +261,9 @@ CompilerProto.setupElement = function (options) {
257
261
* Deal with <content> insertion points
258
262
* per the Web Components spec
259
263
*/
260
- CompilerProto . setupContent = function ( el ) {
264
+ CompilerProto . resolveContent = function ( ) {
261
265
262
- var outlets = slice . call ( el . getElementsByTagName ( 'content' ) ) ,
266
+ var outlets = slice . call ( this . el . getElementsByTagName ( 'content' ) ) ,
263
267
raw = this . rawContent ,
264
268
outlet , select , i , j , main
265
269
@@ -289,7 +293,7 @@ CompilerProto.setupContent = function (el) {
289
293
insert ( outlet , outlet . content )
290
294
}
291
295
// finally insert the main content
292
- if ( raw ) {
296
+ if ( raw && main ) {
293
297
insert ( main , slice . call ( raw . childNodes ) )
294
298
}
295
299
}
0 commit comments