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.
Reference:
HTMLElement: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
Node: https://developer.mozilla.org/en-US/docs/Web/API/Node
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With