diff options
Diffstat (limited to 'sources/core/htmlparser/element.js')
-rw-r--r-- | sources/core/htmlparser/element.js | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/sources/core/htmlparser/element.js b/sources/core/htmlparser/element.js index 3654322..224d3e6 100644 --- a/sources/core/htmlparser/element.js +++ b/sources/core/htmlparser/element.js | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. | 2 | * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. |
3 | * For licensing, see LICENSE.md or http://ckeditor.com/license | 3 | * For licensing, see LICENSE.md or http://ckeditor.com/license |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -35,7 +35,7 @@ CKEDITOR.htmlParser.element = function( name, attributes ) { | |||
35 | */ | 35 | */ |
36 | this.children = []; | 36 | this.children = []; |
37 | 37 | ||
38 | // Reveal the real semantic of our internal custom tag name (#6639), | 38 | // Reveal the real semantic of our internal custom tag name (http://dev.ckeditor.com/ticket/6639), |
39 | // when resolving whether it's block like. | 39 | // when resolving whether it's block like. |
40 | var realName = name || '', | 40 | var realName = name || '', |
41 | prefixed = realName.match( /^cke:(.*)/ ); | 41 | prefixed = realName.match( /^cke:(.*)/ ); |
@@ -56,7 +56,7 @@ CKEDITOR.htmlParser.element = function( name, attributes ) { | |||
56 | }; | 56 | }; |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * Object presentation of CSS style declaration text. | 59 | * Object presentation of the CSS style declaration text. |
60 | * | 60 | * |
61 | * @class | 61 | * @class |
62 | * @constructor Creates a `cssStyle` class instance. | 62 | * @constructor Creates a `cssStyle` class instance. |
@@ -419,7 +419,7 @@ CKEDITOR.htmlParser.cssStyle = function() { | |||
419 | * | 419 | * |
420 | * @since 4.3 | 420 | * @since 4.3 |
421 | * @param {Number} index Index at which the element will be split — `0` means the beginning, | 421 | * @param {Number} index Index at which the element will be split — `0` means the beginning, |
422 | * `1` after first child node, etc. | 422 | * `1` after the first child node, etc. |
423 | * @returns {CKEDITOR.htmlParser.element} The new element following this one. | 423 | * @returns {CKEDITOR.htmlParser.element} The new element following this one. |
424 | */ | 424 | */ |
425 | split: function( index ) { | 425 | split: function( index ) { |
@@ -443,6 +443,38 @@ CKEDITOR.htmlParser.cssStyle = function() { | |||
443 | }, | 443 | }, |
444 | 444 | ||
445 | /** | 445 | /** |
446 | * Searches through the current node children to find nodes matching the `criteria`. | ||
447 | * | ||
448 | * @param {String/Function} criteria Tag name or evaluator function. | ||
449 | * @param {Boolean} [recursive=false] | ||
450 | * @returns {CKEDITOR.htmlParser.node[]} | ||
451 | */ | ||
452 | find: function( criteria, recursive ) { | ||
453 | if ( recursive === undefined ) { | ||
454 | recursive = false; | ||
455 | } | ||
456 | |||
457 | var ret = [], | ||
458 | i; | ||
459 | |||
460 | for ( i = 0; i < this.children.length; i++ ) { | ||
461 | var curChild = this.children[ i ]; | ||
462 | |||
463 | if ( typeof criteria == 'function' && criteria( curChild ) ) { | ||
464 | ret.push( curChild ); | ||
465 | } else if ( typeof criteria == 'string' && curChild.name === criteria ) { | ||
466 | ret.push( curChild ); | ||
467 | } | ||
468 | |||
469 | if ( recursive && curChild.find ) { | ||
470 | ret = ret.concat( curChild.find( criteria, recursive ) ); | ||
471 | } | ||
472 | } | ||
473 | |||
474 | return ret; | ||
475 | }, | ||
476 | |||
477 | /** | ||
446 | * Adds a class name to the list of classes. | 478 | * Adds a class name to the list of classes. |
447 | * | 479 | * |
448 | * @since 4.4 | 480 | * @since 4.4 |
@@ -511,8 +543,8 @@ CKEDITOR.htmlParser.cssStyle = function() { | |||
511 | 543 | ||
512 | if ( !ctx.nonEditable && this.attributes.contenteditable == 'false' ) | 544 | if ( !ctx.nonEditable && this.attributes.contenteditable == 'false' ) |
513 | changes.push( 'nonEditable', true ); | 545 | changes.push( 'nonEditable', true ); |
514 | // A context to be given nestedEditable must be nonEditable first (by inheritance) (#11372, #11698). | 546 | // A context to be given nestedEditable must be nonEditable first (by inheritance) (http://dev.ckeditor.com/ticket/11372, http://dev.ckeditor.com/ticket/11698). |
515 | // Special case: #11504 - filter starts on <body contenteditable=true>, | 547 | // Special case: http://dev.ckeditor.com/ticket/11504 - filter starts on <body contenteditable=true>, |
516 | // so ctx.nonEditable has not been yet set to true. | 548 | // so ctx.nonEditable has not been yet set to true. |
517 | else if ( ctx.nonEditable && !ctx.nestedEditable && this.attributes.contenteditable == 'true' ) | 549 | else if ( ctx.nonEditable && !ctx.nestedEditable && this.attributes.contenteditable == 'true' ) |
518 | changes.push( 'nestedEditable', true ); | 550 | changes.push( 'nestedEditable', true ); |