ouyang789987 / swfobject

Automatically exported from code.google.com/p/swfobject
0 stars 0 forks source link

IE error when using numeric selector #524

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create flash object with an id that is numeric, e.g. id="1234"
2. register with swfobject using the id '1234'
3. error in IE on dynamicStylesheet.addRule

What is the expected output? What do you see instead?

    Error: Object doesn't support this property or method

This doesn't stop the flash piece from loading.

In IE, an error is thrown when trying to load the dynamic css. line 565.

    dynamicStylesheet.addRule(sel, decl);

Basically it looks like the addRule function is stricter about what a "valid" 
selector is.  It wont' take numeric ids and it didn't even work when I prefaced 
it with an underscore, e.g. id="_1234".

What version of the product are you using? On what operating system?

v2.2 stable from Google CDN and also trunk r402. IE7-IE8, Win 7 64-bit

Please provide any additional information below.

I didn't run extensive tests on this.  I will try to do something more rigorous 
a little later, but it's pretty easy to reproduce even with some ad-hoc browser 
fiddling.

Original issue reported on code.google.com by marco.ro...@gmail.com on 9 Dec 2010 at 7:45

GoogleCodeExporter commented 9 years ago
Thanks for the detailed info.

In HTML 4 numeric IDs aren't valid HTML; IDs are supposed to start with a 
letter.  As you probably know, HTML5 changes the rules, allowing other 
characters to be used as an ID. However, this doesn't mean browser support is 
up to snuff yet. The code you reference is IE's "addRule" method for adding 
properties to a stylesheet.  As you said yourself, "Basically it looks like the 
addRule function is stricter about what a "valid" selector is.  It wont' take 
numeric ids and it didn't even work when I prefaced it with an underscore, e.g. 
id="_1234"."

SWFObject is using IE's baked-in stylesheet support, which (not surprisingly) 
doesn't support HTML5's lenient ID conventions.  In short, this isn't a 
SWFObject bug, it's a shortcoming in IE.  However, we may be able to refactor 
the code to avoid using addRule (thereby increasing SWFObject's compatibility 
with HTML5), so I'll leave this issue open.

Original comment by platelu...@gmail.com on 14 May 2011 at 4:33

GoogleCodeExporter commented 9 years ago
Decided to merge with issue 343 since they're both addressing shortcomings with 
selector support.

Original comment by platelu...@gmail.com on 14 May 2011 at 8:06