Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upFixes #14545. In-body STYLE element returns nonzero dimensions #1445
Conversation
// See http://bugs.jquery.com/ticket/14545 | ||
if (elemNodeName === "script" || elemNodeName === "style") { | ||
return 0; | ||
} |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This needs unit tests. Also, I'd personally prefer to see any code change in the height/width getter itself (e.g., to skip swap for reserved elements) instead of |
This comment has been minimized.
This comment has been minimized.
This looks good to me now. @gibson042 ? |
// In HTML5, it is now valid to have style tags outside the head tag. | ||
// See http://bugs.jquery.com/ticket/14545 | ||
var elemNodeName = elem.nodeName.toLowerCase(); | ||
if (elemNodeName === "script" || elemNodeName === "style") { |
This comment has been minimized.
This comment has been minimized.
markelog
Dec 19, 2013
Member
For nodeName
comparisons we generally use jQuery.nodeName
method, since it devised specially for this kind of cases. And it should not give big performance overhead.
Also if
requires spaces, same goes for function calls in assertions you added.
This comment has been minimized.
This comment has been minimized.
I'm not strongly oppose to this, but why exactly we want to do this? For any hidden element it would return it width/height but not for Plus we didn't have these problems before, although Only thing that change is that html5 spec has eased constraints for |
This comment has been minimized.
This comment has been minimized.
I'm inclined to agree with @markelog... if
|
This comment has been minimized.
This comment has been minimized.
But it turns out that we missed that block for |
This comment has been minimized.
This comment has been minimized.
You guys made your case, I'm good with leaving this as a docs issue. Sprinkling |
This comment has been minimized.
This comment has been minimized.
bggardner
commented
Oct 9, 2014
I am the original submitter, and I'm sorry for not following up until now. While I don't disagree with leaving this as a docs issue (and an easy worked-around with CSS |
This comment has been minimized.
This comment has been minimized.
Seems that |
This comment has been minimized.
This comment has been minimized.
Just FYI: that approach to finding available space has more nuances than manually excluding |
This comment has been minimized.
This comment has been minimized.
bggardner
commented
Oct 9, 2014
@dmethvin I wouldn't say that. Just because browsers can't figure out how to implement it, doesn't mean it's being phased out, as it is not being considered for deprecation by the W3C, AFAIK. Also, for the sake of tidying up, this is a half-duplicate of http://bugs.jquery.com/ticket/10159 and the documentation fix for .width() and .height() has a typo: |
This comment has been minimized.
This comment has been minimized.
At least Google currently thinks this feature is not worth the effort with Web Components coming so it might disappear from the standard one day. |
grisendo commentedNov 21, 2013
Reported by bggardner
This also occurs with script elements
See http://bugs.jquery.com/ticket/14545