Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #14545. In-body STYLE element returns nonzero dimensions #1445

Closed
wants to merge 8 commits into from
9 changes: 8 additions & 1 deletion src/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ function getWidthOrHeight( elem, name, extra ) {
var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles( elem ),
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
elemNodeName = elem.nodeName.toLowerCase();

// In HTML5, it is now valid to have style tags outside the head tag.
// See http://bugs.jquery.com/ticket/14545
if (elemNodeName === "script" || elemNodeName === "style") {
return 0;
}
Copy link
Member

Choose a reason for hiding this comment

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

spaces → tabs


// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
Expand Down