From a1ffcfb9b8a53f5191d4fdef173bc193440e9212 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Wed, 8 Oct 2008 14:56:01 -0700 Subject: [PATCH] Safari/Chrome: Pulldowns on inline images are now positioned correctly. --- NEWS | 1 + static/js/Wiki.js | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 422d903..267fdc8 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ * You can now create and end links. * Underline and strikethrough now work. * Pulldowns for search suggestions, importing, and exporting show up. + * Pulldowns on inline images are now positioned correctly. * Note resizing (growing and shrinking) works as expected. * Improved page loading speed and fixed a rare session locking timeout bug by removing all implicit session locking. diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 81a3ddf..b2396c6 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -2854,10 +2854,15 @@ Pulldown.prototype.finish_init = function () { function calculate_position( node, anchor, relative_to, always_left_align ) { var anchor_dimensions = getElementDimensions( anchor ); - // if the anchor has no height, use its first child (if any) instead - if ( anchor_dimensions.h == 0 && anchor.firstChild ) { - anchor = anchor.firstChild; - anchor_dimensions = getElementDimensions( anchor ); + // if the anchor's first child is larger (vertically) than its parent, then use it as the anchor + if ( anchor.firstChild ) { + try{ + var child_dimensions = getElementDimensions( anchor.firstChild ); + if ( child_dimensions.h > anchor_dimensions.h ) { + anchor = anchor.firstChild; + anchor_dimensions = child_dimensions; + } + } catch ( e ) {} } // position the pulldown under the anchor