Skip to content

Bug in prototype: etOffsetParent() returns BODY for new hidden elements in IE8 final #27

@joostschouten

Description

@joostschouten

See: https://prototype.lighthouseapp.com/projects/8886/tickets/618-getoffsetparent-returns-body-for-new-hidden-elements-in-ie8-final

This bug is still around in prototype 1.7 and the fix below does the trick. Might be a good idea to include it here and maybe also in the tapestry5.3 included scripts.

Cheers,
Joost

----- the fix -----

diff --git a/tapx-prototype/src/main/resources/com/howardlewisship/tapx/prototype/prototype.js b/tapx-prototype/src/main/resources/com/howardlewisship/tapx/prototype/prototype.js
index 6b6c01f..79b00cd 100644
--- a/tapx-prototype/src/main/resources/com/howardlewisship/tapx/prototype/prototype.js
+++ b/tapx-prototype/src/main/resources/com/howardlewisship/tapx/prototype/prototype.js
@@ -3698,7 +3698,8 @@ Element.addMethods({
return $(document.body);

 var isInline = (Element.getStyle(element, 'display') === 'inline');
  • if (!isInline && element.offsetParent) return $(element.offsetParent);

  •   if (!isInline && element.offsetParent && Element.visible(element)) return $(element.offsetParent);
    

    while ((element = element.parentNode) && element !== document.body && element !== document) {
    if (Element.getStyle(element, 'position') !== 'static') {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions