Skip to main content

Bug Tracker

Side navigation

#11277 closed bug (invalid)

Opened February 03, 2012 06:26PM UTC

Closed February 03, 2012 06:29PM UTC

Last modified April 11, 2014 12:06AM UTC

.attr(undefined)

Reported by: anonymous Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

Calling .attr() with undefined throws an error on line 2474 Uncaught TypeError: Cannot call method 'toLowerCase' of undefined but should just return undefined.

Attachments (0)
Change History (2)

Changed February 03, 2012 06:29PM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed
should just return undefined.

Says who? When called with one arg it should be the attribute name as a string, and undefined is not a string. We threw an error so you could find the bug! You're welcome.

http://api.jquery.com/attr/

Changed April 11, 2014 12:06AM UTC by anonymous comment:2

I've got to say, this really isn't helpful. Couldn't jQuery do something like:

if (!arguments.length) {

throw new Error('attr requires at least one argument');

}

That would be MUCH more helpful than the current nebulous error.