Commit c090c79a authored by XhmikosR's avatar XhmikosR Committed by GitHub
Browse files

Merge branch 'v4-dev' into btn-active

parents 8e56145e 3eae92f1
Showing with 73 additions and 57 deletions
+73 -57
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -62,14 +62,14 @@ var Collapse = function () {
var Selector = {
ACTIVES: '.show, .collapsing',
DATA_TOGGLE: '[data-toggle="collapse"]'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Collapse = function () {
function Collapse(element, config) {
_classCallCheck(this, Collapse);
......@@ -353,7 +353,7 @@ var Collapse = function () {
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
if (event.target.tagName === 'A' && !$.contains(this, event.target)) {
if (event.currentTarget.tagName === 'A') {
event.preventDefault();
}
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -85,14 +85,14 @@ var Dropdown = function () {
var DefaultType = {
offset: '(number|string)',
flip: 'boolean'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Dropdown = function () {
function Dropdown(element, config) {
_classCallCheck(this, Dropdown);
......@@ -249,10 +249,9 @@ var Dropdown = function () {
enabled: this._config.flip
}
}
};
// Disable Popper.js for Dropdown in Navbar
if (this._inNavbar) {
// Disable Popper.js for Dropdown in Navbar
};if (this._inNavbar) {
popperConfig.modifiers.applyStyle = {
enabled: !this._inNavbar
};
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -74,14 +74,14 @@ var Modal = function () {
FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
STICKY_CONTENT: '.sticky-top',
NAVBAR_TOGGLER: '.navbar-toggler'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Modal = function () {
function Modal(element, config) {
_classCallCheck(this, Modal);
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -65,14 +65,14 @@ var Popover = function () {
FOCUSOUT: 'focusout' + EVENT_KEY,
MOUSEENTER: 'mouseenter' + EVENT_KEY,
MOUSELEAVE: 'mouseleave' + EVENT_KEY
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Popover = function (_Tooltip) {
_inherits(Popover, _Tooltip);
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -66,14 +66,14 @@ var ScrollSpy = function () {
var OffsetMethod = {
OFFSET: 'offset',
POSITION: 'position'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var ScrollSpy = function () {
function ScrollSpy(element, config) {
var _this = this;
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -51,14 +51,14 @@ var Tab = function () {
DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
DROPDOWN_TOGGLE: '.dropdown-toggle',
DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Tab = function () {
function Tab(element) {
_classCallCheck(this, Tab);
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -108,14 +108,14 @@ var Tooltip = function () {
FOCUS: 'focus',
CLICK: 'click',
MANUAL: 'manual'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
};
var Tooltip = function () {
function Tooltip(element, config) {
_classCallCheck(this, Tooltip);
......@@ -569,18 +569,18 @@ var Tooltip = function () {
value: function _getConfig(config) {
config = $.extend({}, this.constructor.Default, $(this.element).data(), config);
if (config.delay && typeof config.delay === 'number') {
if (typeof config.delay === 'number') {
config.delay = {
show: config.delay,
hide: config.delay
};
}
if (config.title && typeof config.title === 'number') {
if (typeof config.title === 'number') {
config.title = config.title.toString();
}
if (config.content && typeof config.content === 'number') {
if (typeof config.content === 'number') {
config.content = config.content.toString();
}
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -24,10 +24,9 @@ var Util = function () {
MozTransition: 'transitionend',
OTransition: 'oTransitionEnd otransitionend',
transition: 'transitionend'
};
// shoutout AngusCroll (https://goo.gl/pxwQGp)
function toType(obj) {
// shoutout AngusCroll (https://goo.gl/pxwQGp)
};function toType(obj) {
return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
}
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -33,7 +33,7 @@ const Collapse = (() => {
const DefaultType = {
toggle : 'boolean',
parent : 'string'
parent : '(string|element)'
}
const Event = {
......@@ -289,7 +289,18 @@ const Collapse = (() => {
}
_getParent() {
const parent = $(this._config.parent)[0]
let parent = null
if (Util.isElement(this._config.parent)) {
parent = this._config.parent
// it's a jQuery object
if (typeof this._config.parent.jquery !== 'undefined') {
parent = this._config.parent[0]
}
} else {
parent = $(this._config.parent)[0]
}
const selector =
`[data-toggle="collapse"][data-parent="${this._config.parent}"]`
......@@ -363,7 +374,7 @@ const Collapse = (() => {
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
if (event.target.tagName === 'A' && !$.contains(this, event.target)) {
if (event.currentTarget.tagName === 'A') {
event.preventDefault()
}
......
......@@ -54,6 +54,7 @@ const ScrollSpy = (() => {
ACTIVE : '.active',
NAV_LIST_GROUP : '.nav, .list-group',
NAV_LINKS : '.nav-link',
NAV_ITEMS : '.nav-item',
LIST_ITEMS : '.list-group-item',
DROPDOWN : '.dropdown',
DROPDOWN_ITEMS : '.dropdown-item',
......@@ -264,6 +265,8 @@ const ScrollSpy = (() => {
// Set triggered links parents as active
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
$link.parents(Selector.NAV_LIST_GROUP).prev(`${Selector.NAV_LINKS}, ${Selector.LIST_ITEMS}`).addClass(ClassName.ACTIVE)
// Handle special case when .nav-link is inside .nav-item
$link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_ITEMS).children(Selector.NAV_LINKS).addClass(ClassName.ACTIVE)
}
$(this._scrollElement).trigger(Event.ACTIVATE, {
......
......@@ -196,11 +196,15 @@ const Tab = (() => {
$(dropdownChild).removeClass(ClassName.ACTIVE)
}
active.setAttribute('aria-expanded', false)
if (active.getAttribute('role') === 'tab') {
active.setAttribute('aria-selected', false)
}
}
$(element).addClass(ClassName.ACTIVE)
element.setAttribute('aria-expanded', true)
if (element.getAttribute('role') === 'tab') {
element.setAttribute('aria-selected', true)
}
if (isTransitioning) {
Util.reflow(element)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment