-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Marvin Frachet
authored
Feb 21, 2019
1 parent
21632a1
commit 5ce3219
Showing
5 changed files
with
51 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
package vn | ||
|
||
func H(tagName string, attrs *Attrs, children interface{}) *Vnode { | ||
func H(tagName string, attrs *Attrs, children interface{}, params ...string) *Vnode { | ||
sanitizedAttrs := Sanitize(attrs) | ||
var key *string | ||
|
||
if len(params) == 1 { | ||
key = ¶ms[0] | ||
} | ||
|
||
switch (children).(type) { | ||
case string: | ||
return NewVNode(tagName, sanitizedAttrs, nil, &TextNode{(children).(string), nil}, nil) | ||
return NewVNode(tagName, sanitizedAttrs, nil, &TextNode{(children).(string), nil}, nil, key) | ||
default: | ||
return NewVNode(tagName, sanitizedAttrs, children.(Children), nil, nil) | ||
return NewVNode(tagName, sanitizedAttrs, children.(Children), nil, nil, key) | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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