By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,369 Members | 966 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,369 IT Pros & Developers. It's quick & easy.

scriptable style access in Opera

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a


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

P: n/a
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.