Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#9929: [Chrome 23]   is created when deleting character and typing common space #46

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions core/dom/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,13 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, {
* Gets the closest ancestor node of this node, specified by its name.
*
* // Suppose we have the following HTML structure:
* // <div id="outer"><div id="inner"><p><b>Some text</b></p></div></div>
* // <div id="outer" data-myattr="foo"><div id="inner"><p><b>Some text</b></p></div></div>
* // If node == <b>
* ascendant = node.getAscendant( 'div' ); // ascendant == <div id="inner">
* ascendant = node.getAscendant( 'b' ); // ascendant == null
* ascendant = node.getAscendant( 'b', true ); // ascendant == <b>
* ascendant = node.getAscendant( { div:1,p:1 } ); // Searches for the first 'div' or 'p': ascendant == <div id="inner">
* ascendant = node.getAscendant( 'div[data-myattr]' ) // ascendant == <div id="outer" data-myattr="foo">
*
* @since 3.6.1
* @param {String} reference The name of the ancestor node to search or
Expand All @@ -551,13 +552,25 @@ CKEDITOR.tools.extend( CKEDITOR.dom.node.prototype, {
*/
getAscendant: function( reference, includeSelf ) {
var $ = this.$,
name;
name,
hasAttributes = false,
attributeName = null,
reAttr = /^(.*)\[(.+)\]$/;

if ( !includeSelf )
$ = $.parentNode;

if ( typeof reference == 'string' && reAttr.test( reference ) )
{
var res = reAttr.exec(reference);
reference = res[1];
attributeName = res[2];
hasAttributes = true;
}

while ( $ ) {
if ( $.nodeName && ( name = $.nodeName.toLowerCase(), ( typeof reference == 'string' ? name == reference : name in reference ) ) )

if ( $.nodeName && ( name = $.nodeName.toLowerCase(), ( typeof reference == 'string' ? name == reference && ( !hasAttributes || ( $.getAttribute && $.getAttribute(attributeName) !== null ) ) : name in reference ) ) )
return new CKEDITOR.dom.node( $ );

try {
Expand Down
4 changes: 2 additions & 2 deletions core/editable.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,9 @@
// 1. Del/Backspace key before/after table;
// 2. Backspace Key after start of table.
if ( ( block = path.block ) &&
range[ rtl ? 'checkStartOfBlock' : 'checkEndOfBlock' ]() &&
( next = block[ rtl ? 'getPrevious' : 'getNext' ]( isNotWhitespace ) ) &&
next.is( 'table' ) )
next.is( 'table' ) &&
range[ rtl ? 'checkStartOfBlock' : 'checkEndOfBlock' ]() )
{
editor.fire( 'saveSnapshot' );

Expand Down