Permalink
Browse files

Fixed array loops iterating over array prototype methods. Fixes #3

  • Loading branch information...
jeremyharris committed Dec 19, 2016
1 parent 1f6afbc commit 55a290ee46dd668c8afdb5a226ffda9608a6b418
Showing with 16 additions and 9 deletions.
  1. +8 −1 demos.html
  2. +8 −8 jquery.splitlines.js
View
@@ -54,6 +54,13 @@
}
</style>
<script type="text/javascript">
// see: https://github.com/jeremyharris/split_lines/issues/3
// if this test fails, you'll see an additional line on all examples:
// `function () { return 'test'; }`
Array.prototype.test = function () {
return 'test';
};
function cycleFade() {
var div = $('#example-6');
$(div).children('div:first').animate({opacity:0}, 'slow', function() {
@@ -93,7 +100,7 @@
overflow: 'hidden'
}); //.children().css({width:100});
$('#example-7').children(':first').show();
setInterval('cycleFade()', 2000);
setInterval('cycleSlide()', 2000);
});
View
@@ -39,14 +39,14 @@
splitContent = _splitWords(contents[c].textContent || contents[c].toString());
} else {
var tag = $(contents[c]).clone();
splitContent = _splitHtmlWords(tag.contents());
for (var tagless in splitContent) {
splitContent = _splitHtmlWords(tag.contents());
for (var t=0; t<splitContent.length; t++) {
tag.empty();
splitContent[tagless] = tag.html(splitContent[tagless]).wrap('<p></p>').parent().html();
}
splitContent[t] = tag.html(splitContent[t]).wrap('<p></p>').parent().html();
}
}
for (var word in splitContent) {
words.push(splitContent[word]);
for (var w=0; w<splitContent.length; w++) {
words.push(splitContent[w]);
}
}
return words;
@@ -73,7 +73,7 @@
// find the deepest child, add html, then find the parent
return $(tag)
.find('*:not(:has("*"))')
.html(html)
.html(html)
.parentsUntil()
.slice(-1)
.html();
@@ -104,7 +104,7 @@
var tempLine = _createTemp(newHtml);
if (settings.width !== 'auto') {
tempLine.width(settings.width);
}
}
this.append(tempLine);
var words = settings.keepHtml ? _splitHtmlWords(contents) : _splitWords(text);
var prev;

0 comments on commit 55a290e

Please sign in to comment.