Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
* fixed Dropdown nesting
* bumped up version
* added nested Dropdown example to V4
  • Loading branch information
thednp committed Jun 13, 2017
1 parent 8329559 commit 0aa7eed
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 26 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap.native",
"version": "2.0.10",
"version": "2.0.11",
"homepage": "http://thednp.github.io/bootstrap.native/",
"authors": [
"dnp_theme"
Expand Down
6 changes: 3 additions & 3 deletions dist/bootstrap-native-v4.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Native Javascript for Bootstrap 4 v2.0.10 | © dnp_theme | MIT-License
// Native Javascript for Bootstrap 4 v2.0.11 | © dnp_theme | MIT-License
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD support:
Expand Down Expand Up @@ -792,8 +792,8 @@
if (isOpen && (e.which == 27 || e.keyCode == 27)) { relatedTarget = null; hide(); } // e.keyCode for IE8
},
clickHandler = function(e) {
var eventTarget = e[target], hasData;
hasData = ( eventTarget.nodeType !== 1 && (eventTarget[getAttribute](dataToggle) || eventTarget[parentNode][getAttribute](dataToggle)) );
var eventTarget = e[target],
hasData = eventTarget && (eventTarget[getAttribute](dataToggle) || eventTarget[parentNode] && eventTarget[parentNode][getAttribute](dataToggle));
if ( eventTarget === element || eventTarget === parent || eventTarget[parentNode] === element ) {
e.preventDefault(); // comment this line to stop preventing navigation when click target is a link
relatedTarget = element;
Expand Down
4 changes: 2 additions & 2 deletions dist/bootstrap-native-v4.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/bootstrap-native.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Native Javascript for Bootstrap 3 v2.0.10 | © dnp_theme | MIT-License
// Native Javascript for Bootstrap 3 v2.0.11 | © dnp_theme | MIT-License
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD support:
Expand Down Expand Up @@ -949,14 +949,14 @@
if (isOpen && (e.which == 27 || e.keyCode == 27)) { relatedTarget = null; hide(); } // e.keyCode for IE8
},
clickHandler = function(e) {
var eventTarget = e[target], hasData;
hasData = ( eventTarget.nodeType !== 1 && (eventTarget[getAttribute](dataToggle) || eventTarget[parentNode][getAttribute](dataToggle)) );
var eventTarget = e[target],
hasData = eventTarget && (eventTarget[getAttribute](dataToggle) || eventTarget[parentNode] && eventTarget[parentNode][getAttribute](dataToggle));
if ( eventTarget === element || eventTarget === parent || eventTarget[parentNode] === element ) {
e.preventDefault(); // comment this line to stop preventing navigation when click target is a link
relatedTarget = element;
self.toggle();
} else if ( isOpen ) {
if ( (eventTarget === menu || children && children[indexOf](eventTarget) > -1) && ( self.persist || hasData ) ) {
if ( eventTarget === menu || children && children[indexOf](eventTarget) > -1 && (self.persist || hasData) ) {
return;
} else { relatedTarget = null; hide(); }
}
Expand Down
4 changes: 2 additions & 2 deletions dist/bootstrap-native.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/V3/dropdown-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ var Dropdown = function( element, option ) {
if (isOpen && (e.which == 27 || e.keyCode == 27)) { relatedTarget = null; hide(); } // e.keyCode for IE8
},
clickHandler = function(e) {
var eventTarget = e[target], hasData;
hasData = ( eventTarget.nodeType !== 1 && (eventTarget[getAttribute](dataToggle) || eventTarget[parentNode][getAttribute](dataToggle)) );
var eventTarget = e[target],
hasData = eventTarget && (eventTarget[getAttribute](dataToggle) || eventTarget[parentNode] && eventTarget[parentNode][getAttribute](dataToggle));
if ( eventTarget === element || eventTarget === parent || eventTarget[parentNode] === element ) {
e.preventDefault(); // comment this line to stop preventing navigation when click target is a link
relatedTarget = element;
self.toggle();
} else if ( isOpen ) {
if ( (eventTarget === menu || children && children[indexOf](eventTarget) > -1) && ( self.persist || hasData ) ) {
if ( eventTarget === menu || children && children[indexOf](eventTarget) > -1 && (self.persist || hasData) ) {
return;
} else { relatedTarget = null; hide(); }
}
Expand Down
4 changes: 2 additions & 2 deletions lib/V4/dropdown-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ var Dropdown = function( element, option ) {
if (isOpen && (e.which == 27 || e.keyCode == 27)) { relatedTarget = null; hide(); } // e.keyCode for IE8
},
clickHandler = function(e) {
var eventTarget = e[target], hasData;
hasData = ( eventTarget.nodeType !== 1 && (eventTarget[getAttribute](dataToggle) || eventTarget[parentNode][getAttribute](dataToggle)) );
var eventTarget = e[target],
hasData = eventTarget && (eventTarget[getAttribute](dataToggle) || eventTarget[parentNode] && eventTarget[parentNode][getAttribute](dataToggle));
if ( eventTarget === element || eventTarget === parent || eventTarget[parentNode] === element ) {
e.preventDefault(); // comment this line to stop preventing navigation when click target is a link
relatedTarget = element;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap.native",
"version": "2.0.10",
"version": "2.0.11",
"description": "Native Javascript for Bootstrap, the sweetest Javascript library without jQuery.",
"main": "dist/bootstrap-native.js",
"scripts": {
Expand Down
47 changes: 39 additions & 8 deletions v4.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
-webkit-transition-timing-function: cubic-bezier(.45,.18,0,1);
transition-timing-function: cubic-bezier(.45,.18,0,1);
}
.dropdown-menu .dropdown-menu {
top: -1px;
left: 100%;
margin: 0 0 0 3px;
}

@media (max-width: 575px) {
#myCarousel .container {
Expand Down Expand Up @@ -411,15 +416,41 @@ <h5 class="mb-0">

<h2>Dropdown</h2>
<div class="bd-example" data-example-id="">
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown button
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>

<div class="row">
<div class="" style="margin-right: 5px">
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown button
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
</div>

<div>
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Nested Dropdown
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton2">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown">
<a class="dropdown-item dropdown-toggle" href="#" id="dropdownMenuButton3" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">More</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton3">
<a class="dropdown-item" href="#">The other action</a>
<a class="dropdown-item" href="#">Different action</a>
<a class="dropdown-item" href="#" >More soon</a>
</div>
</div>
</div>
</div>
</div>

</div>
</div>
<div class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">"dropdown"</span><span class="nt">&gt;</span>
Expand Down

0 comments on commit 0aa7eed

Please sign in to comment.