2009-01-05

Revert to default styles

For example, you've changed the default colors of a link using Prototype's setStyle.
$('answer-link').setStyle({
 color: '#000000',
 borderBottomColor: '#000000'
});
Then, after some action, you want to change the styles back to the original ones. You have an option of specifying them again:
$('answer-link').setStyle({
 color: '#B2B2B2',
 borderBottomColor: '#B2B2B2'
});
...but that means you'll have to change your JS if designer changes his CSS. This kind of dependency is bad and, in fact, could be avoided
$('answer-link').setStyle({
 color: '',
 borderBottomColor: ''
});
...by using empty strings as style property values.

Комментариев нет: