From a8ade0297b711f2c9b5f721650189a5405578491 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Wed, 8 Sep 2010 21:08:52 +0100 Subject: [PATCH] New: It is now possible to have elements created by sDom have an ID assigned to them as well as a class. An extension of the previous class only syntax you can now do something like "#id.class", "#id" or "class" - 2666 --- media/js/jquery.dataTables.js | 35 +++++++--- media/unit_testing/tests_onhold/1_dom/sDom.js | 65 +++++++++++++++++++ 2 files changed, 91 insertions(+), 9 deletions(-) diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index da82deee..fc0a6633 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -3255,7 +3255,7 @@ /* Loop over the user set positioning and place the elements as needed */ var aDom = oSettings.sDom.split(''); - var nTmp, iPushFeature, cOption, nNewNode, cNext, sClass, j; + var nTmp, iPushFeature, cOption, nNewNode, cNext, sAttr, j; for ( var i=0 ; irti' + } ); + }, + function () { + return $('#test').length == 1; + } + ); + + oTest.fnTest( + "Element with an id and a class", + function () { + $('#example').dataTable( { + "bDestroy": true, + "sDom": '<"#test.classTest"lf>rti' + } ); + }, + function () { + return ($('#test').length == 1 && $('#test')[0].className == "classTest"); + } + ); + + oTest.fnTest( + "Element with just a class", + function () { + $('#example').dataTable( { + "bDestroy": true, + "sDom": '<"classTest"lf>rti' + } ); + }, + function () { + return ($('div.classTest').length == 1 ); + } + ); + + oTest.fnTest( + "Two elements with an id", + function () { + $('#example').dataTable( { + "bDestroy": true, + "sDom": '<"#test1"lf>rti<"#test2"lf>' + } ); + }, + function () { + return ($('#test1').length == 1 && $('#test2').length == 1); + } + ); + + oTest.fnTest( + "Two elements with an id and one with a class", + function () { + $('#example').dataTable( { + "bDestroy": true, + "sDom": '<"#test1"lf>rti<"#test2.classTest"lf>' + } ); + }, + function () { + return ($('#test1').length == 1 && $('#test2').length == 1 && $('div.classTest').length == 1); + } + ); + oTest.fnComplete(); } ); \ No newline at end of file