Ticket #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: | ||
| Blocking: | Blocked by: |
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
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
