fixes #11293, don't swap to measure dimensions unless the element is display:none #807

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@mikesherov
Member

http://jqbug.com/11293

Running "compare_size:files" (compare_size) task
Sizes - compared to master
    251207       (+44)  dist/jquery.js                                         
     92011       (+29)  dist/jquery.min.js                                     
     33094        (+9)  dist/jquery.min.js.gz     

One note:

  • I really dislike that for elements that have offsetWidth 0, we attempt to make them visible by swapping out some css properties. Users really shouldn't be asking for measurements on hidden elements. I suppose we need it for back-compat, but I just really dislike it.
Member

Some other thoughts: So I suppose the initial idea behind jQuery.swap was a display:none element to get changed to block and be made invisible for measurement. Theoretically, this can also make inline-block and inline elements into block elements. So, I purposely only excluded elems with table style display values.

However, if we're willing to say that only display:none should be swapped, then I can update this PR to reflect that.

Member

Actually, I'm going to go ahead and do that. I think it'll also fix http://bugs.jquery.com/ticket/11522

Member

Updated size:

Running "compare_size:files" (compare_size) task
Sizes - compared to master
    251226       (+63)  dist/jquery.js                                         
     92010       (+28)  dist/jquery.min.js                                     
     33091        (+6)  dist/jquery.min.js.gz   

Also, this should theoretically fix http://bugs.jquery.com/ticket/11522

Member
rwaldron commented Jun 2, 2012

Sorry, but I'm not landing anything that will conflict with the strip_iife branch (eg the doomed jQuery.defaultDisplay)

Member

@rwldrn , I'll revert that portion. Thanks for the heads up. I can make that optimization in another PR.

Member

@rwldrn, updated.

Member
rwaldron commented Jun 6, 2012

@mikesherov rebase and I can land it :)

Member

@rwldrn rebased.

Member

Ugh, I rebased incorrectly. Give me a few minutes to correct.

@mikesherov mikesherov closed this Jun 7, 2012
Member

Ugh, I rebased incorrectly. Give me a few minutes to correct.

@mikesherov mikesherov reopened this Jun 7, 2012
Member

OK, this time it's right, I promise.

@rwaldron rwaldron closed this Jun 7, 2012
@markelog markelog pushed a commit to markelog/jquery that referenced this pull request Jun 29, 2012
@mikesherov @rwaldron mikesherov + rwaldron Don't swap to measure dimensions unless the element is display:none. #…
…807 Fixes #11293
a0d77a0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment