diff --git a/media/src/api/api.row.js b/media/src/api/api.row.js index a737ea95..5dc54558 100644 --- a/media/src/api/api.row.js +++ b/media/src/api/api.row.js @@ -18,7 +18,7 @@ _api.register( 'row()', function ( selector, opts ) { _api.register( 'row().node()', function () { var ctx = this.context; - + if ( ctx.length && this.length ) { return ctx[0].aoData[ this[0] ].nTr || undefined; } diff --git a/media/src/api/api.table.js b/media/src/api/api.table.js index 9367cecf..2c21ec32 100644 --- a/media/src/api/api.table.js +++ b/media/src/api/api.table.js @@ -36,5 +36,28 @@ _Api.register( 'tables().nodes()', function () { } ); +_Api.register( 'table()', function ( selector ) { + var tables = this.tables( selector ); + var ctx = tables.context; + + // Truncate to the first matched table + if ( ctx.length ) { + ctx.length = 1; + } + + return tables; +} ); + + +_Api.register( 'table().node()', function () { + var ctx = this.context; + + if ( ctx.length ) { + return ctx[0].nTable; + } + // return undefined; +} ); + + }());