Skip to content

Commit f12ede7

Browse files
committed
do not instantiate JQLiteExtras before jQuery has been checked
1 parent 59ce91e commit f12ede7

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/ui-scroll-jqlite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99

1010
angular.module('ui.scroll.jqlite', []);
1111

12-
}());
12+
})();

src/ui-scroll.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import Adapter from './modules/adapter.js';
66

77
angular.module('ui.scroll', [])
88

9-
.service('jqLiteExtras', () => new JQLiteExtras())
10-
.run(['jqLiteExtras', (jqLiteExtras) =>
11-
!window.jQuery ? jqLiteExtras.registerFor(angular.element) : null
9+
.constant('JQLiteExtras', JQLiteExtras)
10+
.run(['JQLiteExtras', (JQLiteExtras) =>
11+
!window.jQuery ? (new JQLiteExtras()).registerFor(angular.element) : null
1212
])
1313

1414
.directive('uiScrollViewport', function () {

test/jqliteExtrasSpec.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ describe('\njqLite: testing against jQuery\n', function () {
22
'use strict';
33

44
var sandbox = angular.element('<div/>');
5-
65
var extras;
76

87
beforeEach(module('ui.scroll'));
98
beforeEach(function(){
109
angular.element(document).find('body').append(sandbox = angular.element('<div></div>'));
11-
inject(function(jqLiteExtras) {
10+
inject(function(JQLiteExtras) {
1211
extras = function(){};
13-
jqLiteExtras.registerFor(extras);
12+
(new JQLiteExtras()).registerFor(extras);
1413
});
1514
});
1615

0 commit comments

Comments
 (0)