|
18 | 18 | factory(window.jQuery, window); |
19 | 19 | } |
20 | 20 | })(function($, scope) { |
| 21 | + |
| 22 | + // checks for obsolete method names |
21 | 23 | var obsolete = function(f, oldName, newName) { |
22 | 24 | var wrapper = function() { |
23 | 25 | console.warn('gridstack.js: Function `' + oldName + '` is deprecated as of v0.2.5 and has been replaced ' + |
|
29 | 31 | return wrapper; |
30 | 32 | }; |
31 | 33 |
|
32 | | - var obsoleteOpts = function(opts, oldName, newName) { |
| 34 | + // checks for obsolete grid options 9can be used for any fields, but msg is about options) |
| 35 | + var obsoleteOpts = function(opts, oldName, newName) { |
33 | 36 | if (opts[oldName] !== undefined) { |
34 | 37 | opts[newName] = opts[oldName]; |
35 | 38 | console.warn('gridstack.js: Option `' + oldName + '` is deprecated as of v0.2.5 and has been replaced with `' + |
36 | 39 | newName + '`. It will be **completely** removed in v1.0.'); |
37 | 40 | } |
38 | 41 | }; |
39 | 42 |
|
| 43 | + // checks for obsolete Jquery element attributes |
| 44 | + var obsoleteAttr = function(el, oldName, newName) { |
| 45 | + var oldAttr = el.attr(oldName); |
| 46 | + if (oldAttr !== undefined) { |
| 47 | + el.attr(newName, oldAttr); |
| 48 | + console.warn('gridstack.js: attribute `' + oldName + '`=' + oldAttr + ' is deprecated on this object as of v0.5.2 and has been replaced with `' + |
| 49 | + newName + '`. It will be **completely** removed in v1.0.'); |
| 50 | + } |
| 51 | + }; |
| 52 | + |
40 | 53 | var Utils = { |
41 | 54 |
|
42 | 55 | isIntercepted: function(a, b) { |
|
675 | 688 | obsoleteOpts(opts, 'always_show_resize_handle', 'alwaysShowResizeHandle'); |
676 | 689 | obsoleteOpts(opts, 'width', 'columns'); |
677 | 690 | obsoleteOpts(opts, 'height', 'maxRows'); |
| 691 | + |
| 692 | + // container attributes |
| 693 | + obsoleteAttr(this.container, 'data-gs-width', 'data-gs-columns'); |
| 694 | + obsoleteAttr(this.container, 'data-gs-height', 'data-gs-max-rows'); |
678 | 695 | /*eslint-enable camelcase */ |
679 | 696 |
|
680 | 697 | opts.itemClass = opts.itemClass || 'grid-stack-item'; |
|
0 commit comments