J
jarek
Hi,
this is my code:
CSSStyleDeclaration.prototype.__defineSetter__('display',
displaySetter);
function displaySetter(value) {
var parent = findParent(document, this);
if (parent) {
if (parent.tagName == 'TD'
&& value.toLowerCase() == 'inline' ) {
value = 'table-cell';
}
}
this.setProperty('display', value , 'important');
}
function findParent(obj, style) {
var nodes = obj.childNodes;
if (obj.style == style) {
return obj;
}
for(var i = 0; i < nodes.length; i++) {
var suBsearchResult = findParent(nodes, style);
if (suBsearchResult) {
return suBsearchResult;
}
}
return false;
}
As you can see each time I need to scan whole document for parent which
I would like to avoid. Is there any other way to get an object on which
style is applied to?
this is my code:
CSSStyleDeclaration.prototype.__defineSetter__('display',
displaySetter);
function displaySetter(value) {
var parent = findParent(document, this);
if (parent) {
if (parent.tagName == 'TD'
&& value.toLowerCase() == 'inline' ) {
value = 'table-cell';
}
}
this.setProperty('display', value , 'important');
}
function findParent(obj, style) {
var nodes = obj.childNodes;
if (obj.style == style) {
return obj;
}
for(var i = 0; i < nodes.length; i++) {
var suBsearchResult = findParent(nodes, style);
if (suBsearchResult) {
return suBsearchResult;
}
}
return false;
}
As you can see each time I need to scan whole document for parent which
I would like to avoid. Is there any other way to get an object on which
style is applied to?