Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates docs to match Tooltip type checking #22342

Merged
merged 2 commits into from
Oct 3, 2017

Conversation

gareth
Copy link
Contributor

@gareth gareth commented Apr 3, 2017

Spotted when looking up documentation for Popups, and wondering why a raw element couldn't be passed in as a container according to the documentation - I looked in the source and saw that it could – whatever's in container (if truthy) gets passed into jQuery's appendTo!

I also spotted that the Tooltip type checking explicitly allows for an element to be passed, it's literally just that the documentation is out of sync.

With this change, the documentation for Tooltip and Popover now matches the types defined in the DefaultType constant in js/src/tooltip.js

@gareth gareth force-pushed the fix-tooltip-documentation branch 2 times, most recently from 0c4614e to 99e82eb Compare April 4, 2017 08:42
@@ -181,7 +181,7 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
</tr>
<tr>
<td>container</td>
<td>string | false</td>
<td>string | element | boolean</td>
Copy link

@samjewell samjewell Apr 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you felt like it, you could also change false to boolean on the tooltip container docs too:

From:

<td>container</td>
<td>string | element | false</td>

to:

<td>container</td>
<td>string | element | boolean</td>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with @samjewell

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly, if you actually set container: true then the tooltip/popover won't work properly, because of this line:

var container = this.config.container === false ? document.body : $(this.config.container);

I'm actually going to change these updates back to false to make that clear. The important thing for this PR is that element is added.

@mdo mdo requested a review from Johann-S October 3, 2017 04:03
@Johann-S
Copy link
Member

Johann-S commented Oct 3, 2017

@gareth you have conflicts in your issue can you update your branch please ?

Documentation now matches the types defined in the DefaultType constant in
js/src/tooltip.js
@gareth
Copy link
Contributor Author

gareth commented Oct 3, 2017

@Johann-S Rebased

@Johann-S Johann-S merged commit a02d068 into twbs:v4-dev Oct 3, 2017
@mdo mdo mentioned this pull request Oct 3, 2017
@gareth gareth deleted the fix-tooltip-documentation branch October 3, 2017 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants