don't throw error on undefined/null trusted vnode #1375
This commit is contained in:
parent
70e0f8e66d
commit
65b4116666
2 changed files with 13 additions and 0 deletions
|
|
@ -16,4 +16,16 @@ o.spec("trust", function() {
|
|||
o(vnode.tag).equals("<")
|
||||
o(vnode.children).equals("abc")
|
||||
})
|
||||
o("casts null to empty string", function() {
|
||||
var vnode = trust(null)
|
||||
|
||||
o(vnode.tag).equals("<")
|
||||
o(vnode.children).equals("")
|
||||
})
|
||||
o("casts undefined to empty string", function() {
|
||||
var vnode = trust(undefined)
|
||||
|
||||
o(vnode.tag).equals("<")
|
||||
o(vnode.children).equals("")
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -3,5 +3,6 @@
|
|||
var Vnode = require("../render/vnode")
|
||||
|
||||
module.exports = function(html) {
|
||||
if (html == null) html = ""
|
||||
return Vnode("<", undefined, undefined, html, undefined, undefined)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue