IE - can get actual CSS style, not computed style?

Discussion in 'Javascript' started by Nik Coughlin, Jan 23, 2008.

  1. Nik Coughlin

    Nik Coughlin Guest

    I know IE doesn't support "display: table", but when I examine an element
    with that style, eg. alert( element.style.display ) it gives me "block". Is
    there any way I can get the actual value that's in my CSS or does IE discard
    things it doesn't understand like "display: table" when it's building the
    DOM?
    Nik Coughlin, Jan 23, 2008
    #1
    1. Advertising

  2. Nik Coughlin

    David Mark Guest

    On Jan 22, 7:35 pm, "Nik Coughlin" <> wrote:
    > I know IE doesn't support "display: table", but when I examine an element


    Right.

    > with that style, eg. alert( element.style.display ) it gives me "block".  Is


    That's IE's default display style for tables.

    > there any way I can get the actual value that's in my CSS or does IE discard


    You could try the document.styleSheets collection, but I doubt you
    will find it in there.

    > things it doesn't understand like "display: table" when it's building the
    > DOM?


    Yes.
    David Mark, Jan 23, 2008
    #2
    1. Advertising

  3. Nik Coughlin

    Nik Coughlin Guest

    "David Mark" <> wrote in message
    news:...
    On Jan 22, 7:35 pm, "Nik Coughlin" <> wrote:
    >> I know IE doesn't support "display: table", but when I examine an element

    >
    > Right.
    >
    >> with that style, eg. alert( element.style.display ) it gives me "block".
    >> Is

    >
    > That's IE's default display style for tables.
    >
    >> there any way I can get the actual value that's in my CSS or does IE
    >> discard

    >
    > You could try the document.styleSheets collection, but I doubt you
    > will find it in there.
    >
    >> things it doesn't understand like "display: table" when it's building the
    >> DOM?

    >
    > Yes.


    OK. The reason that I ask is because I have written an IE behavior that
    looks for elements that are supposed to be display: table, display:
    table-row, display: table-cell etc. and rewrites the DOM so that they are
    actually a table, table row, table cell etc. It works perfectly except that
    in order to find the elements I'm currently tagging the elements with class
    names in the HTML and it would be a lot cleaner if I could just check the
    styles. Looks like I'll have to stick with the current method, which is a
    pity because it requires altering the HTML to work.
    Nik Coughlin, Jan 23, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Raymond Du

    Computed columns in datagrid

    Raymond Du, Dec 1, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,578
    Joe Fallon
    Dec 2, 2004
  2. John Dalberg
    Replies:
    1
    Views:
    426
    Bruce Barker
    Feb 3, 2006
  3. dhtml
    Replies:
    6
    Views:
    224
    dhtml
    Apr 3, 2008
  4. liketofindoutwhy

    getting computed style for Img width and height

    liketofindoutwhy, Apr 23, 2008, in forum: Javascript
    Replies:
    2
    Views:
    193
    liketofindoutwhy
    Apr 24, 2008
  5. Eric Bednarz

    Getting computed/current style

    Eric Bednarz, Mar 13, 2010, in forum: Javascript
    Replies:
    39
    Views:
    370
    David Mark
    Mar 21, 2010
Loading...

Share This Page