DelphiFAQ Home Search:

FireFox error "Selector expected. Ruleset ignored due to bad selector"

 

comments23 comments. Current rating: 4 stars (5 votes). Leave comments and/ or rate it.

Question:

The javascript-console of FireFox gives me these errors:

Error: Selector expected. Ruleset ignored due to bad selector.

followed by

Error: Unexpected end of file while searching for closing } of invalid rule set.

Do you have any ideas on what this means and how to resolve it?

Answer:

Review your .CSS style sheet file. You probably have HTML comments in there, similar to what people put in Javascript sections. Remove those comments as shown below.

// this will cause an error in Firefox:

    <style>
    <!--
       .styling { blah... }
    //-->
    </style>


// this is ok:

    <style>
       .styling { blah... }
    </style>

Content-type: text/html

Comments:

You are on page 2 of 2, other pages: 1 [2]
2010-01-26, 22:48:59
[hidden] from Australia  
rating
I had a similar problem, turns out the html was saved as UTF-16, re-encoded as UTF-8 and everything worked. ie, the problem was not in the css file but in the html file.
2010-01-29, 05:59:09   (updated: 2010-01-29, 06:06:51)
anonymous from Germany  
Under some circumstances FF adds something like this to my code:
<style media='screen' type='text/css'>
.dipkTab{ font-family:Helvetica;font-size:12px;text-align:center;backgckground-color:#EEEEEE;border:1px solid black;};
</style>
As you can see there is the before mentioned semicolon after the closing }.
Recognized it while using Firebug. Yet I don't know why this happens.
Cheers
2010-01-29, 07:10:45
anonymous from Germany  
Sorry, my mistake. That piece of code was buried in our source. Well, at least that verifies the '};' error.
2010-05-06, 03:53:42
anonymous from Latvia  
2012-06-06, 19:10:05
anonymous from London, United Kingdom  
Thank you, this helped me too (I also had a selector starting with a number)
2012-07-10, 11:13:23
anonymous from Canada  
but if you HTML is saved in unicode ... FF goes nuts...


This was exactly the cause of my identical issue. Changed the file encoding to ANSI and everything back to normal. THANK YOU!
2013-03-25, 21:03:10
anonymous from United States  
rating
frederick j pilgeram
Eden, Montana
Born on June 15, 1959


Keywords:
2015-02-21, 22:21:46
anonymous from Indonesia  
Saya haturkan banyak terima kasih, karnah KI COKENG membantu memberikan solusi,,,kini saya udah lepas dari kendala yg saya alami kemaren, dan angka yg aki berikan sangat tepat, hanya sekali ini saya main togel...Buat kamu yg pengen menang togel....bisa hub: Ki Cokeng di: +6285394330318. terima kasih.
You are on page 2 of 2, other pages: 1 [2]

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: