Skip to content
Permalink
Browse files
Non-breaking-space should achieve the same effect as a visible charac…
…ter. Fixes #9634
  • Loading branch information
rwaldron committed Jul 25, 2011
1 parent 27291ff commit ddf925b
Showing 1 changed file with 1 addition and 1 deletion.
@@ -184,7 +184,7 @@ jQuery.support = (function() {
support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
}

div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>&nbsp;</td></tr></table>";

This comment has been minimized.

Copy link
@mathiasbynens

mathiasbynens Aug 31, 2011

Contributor

You could also drop the quotes around padding:0;border:0;display:none: http://mothereffingunquotedattributes.com/#padding%3A0%3Bborder%3A0%3Bdisplay%3Anone

The end tags </td> and </tr> are not needed.

tds = div.getElementsByTagName( "td" );

// Check if table cells still have offsetWidth/Height when they are set

3 comments on commit ddf925b

@davidmurdoch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't matter as the div should be ~1400px off screen. But as diego points out, the "top" and "left" values aren't being set on lines 154 and 155. They need to be string values including "px".

Also, I just want to point out that

div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
uses a <tag >tag[0]</tag> pattern. Reverting this commit back to <td>t</td> or updating line 27 to <a>&nbsp;</a> would make things more consistent.

@mathiasbynens
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, that line 27 in support.js @davidmurdoch mentioned could be shortened/optimized without changing its meaning. I committed this change a while ago in my fork (for the lulz): mathiasbynens@489245e

@rwaldron
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch - that's the right fix

Please sign in to comment.