Skip to main content

Bug Tracker

Side navigation

#10053 closed bug (fixed)

Opened August 14, 2011 09:52PM UTC

Closed August 16, 2011 02:58PM UTC

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.

Attachments (0)
Change History (2)

Changed August 15, 2011 04:42PM UTC by kswedberg comment:1

owner: → kswedberg
status: newassigned

Changed August 16, 2011 02:58PM UTC by kswedberg comment:2

resolution: → fixed
status: assignedclosed

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