]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Remove placement attribute from our Dropdown plugin
authorJohann-S <johann.servoire@gmail.com>
Thu, 7 Sep 2017 10:47:43 +0000 (12:47 +0200)
committerJohann-S <johann.servoire@gmail.com>
Thu, 7 Sep 2017 11:51:25 +0000 (13:51 +0200)
docs/4.0/components/dropdowns.md
js/src/dropdown.js

index 93c9c892a27cb5c8866d1cfb0549e31b4d2507c5..9c611c62912c32238845b7ea9cc96863d5565b0b 100644 (file)
@@ -574,7 +574,7 @@ Regardless of whether you call your dropdown via JavaScript or instead use the d
 
 ### Options
 
-Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-placement=""`.
+Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-offset=""`.
 
 <table class="table table-bordered table-striped table-responsive">
   <thead>
@@ -586,14 +586,6 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
     </tr>
   </thead>
   <tbody>
-    <tr>
-      <td>placement</td>
-      <td>string</td>
-      <td>'bottom'</td>
-      <td>
-        <p>How to position the popover - top | bottom.</p>
-      </td>
-    </tr>
     <tr>
       <td>offset</td>
       <td>number | string</td>
index adb54f0f2138dfb1bb7ca241e8a1154e6047bbd9..f76f84ef0adf1aec41f4f33224cce4162d5601d2 100644 (file)
@@ -75,13 +75,11 @@ const Dropdown = (() => {
   }
 
   const Default = {
-    placement   : AttachmentMap.BOTTOM,
     offset      : 0,
     flip        : true
   }
 
   const DefaultType = {
-    placement   : 'string',
     offset      : '(number|string)',
     flip        : 'boolean'
   }
@@ -203,11 +201,6 @@ const Dropdown = (() => {
     }
 
     _getConfig(config) {
-      const elementData = $(this._element).data()
-      if (typeof elementData.placement !== 'undefined') {
-        elementData.placement = AttachmentMap[elementData.placement.toUpperCase()]
-      }
-
       config = $.extend(
         {},
         this.constructor.Default,
@@ -234,10 +227,10 @@ const Dropdown = (() => {
 
     _getPlacement() {
       const $parentDropdown = $(this._element).parent()
-      let placement = this._config.placement
+      let placement = AttachmentMap.BOTTOM
 
       // Handle dropup
-      if ($parentDropdown.hasClass(ClassName.DROPUP) || this._config.placement === AttachmentMap.TOP) {
+      if ($parentDropdown.hasClass(ClassName.DROPUP)) {
         placement = AttachmentMap.TOP
         if ($(this._menu).hasClass(ClassName.MENURIGHT)) {
           placement = AttachmentMap.TOPEND