FamousArchives / examples

[DEPRECATED]
214 stars 74 forks source link

SUPER WEIRD BUG! (Draggable example) #11

Closed dmvaldman closed 10 years ago

dmvaldman commented 10 years ago

Are you ready?!

function GenericSync(options) {
        if (arguments.length === 2){
            this._legacyPositionGetter = arguments[0];
            options = arguments[1];
        }
        else this._legacyPositionGetter = null;
         ...

When GenericSync is called with 2 arguments, as in Draggable.js, at the end of this code, options has the value arguments[0], and arguments = [arguments[1], arguments[1]]

@michaelobriena @ftripier @fettermania

DrClick commented 10 years ago

Its nothing to do with generic sync, but options is not the object, its a reference to arguments[0] so the result of arguments is as expected. Are you sure on the final value of options? I cannot reproduce that.

function test(options){
  console.log("options", options);

  if(arguments.length == 2){
    options = arguments[1];
    console.log("arguments", arguments);console.log("options", options);
  }
}

console.log("test with hello")
test({"Hello": "World"});

console.log("test with hello and foo")
test({"Hello": "World"}, {"Foo": "Bar"});
michaelobriena commented 10 years ago

Is this still an issue? Draggble seems to be working with the newest code.

dmvaldman commented 10 years ago

This has been fixed. Closing.