Skip to content

Commit

Permalink
e281c3efa5a37c2cf17eab1a2895a882e3a4cc16 Dev: Tweak the script remova…
Browse files Browse the repository at this point in the history
…l function to allow for invalid end tags

Sync to source repo @e281c3efa5a37c2cf17eab1a2895a882e3a4cc16
  • Loading branch information
dtbuild committed Apr 10, 2024
1 parent a69475c commit bb43529
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion datatables.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
],
"src-repo": "http://github.com/DataTables/Buttons",
"last-tag": "3.0.1",
"last-sync": "604499c76d7d7ab5051f13d4308ce667d0901f20"
"last-sync": "e281c3efa5a37c2cf17eab1a2895a882e3a4cc16"
}
2 changes: 1 addition & 1 deletion js/buttons.colVis.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ $.extend(DataTable.ext.buttons, {
.replace(/<select(.*?)<\/select\s*>/gi, ''); // remove select tags, including options text

// Strip HTML comments
title = Buttons.stripHtmlComments(str);
title = DataTable.Buttons.stripHtmlComments(str);

// Use whatever HTML stripper DataTables is configured for
title = DataTable.stripHtml(title).trim();
Expand Down
2 changes: 1 addition & 1 deletion js/buttons.colVis.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/buttons.colVis.min.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
* Column visibility buttons for Buttons and DataTables.
* © SpryMedia Ltd - datatables.net/license
*/
import jQuery from"jquery";import DataTable from"datatables.net";import Buttons from"datatables.net-buttons";let $=jQuery;$.extend(DataTable.ext.buttons,{colvis:function(n,t){var i=null,o={extend:"collection",init:function(n,t){i=t},text:function(n){return n.i18n("buttons.colvis","Column visibility")},className:"buttons-colvis",closeButton:!1,buttons:[{extend:"columnsToggle",columns:t.columns,columnText:t.columnText}]};return n.on("column-reorder.dt"+t.namespace,function(){n.button(null,n.button(null,i).node()).collectionRebuild([{extend:"columnsToggle",columns:t.columns,columnText:t.columnText}])}),o},columnsToggle:function(n,t){return n.columns(t.columns).indexes().map(function(n){return{extend:"columnToggle",columns:n,columnText:t.columnText}}).toArray()},columnToggle:function(n,t){return{extend:"columnVisibility",columns:t.columns,columnText:t.columnText}},columnsVisibility:function(n,t){return n.columns(t.columns).indexes().map(function(n){return{extend:"columnVisibility",columns:n,visibility:t.visibility,columnText:t.columnText}}).toArray()},columnVisibility:{columns:void 0,text:function(n,t,i){return i._columnText(n,i)},className:"buttons-columnVisibility",action:function(n,t,i,o){var t=t.columns(o.columns),e=t.visible();t.visible(void 0!==o.visibility?o.visibility:!(e.length&&e[0]))},init:function(i,n,o){var e=this;n.attr("data-cv-idx",o.columns),i.on("column-visibility.dt"+o.namespace,function(n,t){t.bDestroying||t.nTable!=i.settings()[0].nTable||e.active(i.column(o.columns).visible())}).on("column-reorder.dt"+o.namespace,function(){o.destroying||1===i.columns(o.columns).count()&&(e.text(o._columnText(i,o)),e.active(i.column(o.columns).visible()))}),this.active(i.column(o.columns).visible())},destroy:function(n,t,i){n.off("column-visibility.dt"+i.namespace).off("column-reorder.dt"+i.namespace)},_columnText:function(n,t){var i;return"string"==typeof t.text?t.text:(i=(i=n.column(t.columns).title()).replace(/\n/g," ").replace(/<br\s*\/?>/gi," ").replace(/<select(.*?)<\/select\s*>/gi,""),i=Buttons.stripHtmlComments(str),i=DataTable.stripHtml(i).trim(),t.columnText?t.columnText(n,idx,i):i)}},colvisRestore:{className:"buttons-colvisRestore",text:function(n){return n.i18n("buttons.colvisRestore","Restore visibility")},init:function(n,t,i){n.columns().every(function(){var n=this.init();void 0===n.__visOriginal&&(n.__visOriginal=this.visible())})},action:function(n,t,i,o){t.columns().every(function(n){var t=this.init();this.visible(t.__visOriginal)})}},colvisGroup:{className:"buttons-colvisGroup",action:function(n,t,i,o){t.columns(o.show).visible(!0,!1),t.columns(o.hide).visible(!1,!1),t.columns.adjust()},show:[],hide:[]}});export default DataTable;
import jQuery from"jquery";import DataTable from"datatables.net";import Buttons from"datatables.net-buttons";let $=jQuery;$.extend(DataTable.ext.buttons,{colvis:function(t,n){var i=null,o={extend:"collection",init:function(t,n){i=n},text:function(t){return t.i18n("buttons.colvis","Column visibility")},className:"buttons-colvis",closeButton:!1,buttons:[{extend:"columnsToggle",columns:n.columns,columnText:n.columnText}]};return t.on("column-reorder.dt"+n.namespace,function(){t.button(null,t.button(null,i).node()).collectionRebuild([{extend:"columnsToggle",columns:n.columns,columnText:n.columnText}])}),o},columnsToggle:function(t,n){return t.columns(n.columns).indexes().map(function(t){return{extend:"columnToggle",columns:t,columnText:n.columnText}}).toArray()},columnToggle:function(t,n){return{extend:"columnVisibility",columns:n.columns,columnText:n.columnText}},columnsVisibility:function(t,n){return t.columns(n.columns).indexes().map(function(t){return{extend:"columnVisibility",columns:t,visibility:n.visibility,columnText:n.columnText}}).toArray()},columnVisibility:{columns:void 0,text:function(t,n,i){return i._columnText(t,i)},className:"buttons-columnVisibility",action:function(t,n,i,o){var n=n.columns(o.columns),e=n.visible();n.visible(void 0!==o.visibility?o.visibility:!(e.length&&e[0]))},init:function(i,t,o){var e=this;t.attr("data-cv-idx",o.columns),i.on("column-visibility.dt"+o.namespace,function(t,n){n.bDestroying||n.nTable!=i.settings()[0].nTable||e.active(i.column(o.columns).visible())}).on("column-reorder.dt"+o.namespace,function(){o.destroying||1===i.columns(o.columns).count()&&(e.text(o._columnText(i,o)),e.active(i.column(o.columns).visible()))}),this.active(i.column(o.columns).visible())},destroy:function(t,n,i){t.off("column-visibility.dt"+i.namespace).off("column-reorder.dt"+i.namespace)},_columnText:function(t,n){var i;return"string"==typeof n.text?n.text:(i=(i=t.column(n.columns).title()).replace(/\n/g," ").replace(/<br\s*\/?>/gi," ").replace(/<select(.*?)<\/select\s*>/gi,""),i=DataTable.Buttons.stripHtmlComments(str),i=DataTable.stripHtml(i).trim(),n.columnText?n.columnText(t,idx,i):i)}},colvisRestore:{className:"buttons-colvisRestore",text:function(t){return t.i18n("buttons.colvisRestore","Restore visibility")},init:function(t,n,i){t.columns().every(function(){var t=this.init();void 0===t.__visOriginal&&(t.__visOriginal=this.visible())})},action:function(t,n,i,o){n.columns().every(function(t){var n=this.init();this.visible(n.__visOriginal)})}},colvisGroup:{className:"buttons-colvisGroup",action:function(t,n,i,o){n.columns(o.show).visible(!0,!1),n.columns(o.hide).visible(!1,!1),n.columns.adjust()},show:[],hide:[]}});export default DataTable;
2 changes: 1 addition & 1 deletion js/buttons.colVis.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ $.extend(DataTable.ext.buttons, {
.replace(/<select(.*?)<\/select\s*>/gi, ''); // remove select tags, including options text

// Strip HTML comments
title = Buttons.stripHtmlComments(str);
title = DataTable.Buttons.stripHtmlComments(str);

// Use whatever HTML stripper DataTables is configured for
title = DataTable.stripHtml(title).trim();
Expand Down
8 changes: 4 additions & 4 deletions js/dataTables.buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -1928,8 +1928,8 @@ Buttons.stripHtmlComments = function (input) {
var previous;

do {
previous = input;
input = input.replace(/(<!--.*?--!?>)|(<!--[\S\s]+?--!?>)|(<!--[\S\s]*?$)/g, '');
previous = input;
input = input.replace(/(<!--.*?--!?>)|(<!--[\S\s]+?--!?>)|(<!--[\S\s]*?$)/g, '');
} while (input !== previous);

return input;
Expand All @@ -1945,8 +1945,8 @@ Buttons.stripHtmlScript = function (input) {
var previous;

do {
previous = input;
input = input.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script\s*>/gi, '');
previous = input;
input = input.replace(/<script\b[^<]*(?:(?!<\/script[^>]*>)<[^<]*)*<\/script[^>]*>/gi, '');
} while (input !== previous);

return input;
Expand Down
2 changes: 1 addition & 1 deletion js/dataTables.buttons.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/dataTables.buttons.min.mjs

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions js/dataTables.buttons.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1888,8 +1888,8 @@ Buttons.stripHtmlComments = function (input) {
var previous;

do {
previous = input;
input = input.replace(/(<!--.*?--!?>)|(<!--[\S\s]+?--!?>)|(<!--[\S\s]*?$)/g, '');
previous = input;
input = input.replace(/(<!--.*?--!?>)|(<!--[\S\s]+?--!?>)|(<!--[\S\s]*?$)/g, '');
} while (input !== previous);

return input;
Expand All @@ -1905,8 +1905,8 @@ Buttons.stripHtmlScript = function (input) {
var previous;

do {
previous = input;
input = input.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script\s*>/gi, '');
previous = input;
input = input.replace(/<script\b[^<]*(?:(?!<\/script[^>]*>)<[^<]*)*<\/script[^>]*>/gi, '');
} while (input !== previous);

return input;
Expand Down

0 comments on commit bb43529

Please sign in to comment.