IE sucks (or maybe it's me): class selector fails

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DuncanIdaho

    IE sucks (or maybe it's me): class selector fails

    Hello

    IE 7.0.5730.11
    Opera 9.27
    Firefox 2.0.0.14

    I have the following in my stylesheet

    ..navbody a{
    text-decoration: none;
    color: rgb(68, 146, 181);
    }

    a.leaf{
    text-decoration: none;
    color: rgb(254, 100, 253);
    font-size: 0.75em;
    }

    AJAX produces the following html

    <div id="navmenu">
    <div id="menuheader" >
    Browse Catagories
    <br/>
    <a href="javascrip t:getMenuUpdate ('-1')">collapse menu</a>
    </div>
    <div id="menudiv" class="navbody" >
    <span>
    <a href="javascrip t:getMenuUpdate ('1')">
    </a>
    <a class="node" href="javascrip t:getMenuUpdate ('1')">Jeweller y</a>
    </span>
    <br/>
    <span>
    <img border="0" src="images/navspacer.jpg"/>
    <a class="leaf" href="products? catagoryId=1:1" >Earrings</a>
    </span>
    .... etc

    in Opera and Firefox the anchor with class 'leaf' is rendered in a
    smaller pink font (nice!) in IE it's rendered in the same sized light
    blue as other stuff in the navbody

    Are class selectors supposed to work when output is dynamically
    generated ? or is this another 'feature' of IE

    TIA

    Idaho
  • Steve Pugh

    #2
    Re: IE sucks (or maybe it's me): class selector fails

    On Apr 23, 2:12 pm, DuncanIdaho <Duncan.Idaho2. ..@googlemail.c om>
    wrote:
    I have the following in my stylesheet
    >
    .navbody a{
            text-decoration: none;
            color: rgb(68, 146, 181);
    }
    >
    a.leaf{
            text-decoration: none;
            color: rgb(254, 100, 253);
            font-size: 0.75em;
    }
    >
    AJAX produces the following html
    [snip]
    in Opera and Firefox the anchor with class 'leaf' is rendered in a
    smaller pink font (nice!) in IE it's rendered in the same sized light
    blue as other stuff in the navbody
    >
    Are class selectors supposed to work when output is dynamically
    generated ? or is this another 'feature' of IE
    Known problem with IE when elements are added to the DOM via scripting
    (the fact that the content was fetched via AJAX is irrelevant, you can
    see the same issue when adding it locally). You need to apply the
    class via the className property _after_ the element has been inserted
    into the DOM. I used to know the reason for this but it's slipped my
    mind (must be getting old). Ask in an IE or JavaScript related group
    for more details.

    Steve

    Comment

    • DuncanIdaho

      #3
      Re: IE sucks (or maybe it's me): class selector fails

      Steve Pugh wrote:
      On Apr 23, 2:12 pm, DuncanIdaho <Duncan.Idaho2. ..@googlemail.c om>
      wrote:
      >
      >I have the following in my stylesheet
      >>
      >.navbody a{
      > text-decoration: none;
      > color: rgb(68, 146, 181);
      >}
      >>
      >a.leaf{
      > text-decoration: none;
      > color: rgb(254, 100, 253);
      > font-size: 0.75em;
      >}
      >>
      >AJAX produces the following html
      [snip]
      >
      >in Opera and Firefox the anchor with class 'leaf' is rendered in a
      >smaller pink font (nice!) in IE it's rendered in the same sized light
      >blue as other stuff in the navbody
      >>
      >Are class selectors supposed to work when output is dynamically
      >generated ? or is this another 'feature' of IE
      >
      Known problem with IE when elements are added to the DOM via scripting
      OK, well I tried a javascript group with no luck, I've got a few ideas
      though so I'll give them a try.

      Thanks for taking the time to reply

      Idaho

      Comment

      Working...