-
Notifications
You must be signed in to change notification settings - Fork 20.5k
CSS: Don't expose jQuery.swap #2182
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
Conversation
jQuery.swap was an undocumented API used only internally. With the modular AMD system we currently have it's not necessary to expose this function publicly under the jQuery object. Fixes jquerygh-2058 Closes jquerygh-2182
|
Definitely a good idea. Now we get to find out who's using this! |
|
Sure! 👍 |
|
This will also allow to change |
|
It's being used in Drupal in a custom plugin we made to get the size of an horizontal menu: jquery.intrisic.js. It's used in all our admin pages for responsive menu purposes. I haven't looked into what it'd take to replace it on our side, just noticed this issue. Totally fine with reworking the script. If you have in mind a easy way to replace this it'd be great, otherwise we'll do our homework. |
|
@theodoreb thanks for the heads-up, always better to know before than after. Besides the fact that this has been undocumented, it's a real performance killer because it can cause two reflows of the affected regions. Generally it's better to do the bookkeeping of visibility yourself (e.g. via a data item or class name) so the browser won't have to do all that work. Sounds like we may want to move the |
|
It might be very dangerous, without any gain, i would be more comfortable if we would "deprecate" it first by adding message in migrate but still exposing it until 4.0 |
|
This was never exposed. You cannot deprecate an API that was never documented - and what would be the gain? If someone didn't see it look into the docs to see there is no documentation, they wouldn't see it deprecated either. Also, it's trivial to add and will be easily handled by the Migrate plugin. I think we should remove it. |
It is exposed through API. You could also see the header of this pull if you don't believe me :-)
That is why i put this word in quotes. There is couple articles, as i recall, mentions
Gain would be not to break users code.
As i said above, we could add a warning to migrate first.
I don't think we should remove it, i think we should stop exposing it, but i don't see the rush, i think there wouldn't be any point to do it right now. |
|
For the record you can take Drupal out of the real-life code depending on it. Our code can do without it, it's merely by convenience we ended up using it. The version of Drupal using swap is still in beta, so on our end there is nothing we can't break at this level. I'd say putting it in jquery migrate is the right thing to do. Though I don't have anything in the fight since Drupal isn't and won't be using the migrate plugin. |
|
I've thought about this a bit more and am wondering if we are doing this backwards. Perhaps the better course would be to expose jQuery.swap and take out the "get dimensions of hidden elements" feature. That way, we let people continue to do slow things but don't hide the badness of it. |
|
@dmethvin Would it really buy those users much? I think this method looks a little arcane, it's just an utility that made sense to save space internally by not repeating logic but I think it's not really intuitive to use. If someone needs it somewhere, they need to know what they want to swap and at this point it seems easier for such a person to do this swapping logic manually. |
|
@mzgol agreed. This function doesn't have much utility. It makes more sense to me for the user to do it themselves. |
|
I see your point @mzgol, we're making a generic utility but someone who wanted to do this in their own code could do it with a lot less hassle. OK then let's carry on with the original plan 😺 |
jQuery.swap was an undocumented API used only internally. With the modular
AMD system we currently have it's not necessary to expose this function
publicly under the jQuery object.
Fixes gh-2058