Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Issue #364 - Fix IE9 blank cell bug #365

Closed
wants to merge 1 commit into from

5 participants

Chris Nienhuis Peter Wagenet mherodev Kevin Decker Yehuda Katz
Chris Nienhuis

In IE9, if you have whitespace and/or carriage returns between table
elements, it causes IE9 to render a blank column and pushes all the
content one column to the right. It seems the best solution is to
strip it out of the template string when you compile a template.

If you search google for "IE9 renders blank cells" you'll find lots of
references to this problem.

Chris Nienhuis neenhouse Issue #364 - IE9 whitespace bug fix
In IE9, if you have whitespace and/or carriage returns between table
elements, it causes IE9 to render a blank column and pushes all the
content one column to the right.  It seems the best solution is to
strip it out of the template string when you compile a template.

If you search google for "IE9 renders blank cells" you'll find lots of
references to this problem.
c171d70
Yehuda Katz
Owner

Isn't the solution to not have whitespace in the template?

Yes, but if you have complex multi line table templates, putting it all on one line makes it very unreadable and a pain to manage (because carriage returns also cause the IE9 problem).

Peter Wagenet
Collaborator

@neenhouse Is this something you'd be able to update. Unfortunately, it doesn't merge cleanly anymore.

Peter Wagenet
Collaborator

Looks like #357 is related.

mherodev

I also just encountered this issue. Random blank columns were being introduced all over my table. Was this issue closed because it's been solved and I simply have an old version of Handlebars? I believe I downloaded it within the last couple months.

Is there a nice solution out there that doesn't require me to flatten my template in the file? I'd like the template the remain readable, even if there are other code-based steps to solve this.

Kevin Decker
Collaborator

Closing this issue so we can consolidate whitespace handling issues on #336

Kevin Decker kpdecker closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 16, 2012
  1. Chris Nienhuis

    Issue #364 - IE9 whitespace bug fix

    neenhouse authored
    In IE9, if you have whitespace and/or carriage returns between table
    elements, it causes IE9 to render a blank column and pushes all the
    content one column to the right.  It seems the best solution is to
    strip it out of the template string when you compile a template.
    
    If you search google for "IE9 renders blank cells" you'll find lots of
    references to this problem.
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/handlebars/compiler/compiler.js
5 lib/handlebars/compiler/compiler.js
View
@@ -1045,7 +1045,10 @@ Handlebars.precompile = function(string, options) {
Handlebars.compile = function(string, options) {
options = options || {};
- var compiled;
+ var compiled,
+ re = /(\<t.{1-4}>)\s+|\s+(\<\/t.{1-4}\>)|\\r|\\n/gim,
+ string = string.replace(re, '$1');
+
function compile() {
var ast = Handlebars.parse(string);
var environment = new Handlebars.Compiler().compile(ast, options);
Something went wrong with that request. Please try again.