Bug 14054 - REGRESSION: cupid.com uses iframe.document to make content visible
Summary: REGRESSION: cupid.com uses iframe.document to make content visible
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Evangelism (show other bugs)
Version: 523.x (Safari 3)
Hardware: Mac OS X 10.4
: P1 Normal
Assignee: Nobody
URL: http://www.cupid.com/membership.aspx?...
Keywords: Regression
Depends on:
Blocks:
 
Reported: 2007-06-09 19:00 PDT by David Kilzer (:ddkilzer)
Modified: 2007-08-30 15:44 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2007-06-09 19:00:25 PDT
* SUMMARY
Some pages on cupid.com (which was recently redesigned) uses the iframe.document property to resize iframe elements to make content visible.

* STEPS TO REPRODUCE
1. Open Safari/WebKit.
2. Go to URL:  http://www.cupid.com/membership.aspx?pagename=A1&pagemode=output

* EXPECTED RESULTS
The full content of the page should be visible.

* ACTUAL RESULTS
The content in the center of the page is cut off.

* REGRESSION
This is a regression from shipping Safari 2.0.4 (419.3) on Mac OS X 10.4.9 (8P135) which works when loading the page.  A local debug build of WebKit r22080 reproduces the bug.

* NOTES
I'm assuming this will be an evangelism bug since the iframe.document property is unsupported.

The calcHeight() function on that page clearly needs to be updated to work with a nightly WebKit.

The iframe.document property was removed in r21651 for <rdar://problem/5215830>.

http://trac.webkit.org/projects/webkit/changeset/21651
Comment 1 David Kilzer (:ddkilzer) 2007-06-09 19:01:26 PDT
Note that this doesn't work on Opera 9.10, either.

Comment 2 David Kilzer (:ddkilzer) 2007-06-09 19:03:32 PDT
JavaScript console error:

Undefined value
http://www.cupid.com/membership.aspx?pagename=A1&pagemode=output
Line: 21

Comment 3 David Kilzer (:ddkilzer) 2007-06-09 19:19:01 PDT
I just sent a note to cupid.com customer support regarding this issue.

Comment 4 Jen 2007-07-13 12:14:23 PDT
Hi,
I'm a developer for Cupid.com, and I have started to work on this issue. I tried using the "ownerDocument" property, but the page heights still aren't calculating correctly. They keep getting longer and longer as I click on different pages, no matter what height they're supposed to be. The same code in Opera 9.10 works better; but sometimes it cuts off the very bottom of long pages. Would it be possible for you to look at my code and see if I'm doing anything wrong here; I'm not very familiar with Macs and doing a Google search on this topic didn't help me much. Here is the block of code that I added for the WebKit and Opera browsers:
if (userAgent.indexOf('applewebkit/522+') != -1 || userAgent.indexOf('opera/9.10') != -1) 
{
   var the_height= document.getElementById     ("iframe").ownerDocument.body.offsetHeight;
   //change the height of the iframe
   document.getElementById("iframe").height = (the_height);
   document.getElementById("mainBody").height = (the_height + 50);
}	

Thanks,
-Jen
Comment 5 David Kilzer (:ddkilzer) 2007-07-13 14:45:45 PDT
(In reply to comment #4)
> if (userAgent.indexOf('applewebkit/522+') != -1 ||
> userAgent.indexOf('opera/9.10') != -1) 

Please consider using "object detection" instead of user agent sniffing here:

if (document.getElementById("iframe").ownerDocument)

For more info about this technique see:

http://developer.apple.com/internet/webcontent/objectdetection.html

> {
>    var the_height= document.getElementById("iframe").ownerDocument.body.offsetHeight;
>    //change the height of the iframe
>    document.getElementById("iframe").height = (the_height);
>    document.getElementById("mainBody").height = (the_height + 50);
> }       

I think you may want to use ".style.height" instead of simply ".height" here.  Does that make any difference in rendering?

Comment 6 Jen 2007-07-16 12:35:31 PDT
I changed the code to use "object detection" and ".style.height", and our development site now works with Safari/WebKit. We will launch the changes to production within the next few weeks.

I still couldn't get our site to work with Opera, however. I'll continue looking into that.

Thanks for your help,
-Jen
Comment 7 David Kilzer (:ddkilzer) 2007-07-16 13:10:54 PDT
(In reply to comment #6)
> I still couldn't get our site to work with Opera, however. I'll continue
> looking into that.

Please contact David Storey <david.storey@opera.com> for further assistance with Opera.

Glad we could help!

Comment 8 Sam Weinig 2007-08-30 15:44:02 PDT
The site has been fixed.