Skip to content

Commit e1da87d

Browse files
committed
makes sure that split works only on elements
1 parent e24edc6 commit e1da87d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

samples/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ <h3>About</h3>
2424
<p><b>GitHub Issues</b></p>
2525
<p><a href='issue_51.html'>Issues 51, 24</a> - missing content when columnizer is called from script in body below content.</p>
2626
<p><a href='issue_45.html'>Issue 45</a> - don't re-indent the first line of a split paragraph.</p>
27+
<p><a href='issue_49.html'>Issue 49</a> - make sure columnizer doesn't duplicate text nodes.</p>

src/jquery.columnizer.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,12 @@
185185
* two copies of the element with it's contents divided between each
186186
*/
187187
function split($putInHere, $pullOutHere, $parentColumn, targetHeight){
188-
if($pullOutHere.children().length){
189-
var $cloneMe = $pullOutHere.children(":first");
188+
if($pullOutHere.contents().length){
189+
var $cloneMe = $pullOutHere.contents(":first");
190+
//
191+
// make sure we're splitting an element
192+
if($cloneMe.get(0).nodeType != 1) return;
193+
190194
//
191195
// clone the node with all data and events
192196
var $clone = $cloneMe.clone(true);

0 commit comments

Comments
 (0)