-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dstNode is undefined in function prepareNodeCopyAsDragImage #111
Comments
Thanks for the detailed report and your effort in investigation. I don't have time right now to go deep but recommend investigating further on the result of https://github.com/timruffles/ios-html5-drag-drop-shim/blob/b485129b36fb875a072743df1a1d641b4183c34d/src/index.ts#L1303 Because in your case obviously the Maybe there is some bug or edge cases regarding the cloneNode() method that is rather undocumented and the polyfill trips over it. |
Using your suggestion I isolated where I cloned the following node:
and got:
The The issue here is clear, the It looks like perhaps With my 'hotfix' above though, the svg appears in the drag image though... now that's got me confused. My 'fix' only fixes a symptom of an incomplete or incorrect Any ideas? It seems like the actual bug (or just missing functionality) here is in the |
Thanks for posting your findings. I'd rather push for a solution that works with webcomponents/shadowdom for everybody. So based on more research I think we can find a solution that can be included into the library. Don't have any knowledge about cloning and shadow dom - maybe there's some documentation. Maybe its also the fault of a webcomponents polyfill? Are you using any? Another approach could be to attach the node to the DOM with |
I think the problem originates from ShadyDOM and cloning without using the ShadyDOM API. Here is a related issue Polymer/polymer#1888 |
It does seem related to that issue, although when replacing https://github.com/timruffles/ios-html5-drag-drop-shim/blob/0f2c6426d2618fadd1e9dfa4816fa0384b0291a0/release/index.js#L604 with
I run into the same issue. When running through the chrome debugger I notice that all the ShadyDOM nodes are there. However, I stepped through the code and found this (notice the evaluated It would seem the svg node is incorrectly cloned as a text node? Text nodes do not have a style property so an error occurs on line 590 in the screenshot above. I will do some research to see if this issue still occurs when there are no SVGs in the ShadyDOM. |
I tried nesting some components and making the parent draggable, and the drag image shows up just fine including all the child elements that are in ShadyDOM. It looks like this issue may be somehow isolated to SVGs in ShadyDOM specifically. |
API additions to enable custom dragImageSetup released as of v2.3.0-rc.0. Closing this one as the polyfill can't yet implement a general purpose solution for ShadowDOM/ShadyDOM. |
In the function
prepareNodeCopyAsDragImage
I am running into an error that causes dragging and dropping to break. In an attempt to debug this issue I found thatdstNode
was sometimes undefined, which would break the script ondstNode.style.setProperty(...);
Sometimes,
dstNode
was a text node (dstNode.nodeType === 3
) which would also break on the above line, as thestyle
object was undefined. I was able to 'fix' this by wrapping all the problem lines inbut I'm not sure if this just fixes a symptom of some other root cause.
I am using Polymer to polyfill webcomponents, which has made it difficult to locate exactly what HTML was causing this to break (and difficult to post steps to reproduce). I was able to narrow it down to the
<paper-icon-button>
element, which is mostly just a wrapper around an SVG. When I isolate the SVG, the dragging works fine without my hotfix so I am stumped as to what undefined node is causing this to break. Any ideas on how I can debug this further? I am happy to open a PR once I have a better understanding of the underlying issue.The text was updated successfully, but these errors were encountered: