creationix / haml-js

Haml ported to server-side Javascript. This is a traditional server-side templating language. Tested with node-js
MIT License
900 stars 109 forks source link

String replace only replaces one element #1

Closed cpojer closed 14 years ago

cpojer commented 14 years ago

Hey, just found your code (not using it) and saw a minor bug:

http://github.com/creationix/haml-js/blob/master/haml.js#L43

String.prototype.replace only replaces the first occurrence if used like that. Try 'aba'.replace('a', 'b') // outputs bba.

creationix commented 14 years ago

Strange how a discussion about formatting brings bug reports. Thanks, I'll see what I can do about it.

cpojer commented 14 years ago

I just hope to be able to help (use /a/g instead of 'a') :)

creationix commented 14 years ago

Fixed it and a couple of other places.