(attObj, parObj, id)
| 405 | /* Cross-browser dynamic SWF creation |
| 406 | */ |
| 407 | function createSWF(attObj, parObj, id) { |
| 408 | var r, el = getElementById(id); |
| 409 | if (ua.wk && ua.wk < 312) { return r; } |
| 410 | if (el) { |
| 411 | if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content |
| 412 | attObj.id = id; |
| 413 | } |
| 414 | if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML |
| 415 | var att = ""; |
| 416 | for (var i in attObj) { |
| 417 | if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries |
| 418 | if (i.toLowerCase() == "data") { |
| 419 | parObj.movie = attObj[i]; |
| 420 | } |
| 421 | else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword |
| 422 | att += ' class="' + attObj[i] + '"'; |
| 423 | } |
| 424 | else if (i.toLowerCase() != "classid") { |
| 425 | att += ' ' + i + '="' + attObj[i] + '"'; |
| 426 | } |
| 427 | } |
| 428 | } |
| 429 | var par = ""; |
| 430 | for (var j in parObj) { |
| 431 | if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries |
| 432 | par += '<param name="' + j + '" value="' + parObj[j] + '" />'; |
| 433 | } |
| 434 | } |
| 435 | el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>'; |
| 436 | objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only) |
| 437 | r = getElementById(attObj.id); |
| 438 | } |
| 439 | else { // well-behaving browsers |
| 440 | var o = createElement(OBJECT); |
| 441 | o.setAttribute("type", FLASH_MIME_TYPE); |
| 442 | for (var m in attObj) { |
| 443 | if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries |
| 444 | if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword |
| 445 | o.setAttribute("class", attObj[m]); |
| 446 | } |
| 447 | else if (m.toLowerCase() != "classid") { // filter out IE specific attribute |
| 448 | o.setAttribute(m, attObj[m]); |
| 449 | } |
| 450 | } |
| 451 | } |
| 452 | for (var n in parObj) { |
| 453 | if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element |
| 454 | createObjParam(o, n, parObj[n]); |
| 455 | } |
| 456 | } |
| 457 | el.parentNode.replaceChild(o, el); |
| 458 | r = o; |
| 459 | } |
| 460 | } |
| 461 | return r; |
| 462 | } |
| 463 | |
| 464 | function createObjParam(el, pName, pValue) { |
no test coverage detected