Skip to content

Commit

Permalink
Fixing Dropdown clickHandler #114
Browse files Browse the repository at this point in the history
  • Loading branch information
thednp committed Feb 13, 2017
1 parent cf981a6 commit 86fae38
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"authors": [
"dnp_theme"
],
"description": "Native Javascript for Bootstrap 3, the sweetest Javascript library without jQuery.",
"description": "Native Javascript for Bootstrap, the sweetest Javascript library without jQuery.",
"main": "dist/bootstrap-native.js",
"moduleType": [
"globals",
Expand Down
3 changes: 1 addition & 2 deletions dist/bootstrap-native-v4.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,7 @@
},
clickHandler = function(e) {
var eventTarget = e[target], hasData;
if (!eventTarget || !eventTarget[parentNode]) return; // invalidate
hasData = eventTarget[getAttribute](dataToggle) || eventTarget[parentNode][getAttribute](dataToggle);
hasData = ( eventTarget.nodeType !== 1 && (eventTarget[getAttribute](dataToggle) || 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 dist/bootstrap-native-v4.min.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions dist/bootstrap-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -918,8 +918,7 @@
},
clickHandler = function(e) {
var eventTarget = e[target], hasData;
if (!eventTarget || !eventTarget[parentNode]) return; // invalidate
hasData = eventTarget[getAttribute](dataToggle) || eventTarget[parentNode][getAttribute](dataToggle);
hasData = ( eventTarget.nodeType !== 1 && (eventTarget[getAttribute](dataToggle) || 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 dist/bootstrap-native.min.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions lib/V3/dropdown-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ var Dropdown = function( element, option ) {
},
clickHandler = function(e) {
var eventTarget = e[target], hasData;
if (!eventTarget || !eventTarget[parentNode]) return; // invalidate
hasData = eventTarget[getAttribute](dataToggle) || eventTarget[parentNode][getAttribute](dataToggle);
hasData = ( eventTarget.nodeType !== 1 && (eventTarget[getAttribute](dataToggle) || 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
3 changes: 1 addition & 2 deletions lib/V4/dropdown-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ var Dropdown = function( element, option ) {
},
clickHandler = function(e) {
var eventTarget = e[target], hasData;
if (!eventTarget || !eventTarget[parentNode]) return; // invalidate
hasData = eventTarget[getAttribute](dataToggle) || eventTarget[parentNode][getAttribute](dataToggle);
hasData = ( eventTarget.nodeType !== 1 && (eventTarget[getAttribute](dataToggle) || 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,7 +1,7 @@
{
"name": "bootstrap.native",
"version": "2.0.4",
"description": "Native Javascript for Bootstrap 3, the sweetest Javascript library without jQuery.",
"description": "Native Javascript for Bootstrap, the sweetest Javascript library without jQuery.",
"main": "dist/bootstrap-native.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand Down

0 comments on commit 86fae38

Please sign in to comment.