Opened 7 years ago

Closed 7 years ago

#15719 closed defect (fixed)

[patch][cla] Fix dojo.style(node, 'opacity', '') to properly remove the style property on IE < 9

Reported by: Thomas Bachem Owned by: Eugene Lazutkin
Priority: high Milestone: 1.9
Component: HTML Version: 1.7.3
Keywords: Cc:
Blocked By: Blocking:

Description

Setting a style property to an empty string does remove the inline property in every browser, e.g.:

dojo.style(node, 'color', 'red');
dojo.style(node, 'color', '');

This doesn't work with opacity on IE < 9 though, as the filter implementation doesn't contain a check for an empty string value.

See attached test case and patch.

Attachments (3)

ie-opacity-testcase.html (411 bytes) - added by Thomas Bachem 7 years ago.
ie-opacity.patch (889 bytes) - added by Thomas Bachem 7 years ago.
patch-15719.diff (978 bytes) - added by dylan 7 years ago.
Revised patch against 1.9 trunk

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by Thomas Bachem

Attachment: ie-opacity-testcase.html added

Changed 7 years ago by Thomas Bachem

Attachment: ie-opacity.patch added

comment:1 Changed 7 years ago by millennium

Edited the patch some more to So that multiple calls don't result in multiple progid's

if(!af(node)){
  if(opacity !== "") { 
    if(opaque){ 
      return opacity; 
    }
    node.style.filter = node.style.filter.replace(new RegExp("\\s*progid:" + astr + "\\(.+?\\)", "i"), "") + " progid:" + astr + "(Opacity=" + ov + ")";
 }
}else{
  if(opacity === "" || opaque) { 
    node.style.filter = node.style.filter.replace(new RegExp("\\s*progid:" + astr + "\\(.+?\\)", "i"), ""); 
  } else { 
    af(node, 1).Opacity = ov; 
  } 
}

// on IE7 Alpha(Filter opacity=100) makes text look fuzzy so disable it altogether (bug #2661),
//but still update the opacity value so we can get a correct reading if it is read later.
//Not needed anymore, also not working when cloning a node.
//af(node, 1).Enabled = !opaque;

comment:2 Changed 7 years ago by dylan

Milestone: tbd1.9
Priority: undecidedhigh
Summary: [patch] Fix dojo.style(node, 'opacity', '') to properly remove the style property on IE < 9[patch][cla] Fix dojo.style(node, 'opacity', '') to properly remove the style property on IE < 9

Changed 7 years ago by dylan

Attachment: patch-15719.diff added

Revised patch against 1.9 trunk

comment:3 Changed 7 years ago by Eugene Lazutkin

Resolution: fixed
Status: newclosed

In [31225]:

dom-style: remove a filter for fully opaque objects on old IE, thx thomasbachem, !strict, fixes #15719.

Note: See TracTickets for help on using tickets.