I want to write a function
function f (domEl){
//some code here
//returns a string
}
such that:
$(f(domEl))[0] == domEl
should always return true (of course, regardless at what hierarchy domEl is):
As an example, Let's say:
HTML
body
ul
li
**li**
li
ul
li
and, I want to select bold li element. I get that element and pass that into my function f.
domElof typeHtmlElementi.e. that would be returned fromdocument.getElementById()?$("<any_selector>")returns a specialjqueryobject and standard javascript returns "standard"htmlXXElementtypes. If you pass aDOMElementinto$()it converts it into a JQuery object. Asking for$(domEl) == f(domEl)makes more sense, unless they want you to change the JQuery source.$meansjQueryin this code?