Skip to content

Error with .animate() on plain object #1776

@mgol

Description

@mgol

Originally reported by dmethvin at: http://bugs.jquery.com/ticket/15169

 https://github.com/jquery/api.jquery.com/issues/514

=====

Not sure if $.animate intend to support generic object. The code below raise exception "Uncaught TypeError: Cannot use 'in' operator to search for 'opacity' in undefined"

var s = { opacity: 1 };
$(s).animate({opacity: 0}, 5000);

But it try to use $.css to set the opacity. So if I just change to other name

var s = { opacity2: 1 };
$(s).animate({opacity2: 0}, 5000);

and it works.

I guess it might be resolvable If jquery can detect if it's the html object or not. But not sure if $.animate intend to only support html object.

Issue reported for jQuery 1.11.1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions