issues with IE when cloning file input node

I wrote a js script in which I needed to clone an <input type=”file”> node.

As usual, IE spoiled the party. It appears that when you clone an <input type=”file”> node (through “node.cloneNode(true);” or “dojo.clone(node);”), the value property is not cloned. Therefore you end-up with an almost useless cloned node.

For security reasons, .value property of such node is not writable with js (only readable), this part I understand fully, but why on earth can’t IE  set it on the cloned node???
FF does it pretty well…

Only solution I came up with was to attach input node into a form node, upload it and then immediately re-attach to its previous form node. This is a pretty ugly solution which did not work fully for me since both uploads were asynchronous and I could not know where to reattach my input node before hand. => too  bad for IE users, they won’t benefit my nice features. FF users will.

sources

Post a Comment

Your email is never published nor shared. You're allow to say what you want...