Skip to content

Commit

Permalink
Merge pull request #174 from twitter/release_prep
Browse files Browse the repository at this point in the history
Fix test harness, remove array buffer for obsolete browsers.
  • Loading branch information
sayrer committed Jun 5, 2014
2 parents f1e5bb0 + 88c42ab commit 907ac0b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
18 changes: 6 additions & 12 deletions lib/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

var Hogan = {};

(function (Hogan, useArrayBuffer) {
(function (Hogan) {
Hogan.Template = function (codeObj, text, compiler, options) {
codeObj = codeObj || {};
this.r = codeObj.code || this.r;
Expand All @@ -24,7 +24,7 @@ var Hogan = {};
this.text = text || '';
this.partials = codeObj.partials || {};
this.subs = codeObj.subs || {};
this.ib();
this.buf = '';
}

Hogan.Template.prototype = {
Expand Down Expand Up @@ -215,15 +215,9 @@ var Hogan = {};
},

// template result buffering
b: (useArrayBuffer) ? function(s) { this.buf.push(s); } :
function(s) { this.buf += s; },

fl: (useArrayBuffer) ? function() { var r = this.buf.join(''); this.buf = []; return r; } :
function() { var r = this.buf; this.buf = ''; return r; },
// init the buffer
ib: function () {
this.buf = (useArrayBuffer) ? [] : '';
},
b: function(s) { this.buf += s; },

fl: function() { var r = this.buf; this.buf = ''; return r; },

// method replace section
ms: function(func, ctx, partials, inverted, start, end, tags) {
Expand Down Expand Up @@ -293,7 +287,7 @@ var Hogan = {};
var partial = new PartialTemplate();
partial.subs = new Substitutions();
partial.subsText = {}; //hehe. substext.
partial.ib();
partial.buf = '';

stackSubs = stackSubs || {};
partial.stackSubs = stackSubs;
Expand Down
4 changes: 3 additions & 1 deletion test/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ function run(file, callback) {
var url = path.resolve('.', path.dirname(file));
var window = jsdom(html, null, {url: url + '/'}).createWindow();
// silence QUnit error logging
window.console.error = window.console.warn = function(){};
if (window.console) {
window.console.error = window.console.warn = function(){};
}
window.onload = function(){
window.QUnit.done = function() {
callback(null, {file: file, window: window});
Expand Down

0 comments on commit 907ac0b

Please sign in to comment.