]>
git.immae.eu Git - perso/Immae/Projets/packagist/ludivine-ckeditor-component.git/blob - sources/core/dom/nodelist.js
2 * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.md or http://ckeditor.com/license
7 * Represents a list of {@link CKEDITOR.dom.node} objects.
8 * It is a wrapper for a native nodes list.
10 * var nodeList = CKEDITOR.document.getBody().getChildren();
11 * alert( nodeList.count() ); // number [0;N]
14 * @constructor Creates a document class instance.
15 * @param {Object} nativeList
17 CKEDITOR
.dom
.nodeList = function( nativeList
) {
21 CKEDITOR
.dom
.nodeList
.prototype = {
23 * Gets the count of nodes in this list.
32 * Gets the node from the list.
34 * @returns {CKEDITOR.dom.node}
36 getItem: function( index
) {
37 if ( index
< 0 || index
>= this.$.length
)
40 var $node
= this.$[ index
];
41 return $node
? new CKEDITOR
.dom
.node( $node
) : null;
45 * Returns a node list as an array.
47 * @returns {CKEDITOR.dom.node[]}
50 return CKEDITOR
.tools
.array
.map( this.$, function( nativeEl
) {
51 return new CKEDITOR
.dom
.node( nativeEl
);