danriegsecker / swfobject

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

Verify Head Tag Exists #150

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In SWFObject v2.1 the createCSS function fails to validate that the
document has a head tag, this throws an exception in Opera 9.27, the
variable h returns undefined and an appendChild operation is then attempted
on an variable of an undefined type. 

No other browser including Opera 9.5.1 appears to exhibit this same issue.
I made modifications in the createCSS function, to create a head element if
necessary. I realize this problem is low because Opera 9.2x is no longer
the current release and that this problem is caused by improper HTML, even
so this does not negate the fact that an exception is caused.

if(!h) {
    h = doc.createElement("head");
    doc.insertBefore(h,doc.firstChild);
}
h.appendChild(s);

Original issue reported on code.google.com by z0036...@gmail.com on 20 Aug 2008 at 4:36

GoogleCodeExporter commented 9 years ago
I don't call this an issue, to be honest.

The head element is required in the latest HTML specs, so authors should use it.
Furthermore, the SWFObject documentation clearly explains that you should put 
your
JavaScript code in the head element and should use a head element.

So to me this goes into the category nesting errors, writing invalid HTML, or
practicing outdated coding practices. 

Original comment by bobbyvandersluis on 22 Aug 2008 at 9:32