Skip to content

Commit f12acef

Browse files
author
Ralph Holzmann
committed
#5157 Bug Fix Rev2 - Removed unnecessary multiple calls to Regex.test
1 parent 80d1ebc commit f12acef

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/effects.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ jQuery.fn.extend({
133133
if ( ( p === "height" || p === "width" ) && this.style ) {
134134
// Store display property
135135
opt.display = jQuery.css(this, "display");
136+
opt.protectDisplay = jQuery.fx.protect.test(this.tagName);
136137

137138
// Make sure that nothing sneaks out
138139
opt.overflow = this.style.overflow;
@@ -293,7 +294,7 @@ jQuery.fx.prototype = {
293294
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
294295

295296
// Set display property to block for height/width animations
296-
if ( ( this.prop === "height" || this.prop === "width" ) && this.elem.style && jQuery.fx.tableTag.test(this.elem.tagName)) {
297+
if ( ( this.prop === "height" || this.prop === "width" ) && this.elem.style && !this.options.protectDisplay) {
297298
this.elem.style.display = "block";
298299
}
299300
},
@@ -461,9 +462,8 @@ jQuery.extend( jQuery.fx, {
461462
}
462463
}
463464
},
464-
465-
// Regex used to maintain the display property of animated table elements
466-
tableTag: new RegExp("/(TABLE|TR|TD|TH|THEAD|TBODY|TFOOT)/")
465+
// Regex used to preserve display property of certain elements
466+
protect: new RegExp("/TABLE|TR|TD|TH|THEAD|TBODY|TFOOT/")
467467

468468
});
469469

0 commit comments

Comments
 (0)