-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
use anchors for slotted content
- Loading branch information
Showing
7 changed files
with
51 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { DomGenerator } from '../../index'; | ||
import { Node } from '../../../../interfaces'; | ||
|
||
export default function isDomNode(node: Node) { | ||
return node.type === 'Element' || node.type === 'Text' || node.type === 'MustacheTag'; | ||
export default function isDomNode(node: Node, generator: DomGenerator) { | ||
if (node.type === 'Element') return !generator.components.has(node.name); | ||
return node.type === 'Text' || node.type === 'MustacheTag'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div> | ||
<slot/> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export default { | ||
html: ` | ||
<div> | ||
<p>unconditional</p> | ||
</div>`, | ||
|
||
test(assert, component, target) { | ||
component.set({ foo: true }); | ||
assert.htmlEqual(target.innerHTML, ` | ||
<div> | ||
<p>unconditional</p> | ||
<p>conditional</p> | ||
</div> | ||
`); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Nested> | ||
<p>unconditional</p> | ||
|
||
{{#if foo}} | ||
<p>conditional</p> | ||
{{/if}} | ||
</Nested> | ||
|
||
<script> | ||
import Nested from './Nested.html'; | ||
|
||
export default { | ||
components: { | ||
Nested | ||
} | ||
}; | ||
</script> |