Bug Tracker

Modify

Ticket #10466 (closed bug: fixed)

Opened 3 years ago

Last modified 2 years ago

jQuery.param() mistakes wrapped primitives for deep objects

Reported by: jon.rimmer@… Owned by: rwaldron
Priority: low Milestone: 1.7.2
Component: core Version: 1.6.4
Keywords: Cc:
Blocking: Blocked by:

Description

The output of the two following statements illustrates the problem:

$.param({ 'test': 5 }); // "test=5"
$.param({ 'test': new Number(5) }); // ""

The problem is the that the function buildParams uses the test typeof obj === 'object' to test whether a value is a deep object or not. However, if the value is a wrapped number or boolean,  then they will return 'object' as well, as this will result in the field not being included in the resulting parameter string.

Change History

comment:1 Changed 3 years ago by rwaldron

  • Owner set to rwaldron
  • Priority changed from undecided to low
  • Status changed from new to assigned
  • Component changed from unfiled to core
  • Milestone changed from None to 1.next

comment:3 Changed 2 years ago by Rick Waldron

  • Status changed from assigned to closed
  • Resolution set to fixed

Fix #10466. jQuery.param() should treat object-wrapped primitives as primitives.

Changeset: 166b9d252a025009413eee1584dc364996dcb1c2

comment:4 Changed 2 years ago by dmethvin

  • Milestone changed from 1.next to 1.7.2

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.