All: Moved version numbers into prototypes. Fixed #7436 - Widget: Store version numbers on instances.

This commit is contained in:
Scott González 2011-05-28 15:39:55 -04:00
parent 2f3284811c
commit 6a5b21fda2
19 changed files with 19 additions and 46 deletions

View File

@ -15,6 +15,7 @@
// TODO: use ui-accordion-header-active class and fix styling // TODO: use ui-accordion-header-active class and fix styling
$.widget( "ui.accordion", { $.widget( "ui.accordion", {
version: "@VERSION",
options: { options: {
active: 0, active: 0,
animated: "slide", animated: "slide",
@ -432,7 +433,6 @@ $.widget( "ui.accordion", {
}); });
$.extend( $.ui.accordion, { $.extend( $.ui.accordion, {
version: "@VERSION",
animations: { animations: {
slide: function( options, additions ) { slide: function( options, additions ) {
var showOverflow = options.toShow.css( "overflow" ), var showOverflow = options.toShow.css( "overflow" ),

View File

@ -19,6 +19,7 @@
var requestIndex = 0; var requestIndex = 0;
$.widget( "ui.autocomplete", { $.widget( "ui.autocomplete", {
version: "@VERSION",
defaultElement: "<input>", defaultElement: "<input>",
options: { options: {
appendTo: "body", appendTo: "body",
@ -475,7 +476,6 @@ $.widget( "ui.autocomplete", {
}); });
$.extend( $.ui.autocomplete, { $.extend( $.ui.autocomplete, {
version: "@VERSION",
escapeRegex: function( value ) { escapeRegex: function( value ) {
return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
}, },

View File

@ -41,6 +41,7 @@ var lastActive, startXPos, startYPos, clickDragged,
}; };
$.widget( "ui.button", { $.widget( "ui.button", {
version: "@VERSION",
defaultElement: "<button>", defaultElement: "<button>",
options: { options: {
disabled: null, disabled: null,
@ -412,6 +413,4 @@ $.widget( "ui.buttonset", {
} }
}); });
$.ui.buttonset.version = "@VERSION";
}( jQuery ) ); }( jQuery ) );

View File

@ -36,6 +36,7 @@ var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ",
}; };
$.widget("ui.dialog", { $.widget("ui.dialog", {
version: "@VERSION",
options: { options: {
autoOpen: true, autoOpen: true,
buttons: {}, buttons: {},
@ -655,8 +656,6 @@ $.widget("ui.dialog", {
}); });
$.extend($.ui.dialog, { $.extend($.ui.dialog, {
version: "@VERSION",
uuid: 0, uuid: 0,
maxZ: 0, maxZ: 0,

View File

@ -15,6 +15,7 @@
(function( $, undefined ) { (function( $, undefined ) {
$.widget("ui.draggable", $.ui.mouse, { $.widget("ui.draggable", $.ui.mouse, {
version: "@VERSION",
widgetEventPrefix: "drag", widgetEventPrefix: "drag",
options: { options: {
addClasses: true, addClasses: true,
@ -502,10 +503,6 @@ $.widget("ui.draggable", $.ui.mouse, {
}); });
$.extend($.ui.draggable, {
version: "@VERSION"
});
$.ui.plugin.add("draggable", "connectToSortable", { $.ui.plugin.add("draggable", "connectToSortable", {
start: function(event, ui) { start: function(event, ui) {

View File

@ -16,6 +16,7 @@
(function( $, undefined ) { (function( $, undefined ) {
$.widget("ui.droppable", { $.widget("ui.droppable", {
version: "@VERSION",
widgetEventPrefix: "drop", widgetEventPrefix: "drop",
options: { options: {
accept: '*', accept: '*',
@ -146,10 +147,6 @@ $.widget("ui.droppable", {
}); });
$.extend($.ui.droppable, {
version: "@VERSION"
});
$.ui.intersect = function(draggable, droppable, toleranceMode) { $.ui.intersect = function(draggable, droppable, toleranceMode) {
if (!droppable.offset) return false; if (!droppable.offset) return false;

View File

@ -16,6 +16,7 @@
var idIncrement = 0; var idIncrement = 0;
$.widget("ui.menu", { $.widget("ui.menu", {
version: "@VERSION",
defaultElement: "<ul>", defaultElement: "<ul>",
delay: 150, delay: 150,
options: { options: {
@ -420,6 +421,4 @@ $.widget("ui.menu", {
} }
}); });
$.ui.menu.version = "@VERSION";
}( jQuery )); }( jQuery ));

View File

@ -18,6 +18,7 @@
// TODO when mixing clicking menus and keyboard navigation, focus handling is broken // TODO when mixing clicking menus and keyboard navigation, focus handling is broken
// there has to be just one item that has tabindex // there has to be just one item that has tabindex
$.widget( "ui.menubar", { $.widget( "ui.menubar", {
version: "@VERSION",
options: { options: {
buttons: false, buttons: false,
menuIcon: false menuIcon: false

View File

@ -18,6 +18,7 @@ $(document).mousedown(function(e) {
}); });
$.widget("ui.mouse", { $.widget("ui.mouse", {
version: "@VERSION",
options: { options: {
cancel: ':input,option', cancel: ':input,option',
distance: 1, distance: 1,

View File

@ -17,6 +17,7 @@
var idIncrement = 0; var idIncrement = 0;
$.widget( "ui.popup", { $.widget( "ui.popup", {
version: "@VERSION",
options: { options: {
position: { position: {
my: "left top", my: "left top",

View File

@ -14,6 +14,7 @@
(function( $, undefined ) { (function( $, undefined ) {
$.widget( "ui.progressbar", { $.widget( "ui.progressbar", {
version: "@VERSION",
options: { options: {
value: 0, value: 0,
max: 100 max: 100
@ -100,8 +101,4 @@ $.widget( "ui.progressbar", {
} }
}); });
$.extend( $.ui.progressbar, {
version: "@VERSION"
});
})( jQuery ); })( jQuery );

View File

@ -15,6 +15,7 @@
(function( $, undefined ) { (function( $, undefined ) {
$.widget("ui.resizable", $.ui.mouse, { $.widget("ui.resizable", $.ui.mouse, {
version: "@VERSION",
widgetEventPrefix: "resize", widgetEventPrefix: "resize",
options: { options: {
alsoResize: false, alsoResize: false,
@ -548,10 +549,6 @@ $.widget("ui.resizable", $.ui.mouse, {
}); });
$.extend($.ui.resizable, {
version: "@VERSION"
});
/* /*
* Resizable Extensions * Resizable Extensions
*/ */

View File

@ -15,6 +15,7 @@
(function( $, undefined ) { (function( $, undefined ) {
$.widget("ui.selectable", $.ui.mouse, { $.widget("ui.selectable", $.ui.mouse, {
version: "@VERSION",
options: { options: {
appendTo: 'body', appendTo: 'body',
autoRefresh: true, autoRefresh: true,
@ -259,8 +260,4 @@ $.widget("ui.selectable", $.ui.mouse, {
}); });
$.extend($.ui.selectable, {
version: "@VERSION"
});
})(jQuery); })(jQuery);

View File

@ -19,7 +19,7 @@
var numPages = 5; var numPages = 5;
$.widget( "ui.slider", $.ui.mouse, { $.widget( "ui.slider", $.ui.mouse, {
version: "@VERSION",
widgetEventPrefix: "slide", widgetEventPrefix: "slide",
options: { options: {
@ -659,8 +659,4 @@ $.widget( "ui.slider", $.ui.mouse, {
}); });
$.extend( $.ui.slider, {
version: "@VERSION"
});
}(jQuery)); }(jQuery));

View File

@ -15,6 +15,7 @@
(function( $, undefined ) { (function( $, undefined ) {
$.widget("ui.sortable", $.ui.mouse, { $.widget("ui.sortable", $.ui.mouse, {
version: "@VERSION",
widgetEventPrefix: "sort", widgetEventPrefix: "sort",
options: { options: {
appendTo: "parent", appendTo: "parent",
@ -1069,8 +1070,4 @@ $.widget("ui.sortable", $.ui.mouse, {
}); });
$.extend($.ui.sortable, {
version: "@VERSION"
});
})(jQuery); })(jQuery);

View File

@ -14,6 +14,7 @@
(function( $ ) { (function( $ ) {
$.widget( "ui.spinner", { $.widget( "ui.spinner", {
version: "@VERSION",
defaultElement: "<input>", defaultElement: "<input>",
widgetEventPrefix: "spin", widgetEventPrefix: "spin",
options: { options: {
@ -368,6 +369,4 @@ $.widget( "ui.spinner", {
} }
}); });
$.ui.spinner.version = "@VERSION";
}( jQuery ) ); }( jQuery ) );

View File

@ -19,6 +19,7 @@ function getNextTabId() {
} }
$.widget( "ui.tabs", { $.widget( "ui.tabs", {
version: "@VERSION",
options: { options: {
active: null, active: null,
collapsible: false, collapsible: false,
@ -577,10 +578,6 @@ $.widget( "ui.tabs", {
} }
}); });
$.extend( $.ui.tabs, {
version: "@VERSION"
});
// DEPRECATED // DEPRECATED
if ( $.uiBackCompat !== false ) { if ( $.uiBackCompat !== false ) {

View File

@ -17,6 +17,7 @@
var increments = 0; var increments = 0;
$.widget( "ui.tooltip", { $.widget( "ui.tooltip", {
version: "@VERSION",
options: { options: {
tooltipClass: null, tooltipClass: null,
items: "[title]", items: "[title]",
@ -155,6 +156,4 @@ $.widget( "ui.tooltip", {
} }
}); });
$.ui.tooltip.version = "@VERSION";
}( jQuery ) ); }( jQuery ) );

View File

@ -49,7 +49,7 @@ $.widget = function( name, base, prototype ) {
if ( arguments.length ) { if ( arguments.length ) {
this._createWidget( options, element ); this._createWidget( options, element );
} }
}, $[ namespace ][ name ] ); }, $[ namespace ][ name ], { version: prototype.version } );
var basePrototype = new base(); var basePrototype = new base();
// we need to make the options hash a property directly on the new instance // we need to make the options hash a property directly on the new instance