Skip to main content

Bug Tracker

Side navigation

#10617 closed bug (worksforme)

Opened October 29, 2011 04:41PM UTC

Closed January 08, 2012 05:37AM UTC

Last modified January 08, 2012 04:23PM UTC

Type coersion wrongly placed

Reported by: anonymous Owned by: rwaldron
Priority: low Milestone: 1.next
Component: css Version: 1.7b2
Keywords: Cc:
Blocked by: Blocking:
Description

Please take a look at this line of code:

value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );

specifically

+( ret[1] + 1)

Type coercion is done *outside* the brackets. But this doesn't make sense because if ret[1] is not a number then ret[1] + 1 does the wrong thing. If ret[1] is a number then the type coercion does nothing.

Attachments (0)
Change History (3)

Changed October 29, 2011 05:32PM UTC by rwaldron comment:1

component: unfiledcss
milestone: None1.next
owner: → rwaldron
priority: undecidedlow
status: newassigned

Good catch. Patch to follow

Changed January 08, 2012 05:37AM UTC by mikesherov comment:2

resolution: → worksforme
status: assignedclosed

No, this is the correct behavior!

+( ret[1] + 1)

in this case, ret[1] is the string "+" or "-", to which 1 is added as string. This makes the resulting string "+1" or "-1", which should then be coerced to -1 or 1 as an integer, to be multiplied by the RHS of the equals. Nothing to fix here.

Changed January 08, 2012 04:23PM UTC by rwaldron comment:3

@mikesherov nice, I forgot to close this after reviewig the code. Thanks!