PDA

View Full Version : Opacity in Konqueror 3.5.1?



Twey
03-06-2006, 08:30 PM
Whatever I set .style.opacity to in Konqueror 3.5.1, it displays the element at full opacity, and trying to get .style.opacity always returns 0.
Is this a Konqueror bug? Does it apply to Safari as well? Is there a way around it?

jscheuer1
03-06-2006, 09:46 PM
I thought Konq used -KHTML-opacity. Somebody must. Safari (at least according to folks who use it that I have helped with the Ultimate Fade script) does respond to generic opacity, much in the same way (if not identically) as FF now does.

Back to Konq. Generally, if you set a property/value pair in a browser that doesn't support it, you can get any sort of return value when you query it later.

mwinter
03-06-2006, 09:51 PM
Whatever I set .style.opacity to in Konqueror 3.5.1, it displays the element at full opacity, and trying to get .style.opacity always returns 0.According to (slightly outdated) Konqueror documentation (http://konqueror.kde.org/css/), the opacity property isn't supported.


Does it apply to Safari as well? Is there a way around it?Safari apparently does support opacity, though I can't confirm that. You might find better support by also using the -khtml-opacity property.



I thought Konq used -KHTML-opacity. Somebody must.Don't forget that Safari is based on the KHTML engine.

Mike

jscheuer1
03-06-2006, 10:27 PM
Don't forget that Safari is based on the KHTML engine.

I'm not forgetting that and, in fact earlier version may require -khtml-opacity, something I should have mentioned. But real world, recent versions don't, but do support generic opacity, at least as relayed to me in tests and other work I've done in concert with Safari users.

Twey
03-07-2006, 04:48 PM
According to (slightly outdated) Konqueror documentation, the opacity property isn't supported.Slightly outdated? That documentation is from 3.4; there've been some very major changes since then. 3.5.1, at least, uses W3C opacity instead; in fact, -khtml-opacity is no longer recognised (element.style.KhtmlOpacity is undefined, but element.style.opacity isn't).

jscheuer1
03-07-2006, 05:17 PM
Slightly outdated? That documentation is from 3.4; there've been some very major changes since then. 3.5.1, at least, uses W3C opacity instead; in fact, -khtml-opacity is no longer recognised (element.style.KhtmlOpacity is undefined, but element.style.opacity isn't).

Is that with or without having previously defined these via script and/or style?

mwinter
03-07-2006, 07:02 PM
3.5.1, at least, uses W3C opacity insteadYour first post seemed to suggest otherwise, but a second reading shows a typo that I didn't notice before. You state that you set the opacity property to something, but you don't say what.

I must have subconsciously glossed over that mistake: I read that assigning any value always makes the element opaque, but reading the value returns zero.

Mike

Twey
03-07-2006, 07:22 PM
You state that you set the opacity property to something, but you don't say what.I said "anything" :)
Examples (consecutively executed, on a document with images):
window.alert(typeof document.images[0].style.opacity); // string
window.alert(document.images[0].style.opacity); // empty string
window.alert(typeof document.images[0].style.KhtmlOpacity); // undefined
window.alert(document.images[0].style.opacity = 0.5); // 0.5, but image remains totally opaque
window.alert(document.images[0].style.opacity); // 0

mwinter
03-07-2006, 07:58 PM
I said "anything" :)I know. I read the post again as the thread was loading. :rolleyes: So, I was right the first time.

I noticed a long time ago that Konqueror implements the getComputedStyle method of the defaultView property of the document object. However, calling that method always returns null, irrespective of the arguments passed to it. Safari, on the other hand, omits the method altogether.

This may be a pattern that the Konqueror developers have decided to implement. To provide all of the properties of a particular interface, regardless of whether they're actually functional. I can't think of any other rational explanation, though if that is the approach they've decided to take, it's a rather stupid one.

Out of curiosity, can you alter the opacity of any element using any method (CSS rules or the DOM) in the latest Konqueror? If not, then it would seem that the 3.4 documentation isn't that out-of-date at all.


window.alert(typeof document.images[0].style.KhtmlOpacity); // undefinedFinally, are you sure that's the correct capitalisation for the property? Does



alert(typeof document.images[0].style.getPropertyValue('-khtml-opacity'));
display 'undefined' as well? Just a thought...

Mike

Twey
03-07-2006, 08:07 PM
It returns a string. However, so does
window.alert(typeof document.images[0].style.getPropertyValue("Mr. Fish"));... so I'm not going to put much store by that. :)

can you alter the opacity of any element using any method (CSS rules or the DOM) in the latest Konqueror?Yes, including <script> elements.

jscheuer1
03-08-2006, 05:18 AM
Quote:
Originally Posted by Mike
can you alter the opacity of any element using any method (CSS rules or the DOM) in the latest Konqueror?

Yes, including <script> elements.

Does the observed opacity change, though? From all that has been posted to now in this thread, it seems like the answer is no. If yes, what exactly is the problem?

Other stuff -

if:


-khtml-opacity:

is the css property (which I believe it is), the correct camel style scripting version equivalent would be:


.style.KhtmlOpacity=

as I believe you already have it. Sometimes it is better to set numerical values as strings though (when they are not assumed numerical measures of size or distance and not boolean):


.style.KhtmlOpacity='0.5'

instead of:


.style.KhtmlOpacity=0.5

This could also apply to generic opacity.

Twey
03-08-2006, 07:43 AM
Does the observed opacity change, though?As you suspect, no :)
Tried using a string instead of a float, but no joy.

jscheuer1
03-08-2006, 04:08 PM
Then I am with Mike then, particularly where he states:


This may be a pattern that the Konqueror developers have decided to implement. To provide all of the properties of a particular interface, regardless of whether they're actually functional. I can't think of any other rational explanation, though if that is the approach they've decided to take, it's a rather stupid one.

Out of curiosity, can you alter the opacity of any element using any method (CSS rules or the DOM) in the latest Konqueror? If not, then it would seem that the 3.4 documentation isn't that out-of-date at all.

mwinter
03-10-2006, 01:27 AM
It returns a string. However, so does
window.alert(typeof document.images[0].style.getPropertyValue("Mr. Fish"));... so I'm not going to put much store by that. :)I'm afraid that I'm going to have to plead stupidity (again). The getPropertyValue method will always return a string (when implemented), so at best, the typeof operator shouldn't have been included.

What I would have preferred to ask you to test is the getPropertyCSSValue method, which returns null when a CSS property is not declared. But, depending on how the opacity was applied to the element, that still may not be sufficient, and Konqueror may not implement the method.



can you alter the opacity of any element using any method (CSS rules or the DOM) in the latest Konqueror?Yes, including <script> elements.Now, I must say that I still haven't quite worked out what the conclusion is to this thread. That's probably because I've been asking the wrong questions, or at least phrasing the questions that I did ask badly. For instance, the question above should have been to ask you what methods can be used (that is, a list of them).

Perhaps then, I can ask you to look at a prepared test (http://mwinter.webhop.info/dd/twey/konqueror-opacity.html) that should produce some sort of meaningful result (for me at least, even if it doesn't address opacity ;)).

Mike

Twey
03-10-2006, 07:36 AM
Interesting...
Reported CSS values:
opacity: (string)
-khtml-opacity: undefined (undefined)
All the elements do, of course, appear opaque.

jscheuer1
03-10-2006, 01:53 PM
Nice looking demo! I felt bad that I had no version of Konq available that could utilize it so I tried it out on FF and Opera. FF liked opacity, apparently using it and definitely reporting it in all cases with the -khtml- variety being 'undefined'. Opera used neither and reported nothing.

Twey
03-10-2006, 04:20 PM
Opera doesn't support any form of opacity control.

jscheuer1
03-10-2006, 05:02 PM
Opera doesn't support any form of opacity control.

We knew that. I just thought it interesting, especially that it reported nothing whatsoever, good object branching (knowing Mike, probably, didn't even glance at the code). Here's something I don't know though, and that I've been wondering about for years:

What does that darn Latin mean?

Twey
03-10-2006, 05:15 PM
I thought you might... it was just that you sounded slightly surprised.

What does that darn Latin mean?Heh :) http://www.lipsum.com/

mwinter
03-10-2006, 09:20 PM
All the elements do, of course, appear opaque.All (except the control)? Does that include the last test?

Presumably there were no errors written into the page, rather than results?



Opera [...] reported nothing.That is a troublesome problem on Opera's part. It doesn't implement the getPropertyCSSValue method - calling it throws a NOT_SUPPORTED_ERR exception - but it does exist, and the typeof operator returns 'function'. I intend to bring this up with Opera, once I check what Opera 8.53 does (51 is the latest revision I have).

It seems that neither Konqueror nor Safari support the getPropertyCSSValue method properly, either, but that failure is detectable and doesn't necessitate exception handling.


For comparison, I ran this test through iCapture last night (I forgot to include a link), producing a full-page screenshot (311kB) (http://mwinter.webhop.info/dd/twey/safari-screenshot.png). This is effectively Safari 2.0.3. It did rather well.

Mike

Twey
03-10-2006, 09:30 PM
All the elements do, of course, appear opaque.All (except the control)? Does that include the last test?Including the control. Opaque: lacking any sort of translucency. Yes.
Presumably there were no errors written into the page, rather than results?Afraid not, no. The only output, which was the same for all the examples, I've posted above.

mwinter
03-10-2006, 09:36 PM
Including the control.Good grief! I really need to stop misreading posts in this thread... :mad:

Mike

jscheuer1
03-10-2006, 10:52 PM
For comparison, I ran this test through iCapture last night (I forgot to include a link), producing a full-page screenshot (311kB) (http://mwinter.webhop.info/dd/twey/safari-screenshot.png). This is effectively Safari 2.0.3. It did rather well

That's exactly what I would have suspected from Safari given the feedback I've received from Safari users. This is why I have been after DD to abandon -khtml-opacity (-khtml-opacity could be retained as well if anyone ever finds a browser that uses it) in favor of generic opacity to support Safari, particularly in the Ultimate Fade-In Slideshow.

chovy
11-15-2006, 12:03 PM
interested read...even today konq 3.5 doesn't support opacity. Safari must've written their own.

djr33
11-16-2006, 09:28 AM
Kinda late on this thread, but I'd be happy to test in safari for you. Just ask.

chovy
11-16-2006, 03:28 PM
http://chovy.dyndns.org/test/opacity.html

boxxertrumps
11-16-2006, 03:34 PM
that returns a 404 in Mozilla,
http://chovy.dyndns.org/test/ch
this is the url i end up with.

chovy
11-16-2006, 03:35 PM
strange works fine for me.

Twey
11-16-2006, 05:46 PM
Works here.
<!-- // hideI realise it's just a test, but as an aside, the Javascript comment hack (which is unnecessary nowadays) relies on the fact that Javascript treats <!-- as a comment marker, rendering that // redundant.

boxxertrumps
11-16-2006, 06:32 PM
script blocker, sorry it works fine.