diff options
author | kpdecker <kpdecker@gmail.com> | 2014-08-23 17:44:20 -0500 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2014-08-23 17:44:20 -0500 |
commit | 84d646bb5d5a8bb01bfb9465ee1078161f069742 (patch) | |
tree | 07233774619be9d4e00e8edaaf0fc528262f40a2 /lib/handlebars/compiler/javascript-compiler.js | |
parent | ccd803ff15e98186a82988a67d9aeff411612af4 (diff) | |
download | handlebars.js-84d646bb5d5a8bb01bfb9465ee1078161f069742.zip handlebars.js-84d646bb5d5a8bb01bfb9465ee1078161f069742.tar.gz handlebars.js-84d646bb5d5a8bb01bfb9465ee1078161f069742.tar.bz2 |
Move strip processing into AST helper logic
We already have to track these behaviors for the standalone parsing and rather than having two whitespace pruning implementations this moves all of the behavior into one place.
Fixes #852
Diffstat (limited to 'lib/handlebars/compiler/javascript-compiler.js')
-rw-r--r-- | lib/handlebars/compiler/javascript-compiler.js | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js index 25d45d1..fcd58fd 100644 --- a/lib/handlebars/compiler/javascript-compiler.js +++ b/lib/handlebars/compiler/javascript-compiler.js @@ -85,11 +85,6 @@ JavaScriptCompiler.prototype = { opcode = opcodes[i]; this[opcode.opcode].apply(this, opcode.args); - - // Reset the stripNext flag if it was not set by this operation. - if (opcode.opcode !== this.stripNext) { - this.stripNext = false; - } } // Flush any trailing content that might be pending. @@ -280,27 +275,10 @@ JavaScriptCompiler.prototype = { if (this.pendingContent) { content = this.pendingContent + content; } - if (this.stripNext) { - content = content.replace(/^\s+/, ''); - } this.pendingContent = content; }, - // [strip] - // - // On stack, before: ... - // On stack, after: ... - // - // Removes any trailing whitespace from the prior content node and flags - // the next operation for stripping if it is a content node. - strip: function() { - if (this.pendingContent) { - this.pendingContent = this.pendingContent.replace(/\s+$/, ''); - } - this.stripNext = 'strip'; - }, - // [append] // // On stack, before: value, ... |