From 4454f98af6d2fffda33a52ce0e9d6bef60708833 Mon Sep 17 00:00:00 2001 From: Fujiun Syu Date: Mon, 19 Sep 2016 16:20:12 +0800 Subject: [PATCH] Angularjs minification using uglify resulting in js error --- release/angular-responsive-tables.js | 4 ++-- release/angular-responsive-tables.min.js | 2 +- src/directive.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/release/angular-responsive-tables.js b/release/angular-responsive-tables.js index c02a52e..6a95e89 100644 --- a/release/angular-responsive-tables.js +++ b/release/angular-responsive-tables.js @@ -18,7 +18,7 @@ function wtResponsiveTable() { return { restrict: "A", - controller: function($element) { + controller: ['$element', function($element) { return { getHeader: function(td) { var firstHeader = td.parentElement.querySelector("th"); @@ -37,7 +37,7 @@ } } }; - }, + }], compile: function(element, attrs) { attrs.$addClass("responsive"); var headers = getHeaders(element[0]); diff --git a/release/angular-responsive-tables.min.js b/release/angular-responsive-tables.min.js index 297715e..2cc2b24 100644 --- a/release/angular-responsive-tables.min.js +++ b/release/angular-responsive-tables.min.js @@ -1,2 +1,2 @@ // https://github.com/awerlang/angular-responsive-tables -!function(){"use strict";function getHeaders(element){return element.querySelectorAll("tr > th")}function updateTitle(td,th){var title=th&&th.textContent;!title||!td.getAttributeNode("data-title-override")&&td.getAttributeNode("data-title")||(td.setAttribute("data-title",title),td.setAttribute("data-title-override",title))}function colspan(td){var colspan=td.getAttributeNode("colspan");return colspan?parseInt(colspan.value):1}function wtResponsiveTable(){return{restrict:"A",controller:function($element){return{getHeader:function(td){var firstHeader=td.parentElement.querySelector("th");if(firstHeader)return firstHeader;var headers=getHeaders($element[0]);if(headers.length){var row=td.parentElement,headerIndex=0,found=Array.prototype.some.call(row.querySelectorAll("td"),function(value,index){return value===td?!0:void(headerIndex+=colspan(value))});return found?headers.item(headerIndex):null}}}},compile:function(element,attrs){attrs.$addClass("responsive");var headers=getHeaders(element[0]);if(headers.length){var rows=element[0].querySelectorAll("tbody > tr");Array.prototype.forEach.call(rows,function(row){var headerIndex=0;Array.prototype.forEach.call(row.querySelectorAll("td"),function(value,index){var th=value.parentElement.querySelector("th")||headers.item(headerIndex);updateTitle(value,th),headerIndex+=colspan(value)})})}}}}function wtResponsiveDynamic(){return{restrict:"E",require:"?^^wtResponsiveTable",link:function(scope,element,attrs,tableCtrl){tableCtrl&&setTimeout(function(){Array.prototype.forEach.call(element[0].parentElement.querySelectorAll("td"),function(td){var th=tableCtrl.getHeader(td);updateTitle(td,th)})},0)}}}angular.module("wt.responsive",[]).directive("wtResponsiveTable",[wtResponsiveTable]).directive("td",[wtResponsiveDynamic])}(); \ No newline at end of file +!function(){"use strict";function getHeaders(element){return element.querySelectorAll("tr > th")}function updateTitle(td,th){var title=th&&th.textContent;!title||!td.getAttributeNode("data-title-override")&&td.getAttributeNode("data-title")||(td.setAttribute("data-title",title),td.setAttribute("data-title-override",title))}function colspan(td){var colspan=td.getAttributeNode("colspan");return colspan?parseInt(colspan.value):1}function wtResponsiveTable(){return{restrict:"A",controller:['$element',function($element){return{getHeader:function(td){var firstHeader=td.parentElement.querySelector("th");if(firstHeader)return firstHeader;var headers=getHeaders($element[0]);if(headers.length){var row=td.parentElement,headerIndex=0,found=Array.prototype.some.call(row.querySelectorAll("td"),function(value,index){return value===td?!0:void(headerIndex+=colspan(value))});return found?headers.item(headerIndex):null}}}}],compile:function(element,attrs){attrs.$addClass("responsive");var headers=getHeaders(element[0]);if(headers.length){var rows=element[0].querySelectorAll("tbody > tr");Array.prototype.forEach.call(rows,function(row){var headerIndex=0;Array.prototype.forEach.call(row.querySelectorAll("td"),function(value,index){var th=value.parentElement.querySelector("th")||headers.item(headerIndex);updateTitle(value,th),headerIndex+=colspan(value)})})}}}}function wtResponsiveDynamic(){return{restrict:"E",require:"?^^wtResponsiveTable",link:function(scope,element,attrs,tableCtrl){tableCtrl&&setTimeout(function(){Array.prototype.forEach.call(element[0].parentElement.querySelectorAll("td"),function(td){var th=tableCtrl.getHeader(td);updateTitle(td,th)})},0)}}}angular.module("wt.responsive",[]).directive("wtResponsiveTable",[wtResponsiveTable]).directive("td",[wtResponsiveDynamic])}(); \ No newline at end of file diff --git a/src/directive.js b/src/directive.js index 10ba9ca..08a02ac 100644 --- a/src/directive.js +++ b/src/directive.js @@ -20,7 +20,7 @@ function colspan(td) { function wtResponsiveTable() { return { restrict: 'A', - controller: function ($element) { + controller: ['$element', function ($element) { return { getHeader: function (td) { var firstHeader = td.parentElement.querySelector('th'); @@ -42,7 +42,7 @@ function wtResponsiveTable() { } }, } - }, + }], compile: function (element, attrs) { attrs.$addClass('responsive'); var headers = getHeaders(element[0]);