Ticket #1167 (reopened defect)

Opened 5 years ago

Last modified 3 years ago

Selection problem in Safari 3 prevents display of table, row and cell props dialogs

Reported by: guest Owned by:
Priority: normal Milestone: 0.97
Component: Browsers_Safari Version: trunk
Severity: normal Keywords:
Cc:

Description

If you use the nightly build demo on xinha.org, enable TableOperations and ContextMenu, create a table, then right click in a table cell, selecting table, row or cell properties, you get an empty dialog window.

Change History

Changed 4 years ago by douglas

  • status changed from new to closed
  • resolution set to worksforme

I've tested on trunk, and this works for me...

Changed 4 years ago by douglas

  • status changed from closed to reopened
  • resolution deleted

Ooops, didn't see that this was Safari, reopening

Changed 4 years ago by nicholasbs

I've done some detective work and I think I've tracked down the root of this problem.

First, this is only an issue for some table operations. Right-clicking on a cell and choosing Table or Row Properties does in fact work in Safari. However, Cell Properties, as well as many of the other cell functions (delete cells, insert cell before, etc), do not work.

TableOperations uses a function called getClosest() to find the closest td, tr, and table tags. getClosest() calls getAllAncestors(), which calls getParentElement. This function creates a range object and then calls commonAncestorContainer on it.

This is where the trouble comes in. When you right/control-click in a table cell, if there's no other visible content in the cell, or if you click after all of the content in the cell, Safari will automatically create a blank (i.e., white-space only) selection. The trouble is that calling commonAncestorContainer() on the Range object created from this selection returns an element that contains the table cell (e.g., the tr element). This of course means that getClosest will not find the correct td element; this yields a null value that InlineStyler.createStyleFieldset (which helps build the dialog box) chokes on.

You can easily verify this by noting that the cell properties dialog box works fine in Safari if you use the toolbar button, or if you right-click on text inside of a cell, or if you remove the selection after opening the context menu but before selecting the menu item.

Thoughts as to how best to fix this?

Changed 3 years ago by gogo

  • milestone changed from 0.96 to 0.97
Note: See TracTickets for help on using tickets.