Ticket #7387: 7387_2.patch
File 7387_2.patch, 3.5 KB (added by , 12 years ago) |
---|
-
_source/core/dom/node.js
488 488 489 489 /** 490 490 * Gets the closest ancestor node of this node, specified by its node name. 491 * @param {String} name The node name of the ancestor node to search. 491 * @param {String} reference The node name of the ancestor node to search, or 492 * an object with the names to search for (since 3.6) 492 493 * @param {Boolean} [includeSelf] Whether to include the current 493 494 * node in the search. 494 495 * @returns {CKEDITOR.dom.node} The located ancestor node or null if not found. … … 499 500 * ascendant = node.getAscendant( 'div' ); // ascendant == <div id="inner"> 500 501 * ascendant = node.getAscendant( 'b' ); // ascendant == null 501 502 * ascendant = node.getAscendant( 'b', true ); // ascendant == <b> 503 * ascendant = node.getAscendant( { div: 1, p: 1} ); // Searchs for the first 'div' or 'p': ascendant == <div id="inner"> 502 504 */ 503 getAscendant : function( name, includeSelf )505 getAscendant : function( reference, includeSelf ) 504 506 { 505 var $ = this.$; 507 var $ = this.$, 508 name; 506 509 507 510 if ( !includeSelf ) 508 511 $ = $.parentNode; 509 512 510 513 while ( $ ) 511 514 { 512 if ( $.nodeName && $.nodeName.toLowerCase() == name)515 if ( $.nodeName && ( name = $.nodeName.toLowerCase(), ( typeof reference == 'string' ? name == reference : name in reference ) ) ) 513 516 return new CKEDITOR.dom.node( $ ); 514 517 515 518 $ = $.parentNode; -
_source/plugins/styles/plugin.js
98 98 replaceVariables( styleDefinition.styles, variablesValues ); 99 99 } 100 100 101 var element = this.element = ( styleDefinition.element || '*' ).toLowerCase(); 101 var element = this.element = styleDefinition.element ? 102 ( typeof styleDefinition.element == 'string' ? styleDefinition.element.toLowerCase() : styleDefinition.element ) 103 : '*'; 102 104 103 105 this.type = 104 106 blockElements[ element ] ? … … 108 110 : 109 111 CKEDITOR.STYLE_INLINE; 110 112 113 // If the 'element' property is an object with a set of possible element, it will be applied like an object style: only to existing elements 114 if ( typeof this.element == 'object' ) 115 this.type = CKEDITOR.STYLE_OBJECT; 116 111 117 this._ = 112 118 { 113 119 definition : styleDefinition … … 179 185 && ( element == elementPath.block || element == elementPath.blockLimit ) ) 180 186 continue; 181 187 182 if( this.type == CKEDITOR.STYLE_OBJECT 183 && !( element.getName() in objectElements ) ) 188 if( this.type == CKEDITOR.STYLE_OBJECT ) 189 { 190 var name = element.getName(); 191 if ( !( typeof this.element == 'string' ? name == this.element : name in this.element ) ) 184 192 continue; 193 } 185 194 186 195 if ( this.checkElementRemovable( element, true ) ) 187 196 return true; … … 217 226 return false; 218 227 219 228 var def = this._.definition, 220 attribs; 229 attribs, 230 name = element.getName(); 221 231 222 232 // If the element name is the same as the style name. 223 if ( element.getName() ==this.element )233 if ( typeof this.element == 'string' ? name == this.element : name in this.element ) 224 234 { 225 235 // If no attributes are defined in the element. 226 236 if ( !fullMatch && !element.hasAttributes() )