From 66089f05576a3a229d35df6ee5180d3fadd9a2da Mon Sep 17 00:00:00 2001 From: Jaeho Shin Date: Sun, 20 Jan 2013 00:41:44 -0800 Subject: [PATCH] num-html type detect/sorting works with multiline Improved num-html sorting and type-detection to handle html tags that span multiple lines. --- sorting/num-html.js | 2 +- type-detection/num-html.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sorting/num-html.js b/sorting/num-html.js index 3274ae11..7783a3d2 100644 --- a/sorting/num-html.js +++ b/sorting/num-html.js @@ -11,7 +11,7 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, { "num-html-pre": function ( a ) { - var x = a.replace( /<.*?>/g, "" ); + var x = String(a).replace( /<[\s\S]*?>/g, "" ); return parseFloat( x ); }, diff --git a/type-detection/num-html.js b/type-detection/num-html.js index d6f708e5..e732496b 100644 --- a/type-detection/num-html.js +++ b/type-detection/num-html.js @@ -11,7 +11,7 @@ jQuery.fn.dataTableExt.aTypes.unshift( function ( sData ) { sData = typeof sData.replace == 'function' ? - sData.replace( /<.*?>/g, "" ) : sData; + sData.replace( /<[\s\S]*?>/g, "" ) : sData; sData = $.trim(sData); var sValidFirstChars = "0123456789-";