Paweł W Paweł W - 2 years ago 145
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?

Answer Source

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.




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download