Supporting the "behavior" propety with getComputedStyle()




DOM: CSS Object Model
18 years ago
17 years ago


(Reporter: jst, Assigned: jst)




Firefox Tracking Flags

(Not tracked)


(Whiteboard: [nsbeta2+])


(1 attachment)



18 years ago
getComputedStyle() is currently implemented in mozilla but so far only a very
small set of properties are computed and properly supported, this is a tracking
bug intended to track the implementation of the various CSS properties that can
be gequested from the computed style.

The currently implemented properties are:

  left, top, right, bottom, width, hieght and display.

The DOM Level 2 CSS spec defines about 125 different properties but most of them
should be trivial to implement, and some are not supposed to be supported, like
"margin", in stead "margin-left", "margin-top", ... should be used.

The DOM Level 2 CSS spec is at

And the CSS2 spec is at

If you have spcial interest in some spcific property or a spcific set of
properties please file them as separate bugs and mark that this bug depends on
the new bug you file.

(the bug for getting getComputedStyle() into mozilla was bug 32169)

Comment 1

18 years ago
*** Bug 42182 has been marked as a duplicate of this bug. ***


18 years ago
Blocks: 42181

Comment 2

18 years ago
Nominating for nsbeta2, since 42181 is now a problem.

Remember, the impl for this cannot rely on having a frame.  It can go to the 
frame for speed purposes, but if no frame exists, I still need the 
correct answer.


18 years ago
Keywords: nsbeta2

Comment 3

18 years ago
Created attachment 9997 [details] [diff] [review]
getComputedStyle(...).getPropertyValue('behavior') impl.

Comment 4

18 years ago
The patch I just attached should fix this bug and also implement
getPropertyValue() which makes getComputedStyle() a whole lot easier to use.

Pierre, could you have a look at the patch and check that I'm not misusing the
stylesystem in some way, I do a ReResolveStyleContext() in there, that's OK,

Pierre, when writing the patch I noticed that nsStyleUserInterface has a
nsString member but no destructor so I'm suspecting we'd leak the string, could
you have a peak at that?

Comment 5

18 years ago
Eh, the patch should not fix this bug, only parts of it (adds support for the
"behavior" property and implements getPropertyValue and also .cssText in

David, there's simply *no* way we'd get *all* CSS2 properties supported in
getComputedStyle() for beta2, and that's what this bug is about. Preferably
there should be a separate bug on adding support for the behavior property, and
that could be fixed for beta2 (that's all you need for beta2, right?)...

Comment 6

18 years ago
Yes, I just need behavior, and it has to work for display: none elements.

Comment 7

18 years ago
Patch looks good.

Comment 8

18 years ago
Putting on [nsbeta2+] radar for beta2 fix. 
Whiteboard: [nsbeta2+]

Comment 9

18 years ago
I'm not competent to do a real review of the patch, I can only say that it looks 
good. Don't we need to implement the code for more CSS_xxx types in 
nsROCSSPrimitiveValue::GetCssText()? I'm especially thinking of CSS_PC (picas) 
and CSS_NUMBER (for lengths of 0, meaning 0pt).

Thanks for pointing me to the memory leak in nsStyleUserInterface. I opened bug 

Comment 10

18 years ago
Changing summary to reflect that this is now about the behavior property, and
no other properties. I opened a new bug (bug 42417) for tracking all other CSS2

Pierre, you're right, nsROCSSPrimitiveValue::GetCssText() is incomplete but it
does even more than all it needs to do at this stage, eventually we'll need to
add support for more properties n' such...
Summary: Supporting all CSS2 propeties with getComputedStyle() → Supporting the "behavior" propety with getComputedStyle()
Target Milestone: --- → M17

Comment 11

18 years ago
I just checked in the fix for this, marking FIXED.
Last Resolved: 18 years ago
Resolution: --- → FIXED

Comment 12

18 years ago
Adding verifyme keyword.
Keywords: verifyme

Comment 13

18 years ago
Verified fixed.
Component: DOM Level 2 → DOM Style
You need to log in before you can comment on or make changes to this bug.