(attObj, parObj, id)
| 438 | /* Cross-browser dynamic SWF creation |
| 439 | */ |
| 440 | function createSWF(attObj, parObj, id) { |
| 441 | var r, el = getElementById(id); |
| 442 | if (ua.wk && ua.wk < 312) { return r; } |
| 443 | if (el) { |
| 444 | if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content |
| 445 | attObj.id = id; |
| 446 | } |
| 447 | if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML |
| 448 | var att = ""; |
| 449 | for (var i in attObj) { |
| 450 | if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries |
| 451 | if (i.toLowerCase() == "data") { |
| 452 | parObj.movie = attObj[i]; |
| 453 | } |
| 454 | else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword |
| 455 | att += ' class="' + attObj[i] + '"'; |
| 456 | } |
| 457 | else if (i.toLowerCase() != "classid") { |
| 458 | att += ' ' + i + '="' + attObj[i] + '"'; |
| 459 | } |
| 460 | } |
| 461 | } |
| 462 | var par = ""; |
| 463 | for (var j in parObj) { |
| 464 | if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries |
| 465 | par += '<param name="' + j + '" value="' + parObj[j] + '" />'; |
| 466 | } |
| 467 | } |
| 468 | el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>'; |
| 469 | objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only) |
| 470 | r = getElementById(attObj.id); |
| 471 | } |
| 472 | else { // well-behaving browsers |
| 473 | var o = createElement(OBJECT); |
| 474 | o.setAttribute("type", FLASH_MIME_TYPE); |
| 475 | for (var m in attObj) { |
| 476 | if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries |
| 477 | if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword |
| 478 | o.setAttribute("class", attObj[m]); |
| 479 | } |
| 480 | else if (m.toLowerCase() != "classid") { // filter out IE specific attribute |
| 481 | o.setAttribute(m, attObj[m]); |
| 482 | } |
| 483 | } |
| 484 | } |
| 485 | for (var n in parObj) { |
| 486 | if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element |
| 487 | createObjParam(o, n, parObj[n]); |
| 488 | } |
| 489 | } |
| 490 | el.parentNode.replaceChild(o, el); |
| 491 | r = o; |
| 492 | } |
| 493 | } |
| 494 | return r; |
| 495 | } |
| 496 | |
| 497 | function createObjParam(el, pName, pValue) { |
no test coverage detected