Skip to content

Commit

Permalink
move content resolution to after created hook
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Mar 23, 2014
1 parent c67685b commit 6f58626
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ function Compiler (vm, options) {

// COMPILE ----------------------------------------------------------------

// before compiling, resolve content insertion points
if (options.template) {
this.resolveContent()
}

// now parse the DOM and bind directives.
// During this stage, we will also create bindings for
// encountered keypaths that don't have a binding yet.
Expand Down Expand Up @@ -237,7 +242,6 @@ CompilerProto.setupElement = function (options) {
el.appendChild(template.cloneNode(true))
}

this.setupContent(el)
}

// apply element options
Expand All @@ -257,9 +261,9 @@ CompilerProto.setupElement = function (options) {
* Deal with <content> insertion points
* per the Web Components spec
*/
CompilerProto.setupContent = function (el) {
CompilerProto.resolveContent = function () {

var outlets = slice.call(el.getElementsByTagName('content')),
var outlets = slice.call(this.el.getElementsByTagName('content')),
raw = this.rawContent,
outlet, select, i, j, main

Expand Down Expand Up @@ -289,7 +293,7 @@ CompilerProto.setupContent = function (el) {
insert(outlet, outlet.content)
}
// finally insert the main content
if (raw) {
if (raw && main) {
insert(main, slice.call(raw.childNodes))
}
}
Expand Down

0 comments on commit 6f58626

Please sign in to comment.