Hi Noah, all...
Here's my latest test page:
<
http://assets.registerguard.com/demos/wc2/test3.html>
... that's sans-WC2 or element.write. View source to see my tests.
---
Problem:
IE8 will not allow innerHTML or appendChild() if the parent is an
<object> and the child is an <embed>.
I did not get a chance to test in IE < 8, but I assume the problem is there too.
---
My current conclusion:
I think it's going to be almost impossible to get IE to appendChild()
or innerHTML an <embed> to an <object>. :(
---
Possible "solution" #1:
I was able to "fake out" IE, and convert the <embed> into a <param>
and, to my surprise, IE allowed appendChild()!
In other words, I took this:
<embed width="300" height="250" allowscriptaccess="never"
base="
http://s0.2mdn.net/1678108" name="DCF260974778" wmode="opaque"
swliveconnect="true" quality="high"
type="application/x-shockwave-flash"
flashvars="moviePath=
http://s0.2mdn.net/1678108/&moviepath=http://s0.2mdn.net/1678108/&clickTAG=http%3A//ad.doubleclick.net/click%253Bh%253Dv8/3d08/3/0/%252a/h%253B260974778%253B0-0%253B0%253B85104935%253B4307-300/250%253B49753400/49746008/1%253B%253B%257Esscs%253D%253fhttp%3A//www.mcdonalds.com/us/en/home.html&clickTag=http%3A//ad.doubleclick.net/click%253Bh%253Dv8/3d08/3/0/%252a/h%253B260974778%253B0-0%253B0%253B85104935%253B4307-300/250%253B49753400/49746008/1%253B%253B%257Esscs%253D%253fhttp%3A//www.mcdonalds.com/us/en/home.html"
src="
http://s0.2mdn.net/1678108/NEW%20PDX%20McD-DollarDrink-300x250.swf">
... and converted it to this:
<param width="300" height="250" allowscriptaccess="never"
base="
http://s0.2mdn.net/1678108" name="DCF260974778" wmode="opaque"
swliveconnect="true" quality="high"
type="application/x-shockwave-flash"
flashvars="moviePath=
http://s0.2mdn.net/1678108/&moviepath=http://s0.2mdn.net/1678108/&clickTAG=http%3A//ad.doubleclick.net/click%253Bh%253Dv8/3d08/3/0/%252a/h%253B260974778%253B0-0%253B0%253B85104935%253B4307-300/250%253B49753400/49746008/1%253B%253B%257Esscs%253D%253fhttp%3A//www.mcdonalds.com/us/en/home.html&clickTag=http%3A//ad.doubleclick.net/click%253Bh%253Dv8/3d08/3/0/%252a/h%253B260974778%253B0-0%253B0%253B85104935%253B4307-300/250%253B49753400/49746008/1%253B%253B%257Esscs%253D%253fhttp%3A//www.mcdonalds.com/us/en/home.html"
src="
http://s0.2mdn.net/1678108/NEW%20PDX%20McD-DollarDrink-300x250.swf">
... and I was able to appendChild() the "faux" param to <object>!
That's when I hit a brick wall... How can I convert the "faux" <param>
BACK into an <embed> after having already appendChild() to the
<object>? I thought maybe regex? Unfortunately, I haven't had the
spare time to go further with this idea (not to mention, it seems very
patch hacky).
Question: What do you think of the above "solution"? Would this be a
patch that you'd incorporate into the main branch of either
element.write or WC2 (if I was able to create a fully working patch)?
In other words, if the above sounds like a bad idea, and you'd never
include that type of hackiness in the official release of
element.write or WC2, then I'd happily to move on to testing other
solutions. :)
---
Possible "solution" #2:
Just SKIP <object> or <embed>!!!! :D
In this demo:
<
http://assets.registerguard.com/demos/wc2/test1.html>
I modified WC2 to ignore <embed>.
Unfortunately, that stops the ad from working in FF/Mac and IE8/PC.
Note: IE8 will not throw an error (because <embed> is skipped) but
then the ad does not show, and the page won't stop "loading" (i.e. the
spinner in the tab just keeps going and going and going and...).
So, this patch ain't the solution, BUT....
---
Possible "solution" #3 (based on "solution" #2 above):
Keep in mind, I'm still trying to wrap my head around WC2 and element.write...
At this point, based on my knowledge of your scripts to date, I'm
thinking that the best solution would be to __skip__ the element.write
parsing of an <object> if it contains an <embed>.
My question: Would this solution work? I don't yet fully understand
how all of your code works, so it's hard for me to make a judgement
call...
Pseudo patch code:
WC2 parse HTML
* Current tag is an <object>
* Code checks for immediate child <embed>
* If <embed> exists:
* Skip <object> and appendChild() back to page (?)
* Continue parsing HTML.
I just can't think of a better solution (other than maybe "solution" #1 above).
Question:
When would element.write be needed if it's an <object>? Would it be
out of ordinary (or the mission/goals of your code) to have WC2 or
element.write skip parsing of an <object>, and just spit the <object>
back out to its parent element without parsing any of its children?
I kinda like this solution, but I'm not sure of the best spot to put
it in WC2 or element.write.
---
Lol, did any of that make sense?
Did I mention that I hate IE? :D
Thoughts?
I think I need a kick in the right direction here... Do you think I
should be patching WC2 or element.write? Both? None? Seems like
skipping tags works great in WC2, but appendingChildren would be best
done in element.write... Am I talking crazy here?
Thanks for listening.
Micky