Paweł W Paweł W - 3 months ago 7
AngularJS Question

UI Bootstrap - missing contains implementation

How is it possible that jqLite doesn't provide the method "contains" on element (docs), angular bootstrap doesn't provide it neither (source), angular bootstrap doesn't depend on jQuery (package.json), nevertheless angular bootstrap is using it (line 2943)? Where does it come from?


I'll try to explain:

$element is a HTMLElement browser html object which is wrapped in a JQuery/JQlite object.

When you call $element[0] you get first the actual HTMLElement that is wrapped (in this case the authors know that only one element is wrapped).

HTMLElement inherits from Node. The Node object has the contains(...) method.