]> git.ipfire.org Git - thirdparty/bootstrap.git/commit
Accept elements as the tooltip / popover content 17402/head
authorGleb Mazovetskiy <glex.spb@gmail.com>
Sun, 30 Aug 2015 23:57:16 +0000 (00:57 +0100)
committerGleb Mazovetskiy <glex.spb@gmail.com>
Mon, 31 Aug 2015 00:06:13 +0000 (01:06 +0100)
commitc7d8e7a0777da91df2359655a7132e2b55482c0a
treec953ef46e464dd1556c3b11fab8b10b300bc8b29
parent8941bdfbda237bed621935cac439520eddc79150
Accept elements as the tooltip / popover content

When a DOM node is passed to an HTML tooltip, the `title` node is only
moved if it is not already in the tooltip. Otherwise, `empty()` is used
instead of `detach()` before appending the `title` to avoid memory
leaks. If a DOM node is passed to a plain text tooltip, its text is
copied via jQuery `.text()`.

Replaces `.detach()` with `.empty()`, as `.detach()` is almost never
useful but instead leaks memory. The difference between `empty` and
`detach` is that the latter keeps all the attached jQuery events/data.
However, since we do not return the previous children, the user would
have to keep these themselves, thus they can `detach()` if necessary.

This is a port of https://github.com/twbs/bootstrap/pull/14552 to v4.
docs/components/popovers.md
docs/components/tooltips.md
js/src/popover.js
js/src/tooltip.js
js/tests/unit/popover.js
js/tests/unit/tooltip.js