X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2Fpackagist%2Fpiedsjaloux-ckeditor-component.git;a=blobdiff_plain;f=sources%2Fcore%2Fdom%2Fnodelist.js;fp=sources%2Fcore%2Fdom%2Fnodelist.js;h=07af314652c9e22d7829fac19a6ae1a5205a46b9;hp=0f91eaa1ad324f8003b6676a1ec8a80d6c19ba56;hb=317f8f8f0651488f226b5280a8f036c7c135c639;hpb=1096cdefb1c9a3f3c4ca6807e272da6c92e5ed9c diff --git a/sources/core/dom/nodelist.js b/sources/core/dom/nodelist.js index 0f91eaa..07af314 100644 --- a/sources/core/dom/nodelist.js +++ b/sources/core/dom/nodelist.js @@ -1,11 +1,11 @@ /** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. + * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or http://ckeditor.com/license */ /** * Represents a list of {@link CKEDITOR.dom.node} objects. - * It's a wrapper for native nodes list. + * It is a wrapper for a native nodes list. * * var nodeList = CKEDITOR.document.getBody().getChildren(); * alert( nodeList.count() ); // number [0;N] @@ -20,7 +20,7 @@ CKEDITOR.dom.nodeList = function( nativeList ) { CKEDITOR.dom.nodeList.prototype = { /** - * Get count of nodes in this list. + * Gets the count of nodes in this list. * * @returns {Number} */ @@ -29,7 +29,7 @@ CKEDITOR.dom.nodeList.prototype = { }, /** - * Get node from the list. + * Gets the node from the list. * * @returns {CKEDITOR.dom.node} */ @@ -39,5 +39,16 @@ CKEDITOR.dom.nodeList.prototype = { var $node = this.$[ index ]; return $node ? new CKEDITOR.dom.node( $node ) : null; + }, + + /** + * Returns a node list as an array. + * + * @returns {CKEDITOR.dom.node[]} + */ + toArray: function() { + return CKEDITOR.tools.array.map( this.$, function( nativeEl ) { + return new CKEDITOR.dom.node( nativeEl ); + } ); } };