Google Groups Home
Help | Sign in
Problem with style.getPropertyValue and CSS
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Sascha Ziemann  
View profile
 More options Apr 30, 12:04 pm
Newsgroups: mozilla.dev.tech.svg
From: Sascha Ziemann <cev...@googlemail.com>
Date: Wed, 30 Apr 2008 09:04:57 -0700 (PDT)
Local: Wed, Apr 30 2008 12:04 pm
Subject: Problem with style.getPropertyValue and CSS
Hi,

when I define a symbol with a rectangle, I can not place the rectangle
a the coordinates (0,0) if the rectangle has a border. If I do so the
border gets clipped and I can see only the half of the border.
Therefore I have to place the rectangle at an offset with is half of
the stroke-width of the rectangle.

My problem is, that I can not read the stroke-width property with the
style.getPropertyValue function, if I place the style definition an a
CSS file and assign the style via the class attribute. When I put the
style attribute directly in the SVG file, the getPropertyValue und
setProperty functions work as expected.

Any idea, how to put the style definitions in an external CSS file and
still be able to query them from JavaScript?

Regards
Sascha


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Boris Zbarsky  
View profile
 More options Apr 30, 12:50 pm
Newsgroups: mozilla.dev.tech.svg
From: Boris Zbarsky <bzbar...@mit.edu>
Date: Wed, 30 Apr 2008 11:50:43 -0500
Local: Wed, Apr 30 2008 12:50 pm
Subject: Re: Problem with style.getPropertyValue and CSS

Sascha Ziemann wrote:
> Any idea, how to put the style definitions in an external CSS file and
> still be able to query them from JavaScript?

Use getComputedStyle?

-Boris


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sascha Ziemann  
View profile
 More options Apr 30, 4:12 pm
Newsgroups: mozilla.dev.tech.svg
From: Sascha Ziemann <cev...@googlemail.com>
Date: Wed, 30 Apr 2008 13:12:28 -0700 (PDT)
Local: Wed, Apr 30 2008 4:12 pm
Subject: Re: Problem with style.getPropertyValue and CSS
On 30 Apr., 16:50, Boris Zbarsky <bzbar...@mit.edu> wrote:

> Sascha Ziemann wrote:
> > Any idea, how to put the style definitions in an external CSS file and
> > still be able to query them from JavaScript?

> Use getComputedStyle?

This is what Firebug thinks.

The rect with the id "frame" is with the class "dialog_window"
defined, which renders the rect in some nice color (fill is set to
"#EEE"):

>>> document.getElementById("frame")

<rect id="frame" class="dialog_window" x="1" y="1" width="300"
height="200" rx="5" ry="5">

But when I call the function you suggest, I get an empty string:

>>> document.defaultView.getComputedStyle(document.getElementById("frame"), null).getPropertyValue ('fill');

""

Regards
Sascha


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Boris Zbarsky  
View profile
 More options Apr 30, 7:28 pm
Newsgroups: mozilla.dev.tech.svg
From: Boris Zbarsky <bzbar...@mit.edu>
Date: Wed, 30 Apr 2008 18:28:58 -0500
Local: Wed, Apr 30 2008 7:28 pm
Subject: Re: Problem with style.getPropertyValue and CSS

Sascha Ziemann wrote:
>>>> document.getElementById("frame")
> <rect id="frame" class="dialog_window" x="1" y="1" width="300"
> height="200" rx="5" ry="5">

> But when I call the function you suggest, I get an empty string:

>>>> document.defaultView.getComputedStyle(document.getElementById("frame"), null).getPropertyValue ('fill');
> ""

Are you perchance using Firefox 2?

-Boris


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Longson  
View profile
 More options May 1, 2:58 am
Newsgroups: mozilla.dev.tech.svg
From: Robert Longson <longs...@gmail.com>
Date: Wed, 30 Apr 2008 23:58:56 -0700 (PDT)
Local: Thurs, May 1 2008 2:58 am
Subject: Re: Problem with style.getPropertyValue and CSS
On Apr 30, 5:04 pm, Sascha Ziemann <cev...@googlemail.com> wrote:

> Hi,

> when I define a symbol with a rectangle, I can not place the rectangle
> a the coordinates (0,0) if the rectangle has a border. If I do so the
> border gets clipped and I can see only the half of the border.
> Therefore I have to place the rectangle at an offset with is half of
> the stroke-width of the rectangle.

Why not turn clipping off then using overflow="visible"?

Best regards

Robert


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sascha Ziemann  
View profile
 More options May 1, 4:25 am
Newsgroups: mozilla.dev.tech.svg
From: Sascha Ziemann <cev...@googlemail.com>
Date: Thu, 1 May 2008 01:25:42 -0700 (PDT)
Local: Thurs, May 1 2008 4:25 am
Subject: Re: Problem with style.getPropertyValue and CSS
On 30 Apr., 23:28, Boris Zbarsky <bzbar...@mit.edu> wrote:

> Sascha Ziemann wrote:
> >>>> document.getElementById("frame")
> > <rect id="frame" class="dialog_window" x="1" y="1" width="300"
> > height="200" rx="5" ry="5">

> > But when I call the function you suggest, I get an empty string:

> >>>> document.defaultView.getComputedStyle(document.getElementById("frame"), null).getPropertyValue ('fill');
> > ""

> Are you perchance using Firefox 2?

2.0.0.14

Regards
Sascha


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sascha Ziemann  
View profile
 More options May 1, 4:27 am
Newsgroups: mozilla.dev.tech.svg
From: Sascha Ziemann <cev...@googlemail.com>
Date: Thu, 1 May 2008 01:27:16 -0700 (PDT)
Local: Thurs, May 1 2008 4:27 am
Subject: Re: Problem with style.getPropertyValue and CSS
On 1 Mai, 06:58, Robert Longson <longs...@gmail.com> wrote:

> > when I define a symbol with a rectangle, I can not place the rectangle
> > a the coordinates (0,0) if the rectangle has a border. If I do so the
> > border gets clipped and I can see only the half of the border.
> > Therefore I have to place the rectangle at an offset with is half of
> > the stroke-width of the rectangle.

> Why not turn clipping off then using overflow="visible"?

Maybe another approach but no solution to the problem to read style
attributes. ;-)

Regards
Sascha


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Longson  
View profile
 More options May 1, 11:33 am
Newsgroups: mozilla.dev.tech.svg
From: Robert Longson <longs...@gmail.com>
Date: Thu, 1 May 2008 08:33:00 -0700 (PDT)
Subject: Re: Problem with style.getPropertyValue and CSS
On May 1, 9:27 am, Sascha Ziemann <cev...@googlemail.com> wrote:

> On 1 Mai, 06:58, Robert Longson <longs...@gmail.com> wrote:

> Maybe another approach but no solution to the problem to read style
> attributes. ;-)

If you want to solve that you need to install a firefox 3 beta.
getComputedStyle is not implemented for SVG in firefox 2.

Best regards

Robert.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google