Generated IDs Fail in IE

pfahlr - May 9, 2008 - 15:33
Project:SWFObject API
Version:5.x-1.2-15
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

...
$sPath = drupal_get_path('theme','[your theme name]');
$url = "/$sPath/flash/video_player.swf"; //path to flash file
print theme("swfobject_api", $url, $params, $vars);
...

When I run this in IE I get the error "swf_video" is undefined. The module generates the id swf_video-player_1 for the embed.

In this line:
$name = form_clean_id(str_replace('.swf', '', basename($url))) .'_'. $id_count;

form_clean_id() replaces the underscores (_) with hyphens (-), and the error message implies that IE fails to parse at the hyphen.

so... not really sure if this should be considered an issue with form_clean_id (http://api.drupal.org/api/function/form_clean_id/6), or an invalid use of form_clean_id in swfobject.

I've attached a hack that will fix the error message in IE, though I think a more well thought out solution is in order.

AttachmentSize
swfobject.patch449 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.