From c7d8e7a0777da91df2359655a7132e2b55482c0a Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Mon, 31 Aug 2015 00:57:16 +0100 Subject: 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 | 4 ++-- docs/components/tooltips.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/components/popovers.md b/docs/components/popovers.md index 98672d23e..f48d860ea 100644 --- a/docs/components/popovers.md +++ b/docs/components/popovers.md @@ -193,7 +193,7 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap content - string | function + string | element | function ''

Default content value if data-content attribute isn't present.

@@ -245,7 +245,7 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap title - string | function + string | element | function ''

Default title value if title attribute isn't present.

diff --git a/docs/components/tooltips.md b/docs/components/tooltips.md index 65bd2703b..f2936469b 100644 --- a/docs/components/tooltips.md +++ b/docs/components/tooltips.md @@ -203,7 +203,7 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap title - string | function + string | element | function ''

Default title value if title attribute isn't present.

-- cgit v1.2.3