Having some performance issues with Component One Toolbar? This might be a good method to take a look at:
function c1c_applyParentFont(item, parent)
{
if (!parent)
return;
var fontSize = '';
if (parent.currentStyle)
fontSize = parent.currentStyle.fontSize;
else if (document.defaultView && document.defaultView.getComputedStyle)
fontSize = document.defaultView.getComputedStyle(parent, '').getPropertyValue('font-size');
item.style.fontSize = fontSize;
var fontStyle = '';
if (parent.currentStyle)
fontStyle = parent.currentStyle.fontStyle;
else if (document.defaultView && document.defaultView.getComputedStyle)
fontStyle = document.defaultView.getComputedStyle(parent, '').getPropertyValue('font-style');
item.style.fontStyle = fontStyle;
var fontWeight = '';
if (parent.currentStyle)
fontWeight = parent.currentStyle.fontWeight;
else if (document.defaultView && document.defaultView.getComputedStyle)
fontWeight = document.defaultView.getComputedStyle(parent, '').getPropertyValue('font-weight');
item.style.fontWeight = fontWeight;
var fontStyle = '';
if (parent.currentStyle)
fontStyle = parent.currentStyle.fontStyle;
else if (document.defaultView && document.defaultView.getComputedStyle)
fontStyle = document.defaultView.getComputedStyle(parent, '').getPropertyValue('font-style');
item.style.fontStyle = fontStyle;
var fontVariant = '';
if (parent.currentStyle)
fontVariant = parent.currentStyle.fontVariant;
else if (document.defaultView && document.defaultView.getComputedStyle)
fontVariant = document.defaultView.getComputedStyle(parent, '').getPropertyValue('font-variant');
item.style.fontVariant = fontVariant;
var color = '';
if (parent.currentStyle)
color = parent.currentStyle.color;
else if (document.defaultView && document.defaultView.getComputedStyle)
color = document.defaultView.getComputedStyle(parent, '').getPropertyValue('color');
item.style.color = color;
var textDecoration = '';
if (parent.currentStyle)
{
if (parent.style.textDecoration && parent.style.textDecoration != '')
textDecoration = parent.style.textDecoration;
else if (parent.className != '' && parent.currentStyle.textDecoration != '')
{
try
{
var re = new RegExp("(^| |,)\\."+parent.className+"($| |,)", "gi");
for (var s = 0; s < document.styleSheets.length; s++)
for (var r = 0; r < document.styleSheets[s].rules.length; r++)
if (document.styleSheets[s].rules[r].selectorText.search(re) != -1)
{
var style = document.styleSheets[s].rules[r].style;
if (style.textDecoration && style.textDecoration != '')
{
if (textDecoration != '')
textDecoration += ' ';
textDecoration += style.textDecoration;
}
}
}
catch (exception)
{
textDecoration = parent.currentStyle.textDecoration;
}
}
}
else if (document.defaultView && document.defaultView.getComputedStyle)
textDecoration = document.defaultView.getComputedStyle(parent, '').getPropertyValue('text-decoration');
item.style.textDecoration = textDecoration;
}
Currently rated 5.0 by 1 people
- Currently 5/5 Stars.
- 1
- 2
- 3
- 4
- 5
Everytime someone talks about a hybrid... whether a car or a chickenmoosepig or how Rush Limbaugh is actually equal parts Rosie O'Donnel and Marlon Brando, in my head this is what I picture:
Currently rated 1.0 by 1 people
- Currently 1/5 Stars.
- 1
- 2
- 3
- 4
- 5