Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
* bump version
* corrected Collapse default transition duration from 300ms to 350ms https://github.com/twbs/bootstrap/blob/v3-dev/less/component-animations.less#L26-L33
* fixed some issue with Collapse when the component was unable to compute child elements' height, now the `in` / `show` class is added to collapsible element first and then the utilities can easily compute the maxHeight
* revert to previous Collapse behavior, now the component will not remove and re-add the `collapse` class from/to the collapsible element, solving some issue with more complex accordion structures
  • Loading branch information
thednp committed Feb 10, 2017
1 parent 72b8394 commit 21a9471
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 36 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.3",
"version": "2.0.4",
"homepage": "http://thednp.github.io/bootstrap.native/",
"authors": [
"dnp_theme"
Expand Down
11 changes: 3 additions & 8 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.3 | © dnp_theme | MIT-License
// Native Javascript for Bootstrap 4 v2.0.4 | © dnp_theme | MIT-License
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD support:
Expand Down Expand Up @@ -643,7 +643,7 @@
options = options || {};
options.duration = parseInt(options.duration || element[getAttribute](dataDuration));

this[duration] = (isIE && isIE < 10) ? 0 : (options.duration || 300); // default collapse transition duration
this[duration] = (isIE && isIE < 10) ? 0 : (options.duration || 350); // default collapse transition duration

// event targets and constants
var accordion = null, collapse = null, self = this,
Expand All @@ -658,16 +658,13 @@
openAction = function(collapseElement) {
bootstrapCustomEvent.call(collapseElement, showEvent, component);
isAnimating = true;
removeClass(collapseElement,component);
addClass(collapseElement,collapsing);
collapseElement.style[height] = '0px';
addClass(collapseElement,showClass);
setTimeout(function() {
collapseElement.style[height] = getMaxHeight(collapseElement) + 'px';
}, 10);
setTimeout(function() {
removeClass(collapseElement,collapsing);
addClass(collapseElement,component);
addClass(collapseElement,showClass);
collapseElement.style[height] = '';
isAnimating = false;
collapseElement[setAttribute](ariaExpanded,'true');
Expand All @@ -677,7 +674,6 @@
closeAction = function(collapseElement) {
bootstrapCustomEvent.call(collapseElement, hideEvent, component);
isAnimating = true;
removeClass(collapseElement,component);
collapseElement.style[height] = getMaxHeight(collapseElement) + 'px';
setTimeout(function() {
addClass(collapseElement,collapsing);
Expand All @@ -686,7 +682,6 @@
setTimeout(function() {
removeClass(collapseElement,collapsing);
removeClass(collapseElement,showClass);
addClass(collapseElement,component);
collapseElement.style[height] = '';
isAnimating = false;
collapseElement[setAttribute](ariaExpanded,'false');
Expand Down
4 changes: 2 additions & 2 deletions dist/bootstrap-native-v4.min.js

Large diffs are not rendered by default.

11 changes: 3 additions & 8 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.3 | © dnp_theme | MIT-License
// Native Javascript for Bootstrap 3 v2.0.4 | © dnp_theme | MIT-License
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD support:
Expand Down Expand Up @@ -802,7 +802,7 @@
options = options || {};
options.duration = parseInt(options.duration || element[getAttribute](dataDuration));

this[duration] = (isIE && isIE < 10) ? 0 : (options.duration || 300); // default collapse transition duration
this[duration] = (isIE && isIE < 10) ? 0 : (options.duration || 350); // default collapse transition duration

// event targets and constants
var accordion = null, collapse = null, self = this,
Expand All @@ -817,16 +817,13 @@
openAction = function(collapseElement) {
bootstrapCustomEvent.call(collapseElement, showEvent, component);
isAnimating = true;
removeClass(collapseElement,component);
addClass(collapseElement,collapsing);
collapseElement.style[height] = '0px';
addClass(collapseElement,inClass);
setTimeout(function() {
collapseElement.style[height] = getMaxHeight(collapseElement) + 'px';
}, 10);
setTimeout(function() {
removeClass(collapseElement,collapsing);
addClass(collapseElement,component);
addClass(collapseElement,inClass);
collapseElement.style[height] = '';
isAnimating = false;
collapseElement[setAttribute](ariaExpanded,'true');
Expand All @@ -836,7 +833,6 @@
closeAction = function(collapseElement) {
bootstrapCustomEvent.call(collapseElement, hideEvent, component);
isAnimating = true;
removeClass(collapseElement,component);
collapseElement.style[height] = getMaxHeight(collapseElement) + 'px';
setTimeout(function() {
addClass(collapseElement,collapsing);
Expand All @@ -845,7 +841,6 @@
setTimeout(function() {
removeClass(collapseElement,collapsing);
removeClass(collapseElement,inClass);
addClass(collapseElement,component);
collapseElement.style[height] = '';
isAnimating = false;
collapseElement[setAttribute](ariaExpanded,'false');
Expand Down
4 changes: 2 additions & 2 deletions dist/bootstrap-native.min.js

Large diffs are not rendered by default.

9 changes: 2 additions & 7 deletions lib/V3/collapse-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var Collapse = function( element, options ) {
options = options || {};
options.duration = parseInt(options.duration || element[getAttribute](dataDuration));

this[duration] = (isIE && isIE < 10) ? 0 : (options.duration || 300); // default collapse transition duration
this[duration] = (isIE && isIE < 10) ? 0 : (options.duration || 350); // default collapse transition duration

// event targets and constants
var accordion = null, collapse = null, self = this,
Expand All @@ -28,16 +28,13 @@ var Collapse = function( element, options ) {
openAction = function(collapseElement) {
bootstrapCustomEvent.call(collapseElement, showEvent, component);
isAnimating = true;
removeClass(collapseElement,component);
addClass(collapseElement,collapsing);
collapseElement.style[height] = '0px';
addClass(collapseElement,inClass);
setTimeout(function() {
collapseElement.style[height] = getMaxHeight(collapseElement) + 'px';
}, 10);
setTimeout(function() {
removeClass(collapseElement,collapsing);
addClass(collapseElement,component);
addClass(collapseElement,inClass);
collapseElement.style[height] = '';
isAnimating = false;
collapseElement[setAttribute](ariaExpanded,'true');
Expand All @@ -47,7 +44,6 @@ var Collapse = function( element, options ) {
closeAction = function(collapseElement) {
bootstrapCustomEvent.call(collapseElement, hideEvent, component);
isAnimating = true;
removeClass(collapseElement,component);
collapseElement.style[height] = getMaxHeight(collapseElement) + 'px';
setTimeout(function() {
addClass(collapseElement,collapsing);
Expand All @@ -56,7 +52,6 @@ var Collapse = function( element, options ) {
setTimeout(function() {
removeClass(collapseElement,collapsing);
removeClass(collapseElement,inClass);
addClass(collapseElement,component);
collapseElement.style[height] = '';
isAnimating = false;
collapseElement[setAttribute](ariaExpanded,'false');
Expand Down
9 changes: 2 additions & 7 deletions lib/V4/collapse-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var Collapse = function( element, options ) {
options = options || {};
options.duration = parseInt(options.duration || element[getAttribute](dataDuration));

this[duration] = (isIE && isIE < 10) ? 0 : (options.duration || 300); // default collapse transition duration
this[duration] = (isIE && isIE < 10) ? 0 : (options.duration || 350); // default collapse transition duration

// event targets and constants
var accordion = null, collapse = null, self = this,
Expand All @@ -28,16 +28,13 @@ var Collapse = function( element, options ) {
openAction = function(collapseElement) {
bootstrapCustomEvent.call(collapseElement, showEvent, component);
isAnimating = true;
removeClass(collapseElement,component);
addClass(collapseElement,collapsing);
collapseElement.style[height] = '0px';
addClass(collapseElement,showClass);
setTimeout(function() {
collapseElement.style[height] = getMaxHeight(collapseElement) + 'px';
}, 10);
setTimeout(function() {
removeClass(collapseElement,collapsing);
addClass(collapseElement,component);
addClass(collapseElement,showClass);
collapseElement.style[height] = '';
isAnimating = false;
collapseElement[setAttribute](ariaExpanded,'true');
Expand All @@ -47,7 +44,6 @@ var Collapse = function( element, options ) {
closeAction = function(collapseElement) {
bootstrapCustomEvent.call(collapseElement, hideEvent, component);
isAnimating = true;
removeClass(collapseElement,component);
collapseElement.style[height] = getMaxHeight(collapseElement) + 'px';
setTimeout(function() {
addClass(collapseElement,collapsing);
Expand All @@ -56,7 +52,6 @@ var Collapse = function( element, options ) {
setTimeout(function() {
removeClass(collapseElement,collapsing);
removeClass(collapseElement,showClass);
addClass(collapseElement,component);
collapseElement.style[height] = '';
isAnimating = false;
collapseElement[setAttribute](ariaExpanded,'false');
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.3",
"version": "2.0.4",
"description": "Native Javascript for Bootstrap 3, the sweetest Javascript library without jQuery.",
"main": "dist/bootstrap-native.js",
"scripts": {
Expand Down

0 comments on commit 21a9471

Please sign in to comment.