This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3535 * - [bind()](http://api.jquery.com/bind/)
3636 * - [children()](http://api.jquery.com/children/)
3737 * - [clone()](http://api.jquery.com/clone/)
38+ * - [contents()](http://api.jquery.com/contents/)
3839 * - [css()](http://api.jquery.com/css/)
3940 * - [data()](http://api.jquery.com/data/)
4041 * - [eq()](http://api.jquery.com/eq/)
@@ -556,6 +557,10 @@ forEach({
556557 return children ;
557558 } ,
558559
560+ contents : function ( element ) {
561+ return element . childNodes ;
562+ } ,
563+
559564 append : function ( element , node ) {
560565 forEach ( new JQLite ( node ) , function ( child ) {
561566 if ( element . nodeType === 1 )
Original file line number Diff line number Diff line change @@ -731,6 +731,16 @@ describe('jqLite', function() {
731731 } ) ;
732732
733733
734+ describe ( 'contents' , function ( ) {
735+ it ( 'should select all children nodes' , function ( ) {
736+ var root = jqLite ( '<div>' ) . html ( 'before-<div></div>after-<span></span>' ) ;
737+ var contents = root . contents ( ) ;
738+ expect ( contents . length ) . toEqual ( 4 ) ;
739+ expect ( jqLite ( contents [ 0 ] ) . text ( ) ) . toEqual ( 'before-' ) ;
740+ } ) ;
741+ } ) ;
742+
743+
734744 describe ( 'append' , function ( ) {
735745 it ( 'should append' , function ( ) {
736746 var root = jqLite ( '<div>' ) ;
You can’t perform that action at this time.
0 commit comments