SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot atetlaw's Avatar
    Join Date
    Feb 2007
    Location
    Melbourne, Australia
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A quirk with IE7 and CSS3 attribute selectors - looking for confirmation

    Hi all,
    I've been doing some testing of IE7's support for the CSS3 attribute selectors and have discovered a little quirk.

    IE7 seems to only match when you have a valid value for the attribute. For example take this selector:

    Code:
    div[align*="le"] {...}
    It will match this element fine:

    Code:
    <div align="left"></div>
    But not this element:

    Code:
    <div align="leftttt"></div>
    And it seems to be because "leftttt" is not a valid value for align.

    This is a very minor quirk, because there are not many HTML attributes with a limited range of valid values, dir is the only other one I can think of and the behaviour is the same.

    IE8 doesn't exhibit the same behaviour. In IE8 the above selector will match both HTML elements.

    Anyone else notice this behaviour in IE7 ?

  2. #2
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,782
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    I see that too.

    Edit:

    I thought that maybe a change of DTD from HTML to XHTML would cause a change in behavior but none. Seems it's just the way IE7 implimented it.
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  3. #3
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    atetlaw, I have not come across this issue before but I think I should point out that strictly speaking, containing style information within the HTML is unsemantic. Under ordinary circumstances selectors would only affect classes, ID's, titles or rel's (and / or accepted semantic attributes) which usually require explicit names (case sensitive).

  4. #4
    SitePoint Zealot atetlaw's Avatar
    Join Date
    Feb 2007
    Location
    Melbourne, Australia
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AlexDawson View Post
    atetlaw, I have not come across this issue before but I think I should point out that strictly speaking, containing style information within the HTML is unsemantic. Under ordinary circumstances selectors would only affect classes, ID's, titles or rel's (and / or accepted semantic attributes) which usually require explicit names (case sensitive).
    Absolutely. I'm not actually trying to match a div using the align attribute, just doing some tests to find out how IE7 behaves with this selector.

  5. #5
    SitePoint Zealot atetlaw's Avatar
    Join Date
    Feb 2007
    Location
    Melbourne, Australia
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by RyanReese View Post
    I see that too.

    Edit:

    I thought that maybe a change of DTD from HTML to XHTML would cause a change in behavior but none. Seems it's just the way IE7 implimented it.
    Thanks, Ryan!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •