Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 535
Paweł Avatar asked Mar 15 '26 05:03

Paweł


1 Answers

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

like image 197
mortb Avatar answered Mar 17 '26 17:03

mortb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!