Tolerate leading/trailing whitespace in html string. #16

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@timoxley
Member

Fixes bug where can't domify component-converted templates correctly without .trim due to trailing newline in template files.

I can't think of any use case where you'd want domify to care about leading/trailing whitespace.

@timoxley
Member

Fixes #15

@jonathanong jonathanong commented on the diff Sep 22, 2013
@@ -27,6 +27,7 @@ var map = {
module.exports = function(html){
if ('string' != typeof html) throw new TypeError('String expected');
+ html = html.trim()
@jonathanong
jonathanong Sep 22, 2013

not supported in IE8, if anybody cares

@jonathanong
jonathanong Oct 9, 2013

@timoxley do you think we should support IE8? it not, i'll merge this

@timoxley
timoxley Oct 10, 2013 Components member

Nope. IE8 doesn't even do ES5 so no Array.prototype.forEach/map/reduce etc. I'm sure there's plentiful calls to forEach in the component/* codebases so anyone using IE8 likely needs to use an ES5 shim anyway.

@timoxley
timoxley Oct 10, 2013 Components member

Though, ugh, I guess i could just convert it to a regex and it'll just work.

@timoxley
timoxley Oct 10, 2013 Components member

Done. #22

@jonathanong
jonathanong Oct 10, 2013

Yeah, if the change were any more nontrivial then I wouldn't bother.

@timoxley
Member

New pull request: #22

@timoxley timoxley closed this Oct 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment