Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 9db8803

Browse files
Michel Boudreaumboudreau
Michel Boudreau
authored andcommitted
fixing linting and jshint comments, as per @mzgol request
1 parent 0027549 commit 9db8803

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

src/Angular.js

+40-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
shallowCopy: true,
5959
equals: true,
6060
csp: true,
61+
jq: true,
6162
concat: true,
6263
sliceArgs: true,
6364
bind: true,
@@ -916,11 +917,48 @@ var csp = function() {
916917
* be added to the top-most HTML element.
917918
*
918919
*/
920+
921+
922+
/**
923+
* @ngdoc directive
924+
* @name ngJq
925+
*
926+
* @element html
927+
* @param {string=} the name of the library available under `window`
928+
* to be used for angular.element
929+
* @description
930+
* Use this directive to force the angular.element library. This should be
931+
* used to force either jqLite by leaving ng-jq blank or setting the name of
932+
* the jquery variable under window (eg. jQuery).
933+
*
934+
* Since this directive is global for the angular library, it is recommended
935+
* that it's added to the top-most HTML element, but it is not mandatory.
936+
*
937+
* @example
938+
* This example shows how to force jqLite using the `ngJq` directive to the `html` tag.
939+
```html
940+
<!doctype html>
941+
<html ng-app ng-jq>
942+
...
943+
...
944+
</html>
945+
```
946+
* @example
947+
* This example shows how to use a jQuery based library of a different name.
948+
* The library name must be available at the top most 'window'.
949+
```html
950+
<!doctype html>
951+
<html ng-app ng-jq="jQueryLib">
952+
...
953+
...
954+
</html>
955+
```
956+
*/
919957
var jq = function() {
920958
if (isDefined(jq.name_)) return jq.name_;
921959

922960
var el = document.querySelector('[ng-jq]') || document.querySelector('[data-ng-jq]');
923-
var name = undefined;
961+
var name;
924962

925963
if (el) {
926964
name = el.getAttribute('ng-jq') || el.getAttribute('data-ng-jq') || '';
@@ -1501,7 +1539,7 @@ function bindJQuery() {
15011539

15021540
// bind to jQuery if present;
15031541
var jqName = jq();
1504-
jQuery = jqName !== undefined ? window[jqName] : window.jQuery;
1542+
jQuery = jqName != null ? window[jqName] : window.jQuery;
15051543

15061544
// Use jQuery if it exists with proper functionality, otherwise default to us.
15071545
// Angular 1.2+ requires jQuery 1.7+ for on()/off() support.

test/.jshintrc

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"shallowCopy": false,
6161
"equals": false,
6262
"csp": false,
63+
"jq": false,
6364
"concat": false,
6465
"sliceArgs": false,
6566
"bind": false,

0 commit comments

Comments
 (0)