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
The no-conflict mode should be the default behaviour #12395
Comments
I believe no-conflict-is-not-the-default is the norm for jQuery plugins? |
It is true that it is the norm for jQuery plugins. Couldn't there be a clash with other jQuery plugins with the current implementation of Bootstrap though? |
That is precisely what |
Indeed, we know for a fact that such clashes exist (e.g. with jQuery UI). One could equally ask why jQuery UI isn't no-conflict-by-default. However, other than providing a working |
My understanding was that jQueryUI is already by default non clashing by using a "ui" prefix in their CSS and by using namespaces in their plugins. Anyway, it doesn't mean that Bootstrap must do what others are doing. Otherwise, you can close this. |
jQuery UI doesn't seem to be using no-conflict in their JS by default; e.g. the example on http://jqueryui.com/tooltip/ simply does $(function() {
$( document ).tooltip();
}); un-namespaced, same as Bootstrap. |
Well, I suppose you could namespace Bootstrap's JavaScript plugins by assigning them to |
@cvrebert: I've downloaded the latest jQueryUI located at http://jqueryui.com/download/all/ to validate this. What, I've found is that each plugin is within a closure and the non conflicting jQuery variable is passed as a parameter. The $ is only an alias within the context of the closure. You can find a very old bug ticket confirming this: http://bugs.jquery.com/ticket/1686. From what I see Bootstrap is also doing this, but nothing is namespaced. The difference that I see is that jQueryUI is namespaced and they use a helper function called "widget" to add their plugins. They pass the name of the plugin to "widget" as well as jQueryUI's version, some options and some private functions. For the tooltip, the name is "ui.tooltip". Little example snippet below taken from the file jquery.ui.tooltip.js: (function( $ ) {
/** Some functions here (redacted for easier reading). **/
$.widget( "ui.tooltip", {
version: "1.10.4",
options: {
/** List of options would be here (redacted for easier reading). **/
},
/** List of private functions (redacted for easier reading). **/
});
}( jQuery ) ); It might also be worth noting that this is the case in their latest development version located here (although there are some changes): https://github.com/jquery/jquery-ui/blob/master/ui/tooltip.js. |
Nevermind, misread something for a moment there. They do directly inject into $. :( |
Also, even if we wanted to do this, we couldn't do it until v4 due to backward-compatibility constraints. |
@fat I assume that we're not gonna go this route? If so, then can we close as WontFix? |
yep wont fix |
The no-conflict mode should be the default behaviour. Why would a Bootstrap client need to implement this?
The text was updated successfully, but these errors were encountered: