Bug Tracker

Opened 8 years ago

Closed 8 years ago

#10053 closed bug (fixed)

Documentation bug: List all supported return values of function arg for DOM manipulation elements

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

Description

Methods such as before() that accept a function argument whose return value becomes the element inserted into the DOM, typically list an HTML string as the only appropriate return value, while in practice, a DOM element, or jQuery object works as well. (Perhaps also an Array of DOM elements, though I haven't tested this.)

If it is the intention of the function argument's return value to support the same values as are supported when calling these methods without the function argument, please update the documentation of such methods to make if officially supported.


example: http://api.jquery.com/before

.before( content, [content] )

content HTML string, DOM element, or jQuery object to insert before each element in the set of matched elements.

content One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements.

before( function )

function A function that returns an HTML string to insert before each element in the set of matched elements.


As you can see, the only return value allowed is HTML string. If it is not intended to allow the same values as the traditional version of the methods, then perhaps add a specific note in the docs to that effect.

Change History (2)

comment:1 Changed 8 years ago by kswedberg

Owner: set to kswedberg
Status: newassigned

comment:2 Changed 8 years ago by kswedberg

Resolution: fixed
Status: assignedclosed

Thanks for the ticket. I've updated the documentation. Let me know if there is anything I've missed.

Note: See TracTickets for help on using tickets.