{"id":563,"date":"2009-12-27T11:21:34","date_gmt":"2009-12-27T17:21:34","guid":{"rendered":"http:\/\/www.mooreds.com\/wordpress\/archives\/000563"},"modified":"2009-12-27T11:21:34","modified_gmt":"2009-12-27T17:21:34","slug":"whitespace-and-tables-in-ie","status":"publish","type":"post","link":"https:\/\/www.mooreds.com\/wordpress\/archives\/563","title":{"rendered":"Whitespace and tables in IE"},"content":{"rendered":"<p>I was using the <a href=\"http:\/\/displaytag.sourceforge.net\/\">excellent displaytag library<\/a> recently, and had written a <a href=\"http:\/\/displaytag.sourceforge.net\/1.2\/tut_decorators.html\">table decorator<\/a> to append some information about each row for a <a href=\"http:\/\/www.mooreds.com\/wordpress\/archives\/000397\">GWT widget to read and use<\/a>.\u00a0 The table ended up looking like this:<\/p>\n<p>&lt;table&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;data&lt;\/td&gt;<br \/>\n&#8230;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;script type=&#8221;text\/javascript&#8221;&gt;var &#8230;&lt;\/script&gt;&lt;span id=&#8217;uniqid&#8217; style=&#8217;display:none&#8217;&gt;gwt config data&lt;\/span&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;data&lt;\/td&gt;<br \/>\n&#8230;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;script type=&#8221;text\/javascript&#8221;&gt;var &#8230;&lt;\/script&gt;&lt;span id=&#8217;uniqid&#8217; style=&#8217;display:none&#8217;&gt;gwt config data&lt;\/span&gt;<br \/>\n&#8230;<br \/>\n&lt;\/table&gt;<\/p>\n<p>This worked fine in Firefox and Safari, but IE (versions 6, 7 and 8 ) were displaying whitespace above the table.\u00a0 I couldn&#8217;t figure out why, until I commented out the table and the whitespace went away.\u00a0 Then I re-enabled the table, and commented out the <code>finishRow<\/code> method; the whitespace was still gone.<\/p>\n<p>The answer, of course, is that IE doesn&#8217;t like stuff outside of the &lt;tr&gt; tags.\u00a0 Once I wrapped the span tag in &lt;tr&gt;&lt;td&gt; tags, the whitespace went away for all browsers:<\/p>\n<p>&lt;table&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;data&lt;\/td&gt;<br \/>\n&#8230;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;tr&gt;&lt;td&gt;&lt;script type=&#8221;text\/javascript&#8221;&gt;var &#8230;&lt;\/script&gt;&lt;span id=&#8217;uniqid&#8217; style=&#8217;display:none&#8217;&gt;gwt config data&lt;\/span&gt;&lt;\/td&gt;&lt;\/tr&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;data&lt;\/td&gt;<br \/>\n&#8230;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;tr&gt;&lt;td&gt;&lt;script type=&#8221;text\/javascript&#8221;&gt;var &#8230;&lt;\/script&gt;&lt;span id=&#8217;uniqid&#8217; style=&#8217;display:none&#8217;&gt;gwt config data&lt;\/span&gt;&lt;\/td&gt;&lt;\/tr&gt;<br \/>\n&#8230;<br \/>\n&lt;\/table&gt;<\/p>\n<p>[tags]ie html quirks[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was using the excellent displaytag library recently, and had written a table decorator to append some information about each row for a GWT widget to read and use.\u00a0 The [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37,20],"tags":[],"class_list":["post-563","post","type-post","status-publish","format-standard","hentry","category-tips","category-web-applications"],"_links":{"self":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/563","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/comments?post=563"}],"version-history":[{"count":0,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/563\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/media?parent=563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/categories?post=563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/tags?post=563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}