This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 35
35
* - [bind()](http://api.jquery.com/bind/)
36
36
* - [children()](http://api.jquery.com/children/)
37
37
* - [clone()](http://api.jquery.com/clone/)
38
+ * - [contents()](http://api.jquery.com/contents/)
38
39
* - [css()](http://api.jquery.com/css/)
39
40
* - [data()](http://api.jquery.com/data/)
40
41
* - [eq()](http://api.jquery.com/eq/)
@@ -556,6 +557,10 @@ forEach({
556
557
return children ;
557
558
} ,
558
559
560
+ contents : function ( element ) {
561
+ return element . childNodes ;
562
+ } ,
563
+
559
564
append : function ( element , node ) {
560
565
forEach ( new JQLite ( node ) , function ( child ) {
561
566
if ( element . nodeType === 1 )
Original file line number Diff line number Diff line change @@ -731,6 +731,16 @@ describe('jqLite', function() {
731
731
} ) ;
732
732
733
733
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
+
734
744
describe ( 'append' , function ( ) {
735
745
it ( 'should append' , function ( ) {
736
746
var root = jqLite ( '<div>' ) ;
You can’t perform that action at this time.
0 commit comments