[jQuery] Interface - dragging nodes containing text areas (Firefox, Safari)
I've got an issue with using the Interface idrag.js. The Interface website implies I should be asking here for support issues.I have a DOM structure that contains, amongst other things, a text field and a textArea. What I find when I drag the object in Firefox is that any text I might have typed into the textArea disappears, and when I stop the drag it re-appears.I have dug into the idrag.js source and found that it works by doing a cloneNode(true) on the object being dragged and hiding the original. That cloned node is then appended to a dragHelper at the top level of the HTML tree, presumably to avoid having to deal with issues of dragging things from deeper structures and calculating drop positions, etc. Whatever the reason, what I see (using the DOM inspector from the web developer toolbar for Firefox) is that the node tree is correctly cloned, except that the "value" property of the textArea is not replicated. Hence the cloned drag object has no text in it.The problem is worse in Safari as the text field text also disappears during the drag. In IE it all works fine (not often you hear those words :-)A further wrinkle is that if the original text area contained initial text within tag (e.g. "textarea class='text' rows="8"flibble/textarea") then that text (in this case "flibble") appears during the drag, even if I have typed new text into the textArea before dragging.Has anyone else come across this problem and found any way of addressing it? If there is no easy fix then I'll probably have to change the Interface drag code itself.Doug___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Interface - dragging nodes containing text areas (Firefox, Safari)
I've got an issue with using the Interface idrag.js. ... what I see (using the DOM inspector from the web developer toolbar for Firefox) is that the node tree is correctly cloned, except that the value property of the textArea is not replicated. Hence the cloned drag object has no text in it. ... A further wrinkle is that if the original text area contained initial text within tag (e.g. textarea class='text' rows=8flibble/textarea) then that text (in this case flibble) appears during the drag, even if I have typed new text into the textArea before dragging. Has anyone else come across this problem and found any way of addressing it? Here's what the W3C says about cloneNode: Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247 Most people would want dynamic property values to be copied as well, but it looks like FF uses the defaulted attributes; is the W3C is saying that's compliant behavior? (The sentence isn't very clear to me.) Firefox does something similar when you get .innerHTML on an element, it represents the default attributes and not the current state. The only workaround I can think of is to copy the dynamic values that got left behind right after cloning. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Interface - dragging nodes containing text areas (Firefox, Safari)
Hmm, thanks for that. The clone is a deep clone so I would expect the result to include the text value. I think I'll have to work around this in the way you suggest (or perhaps modify the idrag.js to not use a clone). Doug On 18 Oct 2006, at 18:25, Dave Methvin wrote: I've got an issue with using the Interface idrag.js. ... what I see (using the DOM inspector from the web developer toolbar for Firefox) is that the node tree is correctly cloned, except that the value property of the textArea is not replicated. Hence the cloned drag object has no text in it. ... A further wrinkle is that if the original text area contained initial text within tag (e.g. textarea class='text' rows=8flibble/ textarea) then that text (in this case flibble) appears during the drag, even if I have typed new text into the textArea before dragging. Has anyone else come across this problem and found any way of addressing it? Here's what the W3C says about cloneNode: Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247 Most people would want dynamic property values to be copied as well, but it looks like FF uses the defaulted attributes; is the W3C is saying that's compliant behavior? (The sentence isn't very clear to me.) Firefox does something similar when you get .innerHTML on an element, it represents the default attributes and not the current state. The only workaround I can think of is to copy the dynamic values that got left behind right after cloning. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/