Skip to content

Commit

Permalink
fix DOM insertion operators for null values
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav authored and lopper committed Apr 24, 2013
1 parent 7ea25f5 commit c3a3aa9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/zepto.js
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,8 @@ var Zepto = (function() {
// arguments can be nodes, arrays of nodes, Zepto objects and HTML strings
var argType, nodes = $.map(arguments, function(arg) {
argType = type(arg)
return argType == "object" || argType == "array" ? arg : zepto.fragment(arg)
return argType == "object" || argType == "array" || arg == null ?
arg : zepto.fragment(arg)
}),
parent, copyByClone = this.length > 1
if (nodes.length < 1) return this
Expand Down
5 changes: 5 additions & 0 deletions test/zepto.html
Original file line number Diff line number Diff line change
Expand Up @@ -1785,6 +1785,11 @@ <h1>Zepto DOM unit tests</h1>
t.assertEqual('<span>Test</span>,<span>Test</span>', spans.join(','))
},

testAppendNull: function(t){
var el = $(document.body)
t.assertIdentical(el, el.append(null))
},

testBeforeAfterFragment: function(t){
var fragment = $('<div class=fragment />')
fragment.before('before').after('after')
Expand Down

0 comments on commit c3a3aa9

Please sign in to comment.