bootstrap-submenu
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -30,19 +30,5 @@ (function (factory) { | ||
var dropdownItemNodeList = this.menuElement.querySelectorAll('.dropdown-item'); | ||
for (var _iterator = dropdownItemNodeList, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var element = _ref; | ||
element.addEventListener('keydown', this.handleKeydownDropdownItem.bind(this)); | ||
} | ||
Array.from(dropdownItemNodeList).forEach(function (element) { | ||
element.addEventListener('keydown', _this.handleKeydownDropdownItem.bind(_this)); | ||
}); | ||
$(this.menuElement).on('keydown', '.dropdown-submenu > .dropdown-item', this.handleKeydownSubmenuDropdownItem.bind(this)); | ||
@@ -91,5 +77,3 @@ $(this.menuElement).on('click', '.dropdown-submenu > .dropdown-item', this.handleClickSubmenuDropdownItem.bind(this)); | ||
var itemNodeList = this.element.querySelectorAll('.show > .dropdown-item:not(:disabled):not(.disabled), .show > .dropdown > .dropdown-item'); | ||
var index = Array.from(itemNodeList).findIndex(function (element) { | ||
return element === event.target; | ||
}); | ||
var index = Array.from(itemNodeList).indexOf(event.target); | ||
@@ -118,18 +102,5 @@ if (event.keyCode === 38 && index !== 0) { | ||
var menuNodeList = menuElement.querySelectorAll('.dropdown-menu.show'); | ||
for (var _iterator2 = menuNodeList, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
var element = _ref2; | ||
Array.from(menuNodeList).forEach(function (element) { | ||
element.classList.remove('show'); | ||
} | ||
}); | ||
}; | ||
@@ -136,0 +107,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(factory){"function"==typeof define&&define.amd?define(["jquery"],factory):"object"==typeof exports?module.exports=factory(require("jquery")):factory(jQuery)}(function($){var DropdownSubmenu=function(){function DropdownSubmenu(element){this.element=element.parentElement,this.menuElement=this.element.querySelector(".dropdown-menu"),this.init()}var _proto=DropdownSubmenu.prototype;return _proto.init=function(){var _this=this;$(this.element).off("keydown.bs.dropdown.data-api"),this.menuElement.addEventListener("keydown",this.itemKeydown.bind(this));var _iterator=this.menuElement.querySelectorAll(".dropdown-item"),_isArray=Array.isArray(_iterator),_i=0;for(_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i>=_iterator.length)break;_ref=_iterator[_i++]}else{if((_i=_iterator.next()).done)break;_ref=_i.value}_ref.addEventListener("keydown",this.handleKeydownDropdownItem.bind(this))}$(this.menuElement).on("keydown",".dropdown-submenu > .dropdown-item",this.handleKeydownSubmenuDropdownItem.bind(this)),$(this.menuElement).on("click",".dropdown-submenu > .dropdown-item",this.handleClickSubmenuDropdownItem.bind(this)),$(this.element).on("hidden.bs.dropdown",function(){_this.close(_this.menuElement)})},_proto.handleKeydownDropdownItem=function(event){27===event.keyCode&&(event.target.closest(".dropdown-menu").previousElementSibling.focus(),event.target.closest(".dropdown-menu").classList.remove("show"))},_proto.handleKeydownSubmenuDropdownItem=function(event){32===event.keyCode&&(event.preventDefault(),this.toggle(event.target))},_proto.handleClickSubmenuDropdownItem=function(event){event.stopPropagation(),this.toggle(event.target)},_proto.itemKeydown=function(event){if([38,40].includes(event.keyCode)){event.preventDefault(),event.stopPropagation();var itemNodeList=this.element.querySelectorAll(".show > .dropdown-item:not(:disabled):not(.disabled), .show > .dropdown > .dropdown-item"),index=Array.from(itemNodeList).findIndex(function(element){return element===event.target});if(38===event.keyCode&&0!==index)index--;else{if(40!==event.keyCode||index===itemNodeList.length-1)return;index++}itemNodeList[index].focus()}},_proto.toggle=function(element){var dropdownElement=element.closest(".dropdown"),parentMenuElement=dropdownElement.closest(".dropdown-menu"),menuElement=dropdownElement.querySelector(".dropdown-menu"),isOpen=menuElement.classList.contains("show");this.close(parentMenuElement),menuElement.classList.toggle("show",!isOpen)},_proto.close=function(menuElement){var _iterator2=menuElement.querySelectorAll(".dropdown-menu.show"),_isArray2=Array.isArray(_iterator2),_i2=0;for(_iterator2=_isArray2?_iterator2:_iterator2[Symbol.iterator]();;){var _ref2;if(_isArray2){if(_i2>=_iterator2.length)break;_ref2=_iterator2[_i2++]}else{if((_i2=_iterator2.next()).done)break;_ref2=_i2.value}_ref2.classList.remove("show")}},DropdownSubmenu}();return $.fn.submenupicker=function(elements){return(this instanceof $?this:$(elements)).each(function(){var data=$.data(this,"bs.submenu");data||(data=new DropdownSubmenu(this),$.data(this,"bs.submenu",data))})},DropdownSubmenu}); | ||
!function(factory){"function"==typeof define&&define.amd?define(["jquery"],factory):"object"==typeof exports?module.exports=factory(require("jquery")):factory(jQuery)}(function($){var DropdownSubmenu=function(){function DropdownSubmenu(element){this.element=element.parentElement,this.menuElement=this.element.querySelector(".dropdown-menu"),this.init()}var _proto=DropdownSubmenu.prototype;return _proto.init=function(){var _this=this;$(this.element).off("keydown.bs.dropdown.data-api"),this.menuElement.addEventListener("keydown",this.itemKeydown.bind(this));var dropdownItemNodeList=this.menuElement.querySelectorAll(".dropdown-item");Array.from(dropdownItemNodeList).forEach(function(element){element.addEventListener("keydown",_this.handleKeydownDropdownItem.bind(_this))}),$(this.menuElement).on("keydown",".dropdown-submenu > .dropdown-item",this.handleKeydownSubmenuDropdownItem.bind(this)),$(this.menuElement).on("click",".dropdown-submenu > .dropdown-item",this.handleClickSubmenuDropdownItem.bind(this)),$(this.element).on("hidden.bs.dropdown",function(){_this.close(_this.menuElement)})},_proto.handleKeydownDropdownItem=function(event){27===event.keyCode&&(event.target.closest(".dropdown-menu").previousElementSibling.focus(),event.target.closest(".dropdown-menu").classList.remove("show"))},_proto.handleKeydownSubmenuDropdownItem=function(event){32===event.keyCode&&(event.preventDefault(),this.toggle(event.target))},_proto.handleClickSubmenuDropdownItem=function(event){event.stopPropagation(),this.toggle(event.target)},_proto.itemKeydown=function(event){if([38,40].includes(event.keyCode)){event.preventDefault(),event.stopPropagation();var itemNodeList=this.element.querySelectorAll(".show > .dropdown-item:not(:disabled):not(.disabled), .show > .dropdown > .dropdown-item"),index=Array.from(itemNodeList).indexOf(event.target);if(38===event.keyCode&&0!==index)index--;else{if(40!==event.keyCode||index===itemNodeList.length-1)return;index++}itemNodeList[index].focus()}},_proto.toggle=function(element){var dropdownElement=element.closest(".dropdown"),parentMenuElement=dropdownElement.closest(".dropdown-menu"),menuElement=dropdownElement.querySelector(".dropdown-menu"),isOpen=menuElement.classList.contains("show");this.close(parentMenuElement),menuElement.classList.toggle("show",!isOpen)},_proto.close=function(menuElement){var menuNodeList=menuElement.querySelectorAll(".dropdown-menu.show");Array.from(menuNodeList).forEach(function(element){element.classList.remove("show")})},DropdownSubmenu}();return $.fn.submenupicker=function(elements){return(this instanceof $?this:$(elements)).each(function(){var data=$.data(this,"bs.submenu");data||(data=new DropdownSubmenu(this),$.data(this,"bs.submenu",data))})},DropdownSubmenu}); |
@@ -28,5 +28,5 @@ (function(factory) { | ||
for (const element of dropdownItemNodeList) { | ||
Array.from(dropdownItemNodeList).forEach((element) => { | ||
element.addEventListener('keydown', this.handleKeydownDropdownItem.bind(this)); | ||
} | ||
}); | ||
@@ -81,5 +81,3 @@ $(this.menuElement).on('keydown', '.dropdown-submenu > .dropdown-item', this.handleKeydownSubmenuDropdownItem.bind(this)); | ||
let index = Array.from(itemNodeList).findIndex((element) => { | ||
return element === event.target; | ||
}); | ||
let index = Array.from(itemNodeList).indexOf(event.target); | ||
@@ -111,5 +109,5 @@ if (event.keyCode === 38 && index !== 0) { | ||
for (const element of menuNodeList) { | ||
Array.from(menuNodeList).forEach((element) => { | ||
element.classList.remove('show'); | ||
} | ||
}); | ||
} | ||
@@ -116,0 +114,0 @@ } |
{ | ||
"name": "bootstrap-submenu", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Bootstrap Sub-Menus", | ||
@@ -35,9 +35,8 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/cli": "7.0.0-beta.44", | ||
"@babel/core": "7.0.0-beta.44", | ||
"@babel/preset-env": "7.0.0-beta.44", | ||
"bootstrap": "4.0.0", | ||
"@babel/cli": "7.0.0-beta.52", | ||
"@babel/core": "7.0.0-beta.52", | ||
"@babel/preset-env": "7.0.0-beta.52", | ||
"clean-css-cli": "4.1.11", | ||
"uglify-js": "3.3.20" | ||
"uglify-js": "3.4.1" | ||
} | ||
} |
@@ -13,3 +13,3 @@ # [Bootstrap-submenu](https://vsn4ik.github.io/bootstrap-submenu/) | ||
* [Download the latest release](https://github.com/vsn4ik/bootstrap-submenu/archive/v3.0.0.zip "Download Bootstrap-submenu") | ||
* [Download the latest release](https://github.com/vsn4ik/bootstrap-submenu/archive/v3.0.1.zip "Download Bootstrap-submenu") | ||
* Clone the repo: `git clone https://github.com/vsn4ik/bootstrap-submenu.git` | ||
@@ -16,0 +16,0 @@ * Install with [npm](https://www.npmjs.com): `npm install bootstrap-submenu` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
5
0
17384
252