Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprite selector too long for IE8 #1193

Closed
henrahmagix opened this issue Mar 1, 2013 · 4 comments
Closed

Sprite selector too long for IE8 #1193

henrahmagix opened this issue Mar 1, 2013 · 4 comments

Comments

@henrahmagix
Copy link

Problem

This selector, created by Compass Sprite, is ignored by IE8. Splitting it up into smaller fragments fixes this.

Fix

This ruby class, CssSelectorSplitter, arbitrarily splits a long selector into smaller chunks. It was my first bit of Ruby code, based off this splitter, and works for me in a private project. It's a bit overkill in how much a long selector gets split up, but it works well enough for a deadline =)

Noticed before?

My Google-Fu isn't great, but I couldn't find anything.

However, this issue isn't IE's limitation on the number of selectors per stylesheet, which is 4095 and is solved by the previously mentioned splitter.

@scottdavis
Copy link
Member

This seems like an edge case problem and I'm glad you found a solution that works. I personally haven't run into this and I have very long selectors.

@henrahmagix
Copy link
Author

Thanks @scottdavis

Seeing as this isn't a problem with Compass, this issue can be closed, unless you'd like this to be visible to others for a while. Up to you =)

@verlok
Copy link

verlok commented Mar 26, 2013

Hello,
we're having the same problem here.

The "long" CSS selector generated by compass is the following:

.siteSprite-sprite, input[type="checkbox"] + .cb,
input[type="checkbox"]:checked + .cb,
input[type="radio"] + .rb,
input[type="radio"]:checked + .rb,
#userAndCart #cart .shoppingBag,
#search .lens,
#siteSwitch .closeIcon,
#siteFooter #newsletter #newsletterInfoWindow .closeIcon {
background: url('/.../siteSprite-sbb92fae07d.png') no-repeat;
}

And IE8 (and just IE8) ignores this CSS selector.

Is there something we can do to make Compass split this CSS selector in multiple ones?
Or, could this be a Compass feature that can be switched on in a nearly future version?

Thank you

@verlok
Copy link

verlok commented Mar 26, 2013

Hi again,
we just "debugged" the above "long" selector editing it directly in the css file, and we realized that

The problem IS NOT THE LENGTH of the selector, but the usage of the :checked pseudoelement.
Using the :checked pseudoelement in IE8 invalidates the whole selector!

So, the problem is not with compass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants