469,312 Members | 2,524 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,312 developers. It's quick & easy.

scriptable style access in Opera

VK
Is my understanding correct that
due to the lack of CSS2 support Opera doesn't allow any access to
inline/linked style declarations?
Say in case:
<style type="text/css">
..foo {
color: blue;
}
</style>
....
<div class="foo"...

There is no way to get a reference to the "foo" rule or to
change/remove it?

Jan 3 '06 #1
4 1101
VK wrote:
Is my understanding correct that
due to the lack of CSS2 support Opera doesn't allow any access to
inline/linked style declarations?
No. Recent versions of Opera support CSS2 features that are not
discontinued in CSS2.1:

<URL:http://www.opera.com/docs/specs/css/>

However, recent versions of Opera do not support W3C DOM 2 Style --

<URL:http://www.opera.com/docs/specs/js/dom/css/>

--,
Say in case:
<style type="text/css">
.foo {
color: blue;
}
</style>
...
<div class="foo"...

There is no way to get a reference to the "foo" rule or to
change/remove it?


and that is why this is not possible.
PointedEars
Jan 3 '06 #2
On 03/01/2006 12:41, VK wrote:
Is my understanding correct that due to the lack of CSS2 support
Opera
Opera has among the best CSS support of any browser in use on the Web.
doesn't allow any access to inline/linked style declarations?
It provides the ability to read and modify in-line style declarations,
no access to header (embedded) or external (linked) style sheets, and
read access to computed style properties.
Say in case:
<style type="text/css">
.foo {
color: blue;
}
</style>
...
<div class="foo"...

There is no way to get a reference to the "foo" rule or to
change/remove it?


Correct. That is a header (or embedded) style sheet rule.

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Jan 3 '06 #3


VK wrote:

Say in case:
<style type="text/css">
.foo {
color: blue;
}
</style>
...
<div class="foo"...

There is no way to get a reference to the "foo" rule or to
change/remove it?


All you can do in Opera is to use the Core and HTML DOM to manipulate
HTML style elements e.g. to change something you could add a new style
element at the end of the head element e.g.

var styleElement = document.createElement('style');
styleElement.type = 'text/css';
styleElement.appendChild(document.createTextNode(
'.foo { background-color: transparent }'
));
document.getElementsByTagName('head')[0].appendChild(styleElement);

Or you can remove a complete style element e.g.
styleElement.parentNode.removeChild(styleElement)

Opera reacts to those DOM changes and makes the necessary CSS changes
resulting from that.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 3 '06 #4
VK
Thanks to everyone, my worst assumptions are being confirmed. :-(

P.S. That was not a bias to Opera but indeed a practical question for
my project. But out of any bias it still sucks IMHO no matter how good
the static style support would be.

Jan 3 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Harlan Messinger | last post: by
13 posts views Thread by TheKeith | last post: by
5 posts views Thread by Andrew Poulos | last post: by
9 posts views Thread by JimO | last post: by
8 posts views Thread by pamelafluente | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.