diff --git a/CHANGELOG.md b/CHANGELOG.md index 07036f5..83c393f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,76 @@ + +# 0.7.0 (2016-01-04) + +### release summary + +* added build tasks +* added selenium unit tests +* added lint tests +* added `matchHeight.version` property +* added to npm + +* fixed unitless properties +* fixed inline styles being removed +* fixed `display: flex` issue +* fixed `display: inline-flex` issue +* fixed row detection when items contain floating elements +* fixed compatibility for module loaders + +### commit log + +* add custom version argument to gulp build ([ad8aac5](https://github.com/liabru/jquery-match-height/commit/ad8aac5)) +* add delay to jasmine boot ([30824fb](https://github.com/liabru/jquery-match-height/commit/30824fb)) +* add lint to all test tasks ([6b16f67](https://github.com/liabru/jquery-match-height/commit/6b16f67)) +* add test for _parse on string values with units ([4a64208](https://github.com/liabru/jquery-match-height/commit/4a64208)) +* add to npm ([0055660](https://github.com/liabru/jquery-match-height/commit/0055660)) +* added a section on tests to readme ([e0be682](https://github.com/liabru/jquery-match-height/commit/e0be682)) +* added changelog task ([5263ab1](https://github.com/liabru/jquery-match-height/commit/5263ab1)) +* added cloud selenium, local emulated ie testing, lint task, build task, release task, improved tests ([06bd876](https://github.com/liabru/jquery-match-height/commit/06bd876)) +* added gulpfile, jasmine test specs, browser test runner, selenium test runner ([ca926de](https://github.com/liabru/jquery-match-height/commit/ca926de)) +* added libscore ([03a4317](https://github.com/liabru/jquery-match-height/commit/03a4317)) +* added matchHeight.version property ([431e4d0](https://github.com/liabru/jquery-match-height/commit/431e4d0)) +* added release tasks ([49cc72f](https://github.com/liabru/jquery-match-height/commit/49cc72f)) +* added test for property option ([7bdada7](https://github.com/liabru/jquery-match-height/commit/7bdada7)) +* added test for remove ([445799d](https://github.com/liabru/jquery-match-height/commit/445799d)) +* added tests for custom toBeWithinTolerance matcher ([a89b1c2](https://github.com/liabru/jquery-match-height/commit/a89b1c2)) +* bump jquery package version ([cc9c416](https://github.com/liabru/jquery-match-height/commit/cc9c416)) +* change tests to use jquery type checking functions ([6cf52f0](https://github.com/liabru/jquery-match-height/commit/6cf52f0)) +* faster selenium testing ([a6b2da3](https://github.com/liabru/jquery-match-height/commit/a6b2da3)) +* fix bower instructions in readme ([91e50ad](https://github.com/liabru/jquery-match-height/commit/91e50ad)) +* fix for display: inline-flex, closes #68 ([e769b9f](https://github.com/liabru/jquery-match-height/commit/e769b9f)), closes [#68](https://github.com/liabru/jquery-match-height/issues/68) +* fix for unitless properties by forcing px, closes #64 ([d8cc365](https://github.com/liabru/jquery-match-height/commit/d8cc365)), closes [#64](https://github.com/liabru/jquery-match-height/issues/64) +* fix issue maintaining inline styles, closes #95 ([878ff96](https://github.com/liabru/jquery-match-height/commit/878ff96)), closes [#95](https://github.com/liabru/jquery-match-height/issues/95) +* fix issue with 'display:flex', closes #77 ([dc53a49](https://github.com/liabru/jquery-match-height/commit/dc53a49)), closes [#77](https://github.com/liabru/jquery-match-height/issues/77) +* fix issues with build script ([1195421](https://github.com/liabru/jquery-match-height/commit/1195421)) +* fix linter issues ([0165e74](https://github.com/liabru/jquery-match-height/commit/0165e74)) +* Fix package manager registries URLs ([036df1b](https://github.com/liabru/jquery-match-height/commit/036df1b)) +* fixed local test config for non-windows ([d67ca25](https://github.com/liabru/jquery-match-height/commit/d67ca25)) +* fixed missing dependencies ([c608b80](https://github.com/liabru/jquery-match-height/commit/c608b80)) +* handle error when test server is already running ([9e6487d](https://github.com/liabru/jquery-match-height/commit/9e6487d)) +* ignore linebreak style on lint ([1510b58](https://github.com/liabru/jquery-match-height/commit/1510b58)) +* Improve row detection when cells contain floating contents ([8844acb](https://github.com/liabru/jquery-match-height/commit/8844acb)) +* improved readme ([1cf2c27](https://github.com/liabru/jquery-match-height/commit/1cf2c27)) +* improved tasks ([61a9ed4](https://github.com/liabru/jquery-match-height/commit/61a9ed4)) +* improved tests ([b1cadb5](https://github.com/liabru/jquery-match-height/commit/b1cadb5)) +* Make plugin compatible with module loaders ([b5988c1](https://github.com/liabru/jquery-match-height/commit/b5988c1)) +* Merge branch 'feature/tests' into develop ([a7d35dc](https://github.com/liabru/jquery-match-height/commit/a7d35dc)) +* Merge branch 'floatingcontents' of https://github.com/jorrit/jquery-match-height into jorrit-floatin ([89b74a7](https://github.com/liabru/jquery-match-height/commit/89b74a7)) +* Merge branch 'jorrit-floatingcontents' ([dc9716b](https://github.com/liabru/jquery-match-height/commit/dc9716b)) +* Merge pull request #81 from afelicioni/patch-1 ([c5566da](https://github.com/liabru/jquery-match-height/commit/c5566da)) +* Merge pull request #82 from JulienMelissas/patch-1 ([63d8ca4](https://github.com/liabru/jquery-match-height/commit/63d8ca4)) +* remove ie testing meta tags ([44ed2fe](https://github.com/liabru/jquery-match-height/commit/44ed2fe)) +* replace browserstack tunnel with ngrok ([2c67ca0](https://github.com/liabru/jquery-match-height/commit/2c67ca0)) +* run webdriver spec for all breakpoints ([3440598](https://github.com/liabru/jquery-match-height/commit/3440598)) +* update master build ([df2e0c2](https://github.com/liabru/jquery-match-height/commit/df2e0c2)) +* update master build ([f4b4b98](https://github.com/liabru/jquery-match-height/commit/f4b4b98)) +* updated min file ([99648ca](https://github.com/liabru/jquery-match-height/commit/99648ca)) +* use a spy for callback tests ([a72a2cf](https://github.com/liabru/jquery-match-height/commit/a72a2cf)) +* use gutil.log ([00a91bc](https://github.com/liabru/jquery-match-height/commit/00a91bc)) +* use local test images ([02398d9](https://github.com/liabru/jquery-match-height/commit/02398d9)) +* Use unminified version in Bower's "main" argument ([eedca73](https://github.com/liabru/jquery-match-height/commit/eedca73)) + + + # 0.6.0 (2015-03-31) @@ -67,7 +140,7 @@ -## 0.5.2 (2014-06-10) +# 0.5.2 (2014-06-10) ### release summary @@ -89,7 +162,7 @@ -## 0.5.1 (2014-04-15) +# 0.5.1 (2014-04-15) ### release summary diff --git a/bower.json b/bower.json index d708a34..ae3c679 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "matchHeight", - "version": "0.6.0", + "version": "0.7.0", "homepage": "https://github.com/liabru/jquery-match-height", "authors": [ "Liam Brummitt (http://brm.io/)" diff --git a/dist/jquery.matchHeight-min.js b/dist/jquery.matchHeight-min.js index f92f62c..495e112 100644 --- a/dist/jquery.matchHeight-min.js +++ b/dist/jquery.matchHeight-min.js @@ -1,11 +1,12 @@ -/** -* jquery.matchHeight-min.js v0.6.0 +/* +* jquery-match-height 0.7.0 by @liabru * http://brm.io/jquery-match-height/ -* License: MIT +* License MIT */ -(function(c){var n=-1,f=-1,g=function(a){return parseFloat(a)||0},r=function(a){var b=null,d=[];c(a).each(function(){var a=c(this),k=a.offset().top-g(a.css("margin-top")),l=0=Math.floor(Math.abs(b-k))?d[d.length-1]=l.add(a):d.push(a);b=k});return d},p=function(a){var b={byRow:!0,property:"height",target:null,remove:!1};if("object"===typeof a)return c.extend(b,a);"boolean"===typeof a?b.byRow=a:"remove"===a&&(b.remove=!0);return b},b=c.fn.matchHeight= -function(a){a=p(a);if(a.remove){var e=this;this.css(a.property,"");c.each(b._groups,function(a,b){b.elements=b.elements.not(e)});return this}if(1>=this.length&&!a.target)return this;b._groups.push({elements:this,options:a});b._apply(this,a);return this};b._groups=[];b._throttle=80;b._maintainScroll=!1;b._beforeUpdate=null;b._afterUpdate=null;b._apply=function(a,e){var d=p(e),h=c(a),k=[h],l=c(window).scrollTop(),f=c("html").outerHeight(!0),m=h.parents().filter(":hidden");m.each(function(){var a=c(this); -a.data("style-cache",a.attr("style"))});m.css("display","block");d.byRow&&!d.target&&(h.each(function(){var a=c(this),b="inline-block"===a.css("display")?"inline-block":"block";a.data("style-cache",a.attr("style"));a.css({display:b,"padding-top":"0","padding-bottom":"0","margin-top":"0","margin-bottom":"0","border-top-width":"0","border-bottom-width":"0",height:"100px"})}),k=r(h),h.each(function(){var a=c(this);a.attr("style",a.data("style-cache")||"")}));c.each(k,function(a,b){var e=c(b),f=0;if(d.target)f= -d.target.outerHeight(!1);else{if(d.byRow&&1>=e.length){e.css(d.property,"");return}e.each(function(){var a=c(this),b={display:"inline-block"===a.css("display")?"inline-block":"block"};b[d.property]="";a.css(b);a.outerHeight(!1)>f&&(f=a.outerHeight(!1));a.css("display","")})}e.each(function(){var a=c(this),b=0;d.target&&a.is(d.target)||("border-box"!==a.css("box-sizing")&&(b+=g(a.css("border-top-width"))+g(a.css("border-bottom-width")),b+=g(a.css("padding-top"))+g(a.css("padding-bottom"))),a.css(d.property, -f-b))})});m.each(function(){var a=c(this);a.attr("style",a.data("style-cache")||null)});b._maintainScroll&&c(window).scrollTop(l/f*c("html").outerHeight(!0));return this};b._applyDataApi=function(){var a={};c("[data-match-height], [data-mh]").each(function(){var b=c(this),d=b.attr("data-mh")||b.attr("data-match-height");a[d]=d in a?a[d].add(b):b});c.each(a,function(){this.matchHeight(!0)})};var q=function(a){b._beforeUpdate&&b._beforeUpdate(a,b._groups);c.each(b._groups,function(){b._apply(this.elements, -this.options)});b._afterUpdate&&b._afterUpdate(a,b._groups)};b._update=function(a,e){if(e&&"resize"===e.type){var d=c(window).width();if(d===n)return;n=d}a?-1===f&&(f=setTimeout(function(){q(e);f=-1},b._throttle)):q(e)};c(b._applyDataApi);c(window).bind("load",function(a){b._update(!1,a)});c(window).bind("resize orientationchange",function(a){b._update(!0,a)})})(jQuery); \ No newline at end of file +!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(t){var e=-1,o=-1,i=function(t){return parseFloat(t)||0},a=function(e){var o=1,a=t(e),n=null,r=[];return a.each(function(){var e=t(this),a=e.offset().top-i(e.css("margin-top")),s=r.length>0?r[r.length-1]:null;null===s?r.push(e):Math.floor(Math.abs(n-a))<=o?r[r.length-1]=s.add(e):r.push(e),n=a}),r},n=function(e){var o={ +byRow:!0,property:"height",target:null,remove:!1};return"object"==typeof e?t.extend(o,e):("boolean"==typeof e?o.byRow=e:"remove"===e&&(o.remove=!0),o)},r=t.fn.matchHeight=function(e){var o=n(e);if(o.remove){var i=this;return this.css(o.property,""),t.each(r._groups,function(t,e){e.elements=e.elements.not(i)}),this}return this.length<=1&&!o.target?this:(r._groups.push({elements:this,options:o}),r._apply(this,o),this)};r.version="0.7.0",r._groups=[],r._throttle=80,r._maintainScroll=!1,r._beforeUpdate=null, +r._afterUpdate=null,r._rows=a,r._parse=i,r._parseOptions=n,r._apply=function(e,o){var s=n(o),h=t(e),l=[h],c=t(window).scrollTop(),p=t("html").outerHeight(!0),d=h.parents().filter(":hidden");return d.each(function(){var e=t(this);e.data("style-cache",e.attr("style"))}),d.css("display","block"),s.byRow&&!s.target&&(h.each(function(){var e=t(this),o=e.css("display");"inline-block"!==o&&"flex"!==o&&"inline-flex"!==o&&(o="block"),e.data("style-cache",e.attr("style")),e.css({display:o,"padding-top":"0", +"padding-bottom":"0","margin-top":"0","margin-bottom":"0","border-top-width":"0","border-bottom-width":"0",height:"100px",overflow:"hidden"})}),l=a(h),h.each(function(){var e=t(this);e.attr("style",e.data("style-cache")||"")})),t.each(l,function(e,o){var a=t(o),n=0;if(s.target)n=s.target.outerHeight(!1);else{if(s.byRow&&a.length<=1)return void a.css(s.property,"");a.each(function(){var e=t(this),o=e.attr("style"),i=e.css("display");"inline-block"!==i&&"flex"!==i&&"inline-flex"!==i&&(i="block");var a={ +display:i};a[s.property]="",e.css(a),e.outerHeight(!1)>n&&(n=e.outerHeight(!1)),o?e.attr("style",o):e.css("display","")})}a.each(function(){var e=t(this),o=0;s.target&&e.is(s.target)||("border-box"!==e.css("box-sizing")&&(o+=i(e.css("border-top-width"))+i(e.css("border-bottom-width")),o+=i(e.css("padding-top"))+i(e.css("padding-bottom"))),e.css(s.property,n-o+"px"))})}),d.each(function(){var e=t(this);e.attr("style",e.data("style-cache")||null)}),r._maintainScroll&&t(window).scrollTop(c/p*t("html").outerHeight(!0)), +this},r._applyDataApi=function(){var e={};t("[data-match-height], [data-mh]").each(function(){var o=t(this),i=o.attr("data-mh")||o.attr("data-match-height");i in e?e[i]=e[i].add(o):e[i]=o}),t.each(e,function(){this.matchHeight(!0)})};var s=function(e){r._beforeUpdate&&r._beforeUpdate(e,r._groups),t.each(r._groups,function(){r._apply(this.elements,this.options)}),r._afterUpdate&&r._afterUpdate(e,r._groups)};r._update=function(i,a){if(a&&"resize"===a.type){var n=t(window).width();if(n===e)return;e=n; +}i?-1===o&&(o=setTimeout(function(){s(a),o=-1},r._throttle)):s(a)},t(r._applyDataApi),t(window).bind("load",function(t){r._update(!1,t)}),t(window).bind("resize orientationchange",function(t){r._update(!0,t)})}); \ No newline at end of file diff --git a/dist/jquery.matchHeight.js b/dist/jquery.matchHeight.js index 701df19..38544af 100644 --- a/dist/jquery.matchHeight.js +++ b/dist/jquery.matchHeight.js @@ -1,10 +1,22 @@ /** -* jquery.matchHeight.js v0.6.0 +* jquery-match-height 0.7.0 by @liabru * http://brm.io/jquery-match-height/ * License: MIT */ -;(function($) { +;(function(factory) { // eslint-disable-line no-extra-semi + 'use strict'; + if (typeof define === 'function' && define.amd) { + // AMD + define(['jquery'], factory); + } else if (typeof module !== 'undefined' && module.exports) { + // CommonJS + module.exports = factory(require('jquery')); + } else { + // Global + factory(jQuery); + } +})(function($) { /* * internal */ @@ -131,11 +143,15 @@ * plugin global options */ + matchHeight.version = '0.7.0'; matchHeight._groups = []; matchHeight._throttle = 80; matchHeight._maintainScroll = false; matchHeight._beforeUpdate = null; matchHeight._afterUpdate = null; + matchHeight._rows = _rows; + matchHeight._parse = _parse; + matchHeight._parseOptions = _parseOptions; /* * matchHeight._apply @@ -169,7 +185,12 @@ // must first force an arbitrary equal height so floating elements break evenly $elements.each(function() { var $that = $(this), - display = $that.css('display') === 'inline-block' ? 'inline-block' : 'block'; + display = $that.css('display'); + + // temporarily force a usable display value + if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') { + display = 'block'; + } // cache the original inline style $that.data('style-cache', $that.attr('style')); @@ -182,7 +203,8 @@ 'margin-bottom': '0', 'border-top-width': '0', 'border-bottom-width': '0', - 'height': '100px' + 'height': '100px', + 'overflow': 'hidden' }); }); @@ -210,7 +232,13 @@ // iterate the row and find the max height $row.each(function(){ var $that = $(this), - display = $that.css('display') === 'inline-block' ? 'inline-block' : 'block'; + style = $that.attr('style'), + display = $that.css('display'); + + // temporarily force a usable display value + if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') { + display = 'block'; + } // ensure we get the correct actual height (and not a previously set height value) var css = { 'display': display }; @@ -222,8 +250,12 @@ targetHeight = $that.outerHeight(false); } - // revert display block - $that.css('display', ''); + // revert styles + if (style) { + $that.attr('style', style); + } else { + $that.css('display', ''); + } }); } else { // if target set, use the height of the target element @@ -247,7 +279,7 @@ } // set the height (accounting for padding and border) - $that.css(opts.property, targetHeight - verticalPadding); + $that.css(opts.property, (targetHeight - verticalPadding) + 'px'); }); }); @@ -350,4 +382,4 @@ matchHeight._update(true, event); }); -})(jQuery); +}); diff --git a/package.json b/package.json index 346b49b..8f973dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jquery-match-height", - "version": "0.6.0", + "version": "0.7.0", "license": "MIT", "homepage": "http://brm.io/jquery-match-height/", "author": "Liam Brummitt (http://brm.io/)",