Bug 13358 - REGRESSION: ReferenceError: Can't find variable in DHTML slideshow script
Summary: REGRESSION: ReferenceError: Can't find variable in DHTML slideshow script
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Evangelism (show other bugs)
Version: 523.x (Safari 3)
Hardware: Macintosh PowerPC OS X 10.4
: P2 Normal
Assignee: Nobody
URL: http://www.dynamicdrive.com/dynamicin...
Keywords: Regression
Depends on:
Blocks: 14049 15147
  Show dependency treegraph
 
Reported: 2007-04-15 23:16 PDT by Charles Gaudette
Modified: 2007-09-06 00:00 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Charles Gaudette 2007-04-15 23:16:14 PDT
Slideshow works in Safari 419.3 but not in WebKit r20898.

This slideshow script is also used "in the wild" here: http://www.grandinfo.com/ where a client using (an older?) Safari brought this script to my attention.
Comment 1 David Kilzer (:ddkilzer) 2007-04-16 03:03:18 PDT
Confirmed viewing http://www.grandinfo.com/ with Safari 2.0.4 (419.3) on Mac OS X 10.4.9 (8P135) with a local debug build of WebKit r20896.  JavaScript console reports this error, and the picture slideshow in the upper right-hand corner of the screen does not run:

ReferenceError: Can't find variable: obj
http://www.grandinfo.com/    Line: 294

The slideshow works as expected (with no JavaScript console error) in shipping Safari 2.0.4 (419.3) on Mac OS X 10.4.9 (8P135).

Comment 2 David Kilzer (:ddkilzer) 2007-04-16 03:16:22 PDT
Loading the page with Drosera, the error is happening in this function (line 168 in the original document):

fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=obj.degree/100  // ERROR: Line 168
}

This looks like it may be a typo.  Should "obj.degree" be "this.degree" instead, or perhaps "crossobj.degree"?  (But why does shipping Safari not throw an exception here?  Perhaps it's not as strict as ToT WebKit is.)

And should WebKit still define crossobj.style.KhtmlOpacity?

Comment 3 David Kilzer (:ddkilzer) 2007-04-16 03:37:32 PDT
Confirmed that changing this line:

crossobj.style.KhtmlOpacity=obj.degree/100

To this line "fixes" the slideshow:

crossobj.style.KhtmlOpacity=this.degree/100

However, only every *other* image is faded in when doing this on Safari/WebKit, while Firefox 2.0.0.3 will fade in every picture.  This is probably a different bug in Dynamic Drive, though.  (Note that Safari/WebKit don't honor -khtml-opacity anymore, just "opacity".)

Lowering from P1 to P2 since this is a server-side evangelism issue, not a client issue.

Charles, please feel free to close this bug when you have fixed the issue in your code.  Thanks!

Comment 4 Charles Gaudette 2007-04-16 09:11:21 PDT
(In reply to comment #3)
[...]
> Lowering from P1 to P2 since this is a server-side evangelism issue, not a
> client issue.
> 
> Charles, please feel free to close this bug when you have fixed the issue in
> your code.  Thanks!
> 

FYI: This is not my code and neither sites are my sites.

Thanks for looking at it.
Comment 5 Charles Gaudette 2007-04-16 11:30:04 PDT
(In reply to comment #3)
> Confirmed that changing this line:
> 
> crossobj.style.KhtmlOpacity=obj.degree/100
> 
> To this line "fixes" the slideshow:
> 
> crossobj.style.KhtmlOpacity=this.degree/100
> 
> However, only every *other* image is faded in when doing this on Safari/WebKit,
> while Firefox 2.0.0.3 will fade in every picture.  This is probably a different
> bug in Dynamic Drive, though.  (Note that Safari/WebKit don't honor
> -khtml-opacity anymore, just "opacity".)
[...]

Sent something to this effect to Dynamic Drive's (only?) E-mail address ddrivehelp@gmail.com, as I don't feel compelled to become a registered member of their forums.
Comment 6 David Kilzer (:ddkilzer) 2007-04-16 12:11:22 PDT
(In reply to comment #5)
> Sent something to this effect to Dynamic Drive's (only?) E-mail address
> ddrivehelp@gmail.com, as I don't feel compelled to become a registered member
> of their forums.

Thanks Charles!  I hope you referenced this bug as well.  It will help explain the issue.

Comment 7 Charles Gaudette 2007-04-16 12:39:16 PDT
(In reply to comment #6)
> (In reply to comment #5)
> > Sent something to this effect to Dynamic Drive's (only?) E-mail address
> > ddrivehelp@gmail.com, as I don't feel compelled to become a registered member
> > of their forums.
> 
> Thanks Charles!  I hope you referenced this bug as well.  It will help explain
> the issue.

Well they know now. ;)

(While I'm posting this, I'll state the obvious for this bug log. The script works in IE7 for Win.)

Comment 8 Charles Gaudette 2007-05-10 15:14:55 PDT
At this time there has been no response to my messages with DynamicDrive.com. The code offered up freely there remains unchanged — 06 Dec 2005, v1.5.

I pointed gradinfo.com's webmaster to this discussion. A fix to the JavaScript has been implemented there, and I have verified that it works in r21377; also communicating that back to him. I'm not sure if it is skipping images as described by David Kilzer.


Comment 9 David Kilzer (:ddkilzer) 2007-05-12 22:45:46 PDT
(In reply to comment #8)
> I pointed gradinfo.com's webmaster to this discussion. A fix to the JavaScript
> has been implemented there, and I have verified that it works in r21377; also
> communicating that back to him. I'm not sure if it is skipping images as
> described by David Kilzer.

The slideshow does display now.  Images aren't skipped--the transition just alternates between a fade and a "quick switch" on each photo in ToT WebKit.  (On Firefox, the transition is a fade for every photo.)

Comment 10 David Kilzer (:ddkilzer) 2007-06-09 15:19:16 PDT
(In reply to comment #8)
> At this time there has been no response to my messages with DynamicDrive.com.
> The code offered up freely there remains unchanged — 06 Dec 2005, v1.5.

A user named jscheuer1 has posted "corrected" versions of the "Ultimate Fade-in Slideshow" script a number of times:

On the Bug Reports forum:
http://www.dynamicdrive.com/forums/showthread.php?t=20221&highlight=safari+fade-in

On the Scripts help forum:
http://www.dynamicdrive.com/forums/showthread.php?t=20192&highlight=safari+fade-in

These scripts contain the fix described in Comment #3 as well as other improvements.

Comment 11 Charles Gaudette 2007-07-26 07:42:53 PDT
DynamicDrive.com has updated their script "Ultimate Fade-in slideshow" to version 1.51, dated 24 July 2007. And made notes on the page that it now supports Safari 3.

My own tests on the published code shows that Tiger's (Safari 3.0.2-based) WebKit and WebKit r24615 display the slideshow. Both "shipping" and r24615 present all five elements in my test arrays.

The transition effect is complete, and subjectively smoother than what I see in Mac FireFox 2.0.0.5.

I also ran my tests in OmniWeb 5.6 sneaky peek 4 with good results.

Further, Win Safari with r24453 displays — and correctly transitions — the slideshow samples at the report URL.

The only remaining thing to do is to advise grandinfo.com's webmaster about the much better script. I'll E-mail that in a moment.

I'm marking this bug as FIXED.
Comment 12 David Kilzer (:ddkilzer) 2007-07-26 09:21:30 PDT
(In reply to comment #11)
> I'm marking this bug as FIXED.

Great!  Thanks for the update, Charles!