Modify ↓
Ticket #10604 (closed enhancement: wontfix)
$(...).html(object) should use its custom toString() method.
| Reported by: | jdalton | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | manipulation | Version: | 1.7b2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I was messing around with $(...).html(....) and was surprised that it didn't use my object's custom toString() method.
You can see an example here: http://jsbin.com/uqazuk
Change History
comment:2 Changed 20 months ago by timmywil
- Priority changed from undecided to low
- Resolution set to wontfix
- Status changed from new to closed
- Component changed from unfiled to manipulation
- Type changed from bug to enhancement
This is feature creep. It is far too simple to pass a string or function.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

According to the jquery docs, the html method only expects a string or a function:
http://api.jquery.com/html/
I don't know if the interface should be changed, but here is a patch that will do it:
https://github.com/chriswu000/jquery/commit/66920cfeb2c488eb377b1ce4e1246dcd44c5359f