use Ox.break

This commit is contained in:
rolux 2012-05-22 09:11:26 +02:00
commit 04784630d3
42 changed files with 117 additions and 118 deletions

View file

@ -109,7 +109,7 @@ Ox.highlightHTML = function(html, str, classname, tags) {
Ox.forEach(tags, function(tag) {
if (html.substr(i + 1).match(new RegExp('^/?' + tag + '\\W'))) {
isTag = true;
return false;
Ox.break();
}
});
}
@ -378,7 +378,7 @@ Ox.parseUserAgent = function(userAgent) {
string: string,
version: versions[version] || version
};
return false;
Ox.break();
}
});
});
@ -616,7 +616,8 @@ Ox.wordwrap = function(str, len, sep, bal, spa) {
}
}
lines = [''];
Ox.forEach(words, function(word) {
words.forEach(function(word) {
var chr;
if ((lines[lines.length - 1] + word + ' ').length <= len + 1) {
// word fits in current line
lines[lines.length - 1] += word + ' ';
@ -626,11 +627,11 @@ Ox.wordwrap = function(str, len, sep, bal, spa) {
lines.push(word + ' ');
} else {
// word is longer than line
var chr = len - lines[lines.length - 1].length;
chr = len - lines[lines.length - 1].length;
lines[lines.length - 1] += word.substr(0, chr);
for (var pos = chr; pos < word.length; pos += len) {
Ox.loop(chr, word.length, len, function(pos) {
lines.push(word.substr(pos, len));
}
});
lines[lines.length - 1] += ' ';
}
}