Skip to content

Commit b822b5a

Browse files
committed
Remove placement attribute from our Dropdown plugin
1 parent 7983ba9 commit b822b5a

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

docs/4.0/components/dropdowns.md

+1-9
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ Regardless of whether you call your dropdown via JavaScript or instead use the d
574574

575575
### Options
576576

577-
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-placement=""`.
577+
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-offset=""`.
578578

579579
<table class="table table-bordered table-striped table-responsive">
580580
<thead>
@@ -586,14 +586,6 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
586586
</tr>
587587
</thead>
588588
<tbody>
589-
<tr>
590-
<td>placement</td>
591-
<td>string</td>
592-
<td>'bottom'</td>
593-
<td>
594-
<p>How to position the popover - top | bottom.</p>
595-
</td>
596-
</tr>
597589
<tr>
598590
<td>offset</td>
599591
<td>number | string</td>

js/src/dropdown.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,11 @@ const Dropdown = (() => {
7575
}
7676

7777
const Default = {
78-
placement : AttachmentMap.BOTTOM,
7978
offset : 0,
8079
flip : true
8180
}
8281

8382
const DefaultType = {
84-
placement : 'string',
8583
offset : '(number|string)',
8684
flip : 'boolean'
8785
}
@@ -203,11 +201,6 @@ const Dropdown = (() => {
203201
}
204202

205203
_getConfig(config) {
206-
const elementData = $(this._element).data()
207-
if (typeof elementData.placement !== 'undefined') {
208-
elementData.placement = AttachmentMap[elementData.placement.toUpperCase()]
209-
}
210-
211204
config = $.extend(
212205
{},
213206
this.constructor.Default,
@@ -234,10 +227,10 @@ const Dropdown = (() => {
234227

235228
_getPlacement() {
236229
const $parentDropdown = $(this._element).parent()
237-
let placement = this._config.placement
230+
let placement = AttachmentMap.BOTTOM
238231

239232
// Handle dropup
240-
if ($parentDropdown.hasClass(ClassName.DROPUP) || this._config.placement === AttachmentMap.TOP) {
233+
if ($parentDropdown.hasClass(ClassName.DROPUP)) {
241234
placement = AttachmentMap.TOP
242235
if ($(this._menu).hasClass(ClassName.MENURIGHT)) {
243236
placement = AttachmentMap.TOPEND

0 commit comments

Comments
 (0)