Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
585 views
in Technique[技术] by (71.8m points)

jquery ui - Can I move a Flash object within the DOM without it reloading?

I'm trying to use the scale effect from the jQuery UI library on a wrapper element that contains a Flash object.

The problem I'm encountering is that the content of my wrapper is automatically moved into another wrapper (.ui-effects-wrapper), and when this happens the Flash object reloads.

Of course, the specific problem here has to do with the tactic employed by jQuery UI — but generally, is it possible to move a Flash object within the DOM without it reloading?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I only know how this works in Gecko (Firefox's rendering engine). In that engine, no, you can't move an <object> or <embed> within the DOM tree without reloading the associated Flash object. It's actually worse than that: you can't do anything that would cause the CSS box drawn by the Flash object to be destroyed. Gecko treats CSS boxes as ephemeral; almost any DOM modification involving the subtree that contains the <object> will destroy the associated CSS box, and so will any number of CSS manipulations ranging from the obvious (set display:none) to the obscure (change opacity or overflow). But the state of the plugin is attached to the box tree rather than the DOM tree, so if the box is destroyed and recreated, the plugin gets reloaded.

This is agreed to be a bug — bug 90268, nine years old as of this writing. See, particularly, comment 80 for the really long explanation of why this is and why, sad to say, I would not be surprised if it went another nine years without getting fixed.

Possibly you could work around this by exporting all of your plugin state to JavaScript in the containing page.

UPDATE: Only two years later, the bug has been fixed! The fix will be in Firefox 13, currently scheduled for release on June 5, 2012; if you want it sooner, it'll be in "beta" on April 24, and "aurora" shortly after March 13 (which is today). Josh Aas deserves much credit for wrestling this one to the ground — the fix went through 54 revisions and modifies more than 3,000 lines of code.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...