internet explorer 8 - How to properly clone (jQuery) an element that has style applied through PIE? -


I'm successfully using the .htc version on a new project IE8 +) will be targeted, however, I'm having trouble trying to clone the element on which the PIE-style applies.

I have found a JSFID to explain the problem, and the input is welcome (even other, similar approach PIE options) - However, .htc Files can not be referenced cross-domain, so this Bella simply uses actual markup and CSS.

Any help is appreciated. What could be the reason, is there any possible solution?

Cheers, POL

Two issues facing cloning elements of PII Come on:

  1. The VML elements that are inserted by PIE will also be included in the cloned material, but they have been cloned incorrectly for some reason the namespace prefix, and
  2. The unique _pieId feature is that PIE puts it on each target element, which is also copied in the clone. Which is a conflict between IDs, which are no longer unique.

    Therefore, to get the proper clone, we have to get rid of both. For the first time, setting the behavior style property of each PIE element can temporarily be 'None', after which cloning and can be restored. Setting it into 'None' runs PEE's cleanup methods that remove all VML elements. The second item should be done manually, because PIE does not automatically remove _pieId properties automatically. Both of these are easy enough for the script.

    There is a custom jQuery extension that handles it in my limited test:

      jQuery.fn.cloneWithPIE = function (DataAndEvents, DeepDataAndEvents) {// with PIE Attach elements and remove their behavior: var pied = this.find ('[_ pieId]'). CSS ('behavior', 'none'); // clone: ​​var clone = this.clone (data entrents, deep data entries); // Remove _pieId from each original and cloned // elements, and restore behavior: pied.add (clone.find ('[_ pieId]')). RemoveAttr ('_ pieId'). CSS ('behavior' ''); Return clone; }   

    You will then call the CloneWithPIE method such that you will call the normal clone method:

      $ ('. SomeEl'). CloneWithPIE () .appendTo (newParent)   

    Hope that works for you.

Comments