Skip to content
Permalink
Browse files

Merge branch 't/10822' into major

  • Loading branch information...
Reinmar committed Oct 24, 2013
2 parents 29ae680 + c005327 commit b6d7b38e6d6039d4ba0782cafd6daf2f84b1dd9a
Showing with 618 additions and 245 deletions.
  1. +1 −0 CHANGES.md
  2. +46 −0 core/dom/element.js
  3. +229 −64 core/dom/iterator.js
  4. +24 −2 core/dom/range.js
  5. +12 −5 core/dom/walker.js
  6. +26 −0 core/filter.js
  7. +3 −3 core/htmlparser/fragment.js
  8. +273 −171 core/style.js
  9. +4 −0 plugins/widget/plugin.js
@@ -5,6 +5,7 @@ CKEditor 4 Changelog

New Features:

* [#10822](http://dev.ckeditor.com/ticket/10822): Added styles system integration with non-editable elements (for example widgets) and their nested editables. Styles cannot change non-editable content and are applied in nested editable only if allowed by its type and content filter.
* [#10855](http://dev.ckeditor.com/ticket/10855): Change extension of emotes in BBCode sample from GIF to PNG.
* [#11002](http://dev.ckeditor.com/ticket/11002): Added option to disable widgets drag and drop support.
* [#10430](http://dev.ckeditor.com/ticket/10430): Resolve dependence of image plugin if forms plugin.
@@ -1868,6 +1868,52 @@ CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype, {
removeTmpId();

return found ? new CKEDITOR.dom.element( found ) : null;
},

/**
* Traverse the DOM of this element (inclusive), executing a callback for
* each node.
*
* var element = CKEDITOR.dom.element.createFromHtml( '<div><p>foo<b>bar</b>bom</p></div>' );
* element.forEach( function( node ) {
* console.log( node );
* } );
* // Will log:
* // 1. <div> element,
* // 2. <p> element,
* // 3. "foo" text node,
* // 4. <b> element,
* // 5. "bar" text node,
* // 6. "bom" text node.
*
* @since 4.3
* @param {Function} callback Function to be executed on every node.
* If `callback` returns `false` descendants of the node will be ignored.
* @param {CKEDITOR.htmlParser.node} callback.node Node passed as argument.
* @param {Number} [type] If specified `callback` will be executed only on
* nodes of this type.
* @param {Boolean} [skipRoot] Don't execute `callback` on this element.
*/
forEach: function( callback, type, skipRoot ) {
if ( !skipRoot && ( !type || this.type == type ) )
var ret = callback( this );

// Do not filter children if callback returned false.
if ( ret === false )
return;

var children = this.getChildren(),
node,
i = 0;

// We do not cache the size, because the live list of nodes may be changed by the callback.
for ( ; i < children.count(); i++ ) {
node = children.getItem( i );
if ( node.type == CKEDITOR.NODE_ELEMENT )
node.forEach( callback, type );
else if ( !type || node.type == type )
callback( node );
}
}
});

Oops, something went wrong.

0 comments on commit b6d7b38

Please sign in to comment.
You can’t perform that action at this time.