|
11 | 11 | *
|
12 | 12 | * @description
|
13 | 13 | * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.
|
14 |
| - * `angular.element` can be either an alias for [jQuery](http://api.jquery.com/jQuery/) function, if |
15 |
| - * jQuery is available, or a function that wraps the element or string in Angular's jQuery lite |
16 |
| - * implementation (commonly referred to as jqLite). |
17 | 14 | *
|
18 |
| - * Real jQuery always takes precedence over jqLite, provided it was loaded before `DOMContentLoaded` |
19 |
| - * event fired. |
| 15 | + * If jQuery is available, `angular.element` is an alias for the |
| 16 | + * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element` |
| 17 | + * delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite." |
20 | 18 | *
|
21 |
| - * jqLite is a tiny, API-compatible subset of jQuery that allows |
22 |
| - * Angular to manipulate the DOM. jqLite implements only the most commonly needed functionality |
23 |
| - * within a very small footprint, so only a subset of the jQuery API - methods, arguments and |
24 |
| - * invocation styles - are supported. |
| 19 | + * <div class="alert alert-success">jqLite is a tiny, API-compatible subset of jQuery that allows |
| 20 | + * Angular to manipulate the DOM in a cross-browser compatible way. **jqLite** implements only the most |
| 21 | + * commonly needed functionality with the goal of having a very small footprint.</div> |
25 | 22 | *
|
26 |
| - * Note: All element references in Angular are always wrapped with jQuery or jqLite; they are never |
27 |
| - * raw DOM references. |
| 23 | + * To use jQuery, simply load it before `DOMContentLoaded` event fired. |
| 24 | + * |
| 25 | + * <div class="alert">**Note:** all element references in Angular are always wrapped with jQuery or |
| 26 | + * jqLite; they are never raw DOM references.</div> |
28 | 27 | *
|
29 | 28 | * ## Angular's jqLite
|
30 |
| - * Angular's lite version of jQuery provides only the following jQuery methods: |
| 29 | + * jqLite provides only the following jQuery methods: |
31 | 30 | *
|
32 |
| - * - [addClass()](http://api.jquery.com/addClass/) |
33 |
| - * - [after()](http://api.jquery.com/after/) |
34 |
| - * - [append()](http://api.jquery.com/append/) |
35 |
| - * - [attr()](http://api.jquery.com/attr/) |
36 |
| - * - [bind()](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData |
37 |
| - * - [children()](http://api.jquery.com/children/) - Does not support selectors |
38 |
| - * - [clone()](http://api.jquery.com/clone/) |
39 |
| - * - [contents()](http://api.jquery.com/contents/) |
40 |
| - * - [css()](http://api.jquery.com/css/) |
41 |
| - * - [data()](http://api.jquery.com/data/) |
42 |
| - * - [eq()](http://api.jquery.com/eq/) |
43 |
| - * - [find()](http://api.jquery.com/find/) - Limited to lookups by tag name |
44 |
| - * - [hasClass()](http://api.jquery.com/hasClass/) |
45 |
| - * - [html()](http://api.jquery.com/html/) |
46 |
| - * - [next()](http://api.jquery.com/next/) - Does not support selectors |
47 |
| - * - [on()](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData |
48 |
| - * - [off()](http://api.jquery.com/off/) - Does not support namespaces or selectors |
49 |
| - * - [parent()](http://api.jquery.com/parent/) - Does not support selectors |
50 |
| - * - [prepend()](http://api.jquery.com/prepend/) |
51 |
| - * - [prop()](http://api.jquery.com/prop/) |
52 |
| - * - [ready()](http://api.jquery.com/ready/) |
53 |
| - * - [remove()](http://api.jquery.com/remove/) |
54 |
| - * - [removeAttr()](http://api.jquery.com/removeAttr/) |
55 |
| - * - [removeClass()](http://api.jquery.com/removeClass/) |
56 |
| - * - [removeData()](http://api.jquery.com/removeData/) |
57 |
| - * - [replaceWith()](http://api.jquery.com/replaceWith/) |
58 |
| - * - [text()](http://api.jquery.com/text/) |
59 |
| - * - [toggleClass()](http://api.jquery.com/toggleClass/) |
60 |
| - * - [triggerHandler()](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers. |
61 |
| - * - [unbind()](http://api.jquery.com/off/) - Does not support namespaces |
62 |
| - * - [val()](http://api.jquery.com/val/) |
63 |
| - * - [wrap()](http://api.jquery.com/wrap/) |
| 31 | + * - [`addClass()`](http://api.jquery.com/addClass/) |
| 32 | + * - [`after()`](http://api.jquery.com/after/) |
| 33 | + * - [`append()`](http://api.jquery.com/append/) |
| 34 | + * - [`attr()`](http://api.jquery.com/attr/) |
| 35 | + * - [`bind()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData |
| 36 | + * - [`children()`](http://api.jquery.com/children/) - Does not support selectors |
| 37 | + * - [`clone()`](http://api.jquery.com/clone/) |
| 38 | + * - [`contents()`](http://api.jquery.com/contents/) |
| 39 | + * - [`css()`](http://api.jquery.com/css/) |
| 40 | + * - [`data()`](http://api.jquery.com/data/) |
| 41 | + * - [`eq()`](http://api.jquery.com/eq/) |
| 42 | + * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name |
| 43 | + * - [`hasClass()`](http://api.jquery.com/hasClass/) |
| 44 | + * - [`html()`](http://api.jquery.com/html/) |
| 45 | + * - [`next()`](http://api.jquery.com/next/) - Does not support selectors |
| 46 | + * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData |
| 47 | + * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces or selectors |
| 48 | + * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors |
| 49 | + * - [`prepend()`](http://api.jquery.com/prepend/) |
| 50 | + * - [`prop()`](http://api.jquery.com/prop/) |
| 51 | + * - [`ready()`](http://api.jquery.com/ready/) |
| 52 | + * - [`remove()`](http://api.jquery.com/remove/) |
| 53 | + * - [`removeAttr()`](http://api.jquery.com/removeAttr/) |
| 54 | + * - [`removeClass()`](http://api.jquery.com/removeClass/) |
| 55 | + * - [`removeData()`](http://api.jquery.com/removeData/) |
| 56 | + * - [`replaceWith()`](http://api.jquery.com/replaceWith/) |
| 57 | + * - [`text()`](http://api.jquery.com/text/) |
| 58 | + * - [`toggleClass()`](http://api.jquery.com/toggleClass/) |
| 59 | + * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers. |
| 60 | + * - [`unbind()`](http://api.jquery.com/off/) - Does not support namespaces |
| 61 | + * - [`val()`](http://api.jquery.com/val/) |
| 62 | + * - [`wrap()`](http://api.jquery.com/wrap/) |
64 | 63 | *
|
65 | 64 | * ## jQuery/jqLite Extras
|
66 | 65 | * Angular also provides the following additional methods and events to both jQuery and jqLite:
|
|
69 | 68 | * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event
|
70 | 69 | * on all DOM nodes being removed. This can be used to clean up any 3rd party bindings to the DOM
|
71 | 70 | * element before it is removed.
|
| 71 | + * |
72 | 72 | * ### Methods
|
73 | 73 | * - `controller(name)` - retrieves the controller of the current element or its parent. By default
|
74 | 74 | * retrieves controller associated with the `ngController` directive. If `name` is provided as
|
|
0 commit comments