This project is archived and is in readonly mode.

#707 ✓resolved

getStyle("opacity") always returns 1

Reported by batman42ca | July 8th, 2009 @ 03:03 PM | in 1.3.0 rc2 (closed)

With the following code, the returned opacity value is always 1 on both IE6 and Firefox 2. I tested this with mootools version 1.2.1 and 1.2.3

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

<script type="text/javascript" src="mootools-1.2.3-core.js"></script>

<style type="text/css">
  #pageTitle {
    opacity : 0;
    filter: alpha(opacity = 0); /* for IE */
    zoom : 1;                   /* for IE */
    background-color: #ffffff;  /* for IE */

<SCRIPT TYPE="text/javascript">
  window.addEvent("domready",function() {

  <div id="pageTitle">This should be invisible</div>

Comments and changes to this ticket

  • etheon

    etheon July 22nd, 2009 @ 09:15 PM

    1 is the default value returned by a get on the opacity property. From what I gather, MooTools caches the properties into a global storage array, which is not initialized with the properties you defined with CSS rules. It doesn't seem to actually read the value from the page.

    Or that's what I gathered anyway from step-by-step debugging it with Firefox.

  • Sebastian Markbåge

    Sebastian Markbåge July 23rd, 2009 @ 02:17 AM

    • Assigned user set to “Sebastian Markbåge”
    • State changed from “new” to “open”

    Yea, this can be calculated, so it probably should be.

  • Fabian

    Fabian July 31st, 2009 @ 09:11 PM

    I have created a small patch file which gives me the valid value in Internet Explorer 6/7/8, Firefox, Safari and Chrome (newest versions).

    Maybe give it a try!? :)

  • Sebastian Markbåge

    Sebastian Markbåge August 1st, 2009 @ 12:04 AM

    This won't be fixed in 1.2 but will be fixed in 2.0.

  • Fabian

    Fabian August 1st, 2009 @ 12:47 AM

    Just to be curious, wouldn't my patch work? I'm using this one and I would like to know if I'll run into further problems if I do so. Thanks for more informations!

  • Sebastian Markbåge

    Sebastian Markbåge August 1st, 2009 @ 01:06 AM

    Fabian, yea, it should work unless of course some future trident version starts supporting opacity instead of filters.

  • schnixe

    schnixe August 9th, 2009 @ 06:30 PM

    i recently figured out that mootools only gives the correct opacity, if it was defined inline by style="opacity:0.5" but not if defined via external css or css head info...

  • Sebastian Markbåge

    Sebastian Markbåge September 4th, 2010 @ 05:10 PM

    • Milestone changed from 2.0 to 1.3.0 rc2
    • State changed from “open” to “resolved”
    • Assigned user changed from “Sebastian Markbåge” to “Fábio M. Costa”
    • Milestone order changed from “0” to “0”

    This is resolved in 1.3.

Create your profile

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

Shared Ticket Bins