Hacker News new | past | comments | ask | show | jobs | submit login

How about something like this:

    <a href="some-visited-url">
      <span class="test"></span>
    </a>
Does the CSS for span.test change if the link is visited or not?

Also, this will be very awkward when the style you see with your eyes is not the style that is given to JavaScript.




That should be fine. If they make selectors that have an a:visited (and whatever else) take the special code paths it should work fine. The style test in your example is going to be uniform across visited and unvisited unless it's something like:

a:visited .test { /* sneaky style */ }


That's exactly my point. If I define:

  a .test {
    color: red;
  }
  
  a:visited .test {
    color: green;
  }
Then I could for example using jQuery do:

  $('a .test').each(function() {
    if ( $(this).css('color') == 'green' ) {
      console.log( $(this).parent().attr('href') );
    }
  });
Is that incorrect?


| When a web page tries to get the computed style of a link (or any of its sub-elements), Firefox will give it unvisited style values.


They've probably thought about this, but what about siblings?

a:visited + .sneakydiv { /* ... */ }


Ah, there it is.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: