﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
14743	getSelectedCells() function in table tools plugin returns incorrect cell when selection is in the header of a nested table	goodaman		"== Steps to reproduce ==

(This can be reproduced in the CKEditor Full Featured Demo)

1. Create a table.
2. Create a table inside a non-header row of the the first table, with a header row.
3. Place the cursor in a cell in the header row of the nested table.
4. Perform one of the Row commands available in the Table Tools plugin (e.g. Insert Rows Before, Insert Rows After, or Delete Rows)


== Expected result ==

The header row in the nested table should be acted upon according to the chosen operation.


== Actual result ==

The selected action is performed on a row of the outer table.


== Other details (browser, OS, CKEditor version, installed plugins) ==

Tested in IE 11, Chrome 51, Firefox 47[[BR]]
Windows 7[[BR]]
CKEditor 4.5.9[[BR]]
Table Tools Plugin[[BR]]

There is a bug in the `getSelectedCells()` function in the Table Tools plugin. Specifically, line 33:

{{{var nearestCell = startNode.getAscendant( 'td', true ) || startNode.getAscendant( 'th', true );}}}

When the selection is in a header row of a nested table, nearestCell will be a `td` element of the outer table, since that is the first operation performed in the ""or"" statement. I believe the line should instead be:

{{{var nearestCell = startNode.getAscendant( { td:1, th:1 }, true );}}}

This will correctly select the nearest `td` or `th` element in the nested table.

Line 50 should be changed in the same manner."	Bug	closed	Normal		General	4.5.11	duplicate		
