Merge pull request #1 from jhiswin/master.

Fix for createSWF on IE9
Issue 357: Fix to avoid vertical scrollbar and white rectangle from appearing during initial flash player test

http://code.google.com/p/swfobject/issues/detail?id=357

Hides the <object> created during Flash Player detection and hides the <span> created during domready testing.

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue #400: Not initialized 'main' (or 'h') variable in script

http://code.google.com/p/swfobject/issues/detail?id=400

Experimented with linting the entire library to ensure all vars are declared before first use, but this led to too many changes. For now I simply fixed the specific example provided in the issue ticket.

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue #409: ie = !+"\v1" !?

http://code.google.com/p/swfobject/issues/detail?id=409

Replaced Giammarchi's hack with navigator.appName check. Simple but effective.

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue 440: swfobject.embedSWF() does not support numeric version numbers

http://code.google.com/p/swfobject/issues/detail?id=440

Edited hasPlayerVersion to accept a single number as an argument, such as hasPlayerVersion(10). This is in addition to existing functionality, so people can still pass strings as before: hasPlayerVersion("10") or hasPlayerVersion("10.0.0")

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue 332: swfobject 2.2 inclusion throws JS error

http://code.google.com/p/swfobject/issues/detail?id=332

t.GetVariable("$version") is known to fail in Flash Player 8 on Firefox; if this error is encountered, assume FP8 or lower (returns FP version 8.0.0). Time to upgrade your Flash Player.

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue 549: callDomLoadFunctions be done twice

http://code.google.com/p/swfobject/issues/detail?id=549

Eliminated redundant callDomLoadFunctions() invocation.

Tested in OS X: Chrome 11, Safari 5, Firefox 4, Opera 11
Tested in Win7: IE9, Firefox 3.6
Tested in WinXP: IE7, Firefox 3.0

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue 418: Slowness when manipulating DOM because of test in callDomLoadFunctions

http://code.google.com/p/swfobject/issues/detail?id=418

There is an attempt to use document.getElementsByTagName("body")[0] before it is defined. Since try/catch is expensive, I have added a simple test if(!document.getElementsByTagName("body")[0]) to ensure <body> is available before attempting to add a <span>. Hopefully this clears up some of the slowness reported in this thread.

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue 542: Bad id in callback when id's attribute is specified

http://code.google.com/p/swfobject/issues/detail?id=542

The callback object did not return the correct ID when the <object> ID is specified via SWFObject's 'attributes' argument. Corrected the behavior. Tested in:

OS X: Chrome 11, Safari 5, Firefox 4, Opera 11
WinXP: Firefox 3, IE7
Win7: Firefox 3.6, IE9

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue 539: Wrong conditions used in checking mimeTypes

http://code.google.com/p/swfobject/issues/detail?id=539

Updated conditions in if() clause that checks mimeTypes.

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue 533: Can only pass a selector to embedSWF

http://code.google.com/p/swfobject/issues/detail?id=533

Added ability to pass element reference in place of selector for embedSWF, createSWF and removeSWF functions. The main edit was in the getElementById 'helper' function, which means any function in the SWFObject library that uses getElementById will be able to accept a selector OR an element reference, including setVisibility and others.

Tested in:
Mac OS X: Chrome 11, Safari 5, Firefox 4, Opera 11
Win7: Firefox 3.6, IE9
WinXP: Firefox 3, IE7

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue 451: adding Object.prototype.function makes generated flashvars invalid

http://code.google.com/p/swfobject/issues/detail?id=451

Adding a simple obj.hasOwnProperty(prop) check fixes the problem.

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue 536: Flashvars parsing wrong in IE

http://code.google.com/p/swfobject/issues/detail?id=536

This is a potentially controversial change. I replaced createSWF's inner workings.  As previously constructed, createSWF generated a string for IE and native HTML <object> for non-IE. This lead to unequal handling of flashvars, among other things (issue 536 is focused specifically on the unequal flashvars handling). The non-IE handling used setAttribute to append flashvars to the param/object, whereas the IE version used string concatenation.

This proposed version of createSWF creates an <object> for ALL browsers, but for IE converts the <object> to a string via innerHTML before appending to the page using outerHTML (the outerHTML handling is retained from SWFObject 2.2).

This streamlines the code, make handling of flashvars consistent in all browsers, and hopefully compresses better, too.

I haven't tested it thoroughly, but so far it works in all the browsers I've tried, including:

OSX: Chrome 11, Firefox 4
Win7: IE9
WinXP: IE7
Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue 414: More succinct markup to aid with page weight and complexity

http://code.google.com/p/swfobject/issues/detail?id=414

Modified getObjectById to support simplified static publishing markup.

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue 536: Flashvars parsing wrong in IE

Had a typo in prior issue 536 commit; omitted div.appendChild(o) by mistake.

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue 536: Flashvars parsing wrong in IE

Modification for compatibility with older versions of IE: ensure the 'data' attribute is not added to the <object> in IE.

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue 536: Flashvars parsing wrong in IE

Modification of createSWF() based upon additional research. See details of research at http://pipwerks.com/2011/05/30/using-the-object-element-to-dynamically-embed-flash-swfs-in-internet-explorer/

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Small cleanup of createSWF

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Fixed typo

Signed-off-by: Philip Hutchison <philip@pipwerks.com>
Issue 66: flashVars are not escaped (urlencoded) properly

http://code.google.com/p/swfobject/issues/detail?id=66

Added a new swfobject.enableUriEncoding() method that optionally turns on encodeURIComponent for FlashVars.

Signed-off-by: Philip Hutchison <philip@pipwerks.com>