Safari 5.1 broke HTML native drag and drop?

前端 未结 4 467
傲寒
傲寒 2021-02-02 13:49

Last night, I thought I\'d do a quick project to demonstrate HTML5 capabilities and to try some things out. However, I can\'t seem to figure out how to get drag and drop to work

4条回答
  •  轮回少年
    2021-02-02 14:18

    Just to clarify: Visited your site and found no errors. Opened the console, no error, and everything appeared to function as designed. Tried all provided examples with no error.

    All examples work fine Safari Version 5.1 (7534.48.3). Sorry, mate – Maybe it's a setting you've changed?

    Allow me to suggest a possibility:

    Go to Safari->Empty Cache... Then Safari->Reset Safari... Try reloading the page.

    Likely, there's something cached that's creating a conflict. There seems to be nothing wrong with your script in the slightest.

    Edit

    Some things to check...

    Are any of your function names containing reserved words? I've done this, had it not throw any errors, but it simply wouldn't work.

    I've had some weird issues with Safari not running methods written as funcName = function(){}. If you can pin down the method that isn't firing (I add a little function when I'm developing called DBG which I'll add below – basically, if a debug flag is set, you log to the console), you can try rewriting the function.

    // Some sort of boolean flag.
    var debug = true;
    
    // This is kind of an obvious function, but can be expanded as you like.
    // Little tricks to make life easier.
    function DBG(str) {
      debug ? console.log(str) : return;
    }
    

    I still think ultimately this boils down to something caching wrong, but it's worth a try.

提交回复
热议问题