#9 enhancement
Nick Stakenburg

Add Element#cloneDimensions. Fix clonePosition, viewportOffset, getOffsetParent and make sure Element#getDimensions works with display:none ancestors.

Reported by Nick Stakenburg | April 14th, 2008 @ 02:06 PM | in 1.6.1

The dimensions part in Element#clonePosition doesn't work correctly, I figured it could be useful so I've fixed it up. I've added Element#cloneDimensions. Since clonePosition is also trying to clone dimensions it makes sense to have that available as well, it's also better named.

Since I like getting expected results I made sure Element#getDimensions always returns the right dimensions, even when the element has display: none ancestors. Besides that this is extremely useful it also helps when you are trying to clone something that's hidden.

Unit tests are added for Element#clonePosition, Element#cloneDimensions and Element#getDimensions and I've fixes a few bugs while testing, I'll describe those:

When Element#getOffsetParent attempts to call Element.getStyle on the document node, IE will throw: 'style' is not available.

Element#viewportOffset fails on Opera 9.5. Hallvord R. M. Steen (Opera.com) emailed me after he found a testpage I did on this and came up with a fix: 10486

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The Prototype JavaScript library.

Shared Ticket Bins