Skip to content

Commit

Permalink
Fix mounting point indicating issue on dev build
Browse files Browse the repository at this point in the history
  • Loading branch information
ClassicOldSong committed Mar 31, 2017
1 parent fad9714 commit 4267087
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ef.js",
"version": "0.1.1-alpha.10",
"version": "0.1.1-alpha.11",
"description": "(maybe) An elegent HTML template framework",
"main": "dist/ef.min.js",
"module": "src/ef.js",
Expand Down
15 changes: 5 additions & 10 deletions src/lib/utils/creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,6 @@ const bindMountingList = ({state, name, children, anchor}) => {
})
}

const createAnchor = (name) => {
const anchor = document.createTextNode('')
if (ENV !== 'production') {
DOM.before(anchor, document.createComment(`Start of mounting point '${name}'`))
DOM.after(anchor, document.createComment(`End of mounting point '${name}'`))
}
return anchor
}

const resolveAST = ({node, nodeType, element, state, innerData, nodes, children, subscriber, create}) => {
switch (nodeType) {
case 'string': {
Expand All @@ -106,12 +97,16 @@ const resolveAST = ({node, nodeType, element, state, innerData, nodes, children,
warn(`Reserved name '${node.name}' should not be used, ignoring.`)
break
}
const anchor = createAnchor(node.name)
const anchor = document.createTextNode('')
if (node.type === 'node') bindMountingNode({state, name: node.name, children, anchor})
else if (node.type === 'list') bindMountingList({state, name: node.name, children, anchor})
else throw new TypeError(`Not a standard ef.js AST: Unknown mounting point type '${node.type}'`)
// Append placeholder
DOM.append(element, anchor)
if (ENV !== 'production') {
DOM.before(anchor, document.createComment(`Start of mounting point '${node.name}'`))
DOM.after(anchor, document.createComment(`End of mounting point '${node.name}'`))
}
break
}
default: {
Expand Down

0 comments on commit 4267087

Please sign in to comment.