[jQuery] non-html elements

[jQuery] non-html elements


Hi,
Are you supposed to be able to use jquery to search for non-html
elements? I've got a web-app that is sending out xrefs which are
recursively expanded by jquery using the following function.
function expand_refs (context) {
$("xref",context||document).each(function (i) {
var rpl = cache[$(this).attr("ref")]||0;
if(rpl){
var cntxt = $(rpl).insertAfter(this);
$(this).remove();
expand_refs(cntxt);
}
});
}
This seems to work ok for some cases but I'm having trouble with a
select list. The options inside are not being expanded. The
following page illustrates the behaviour. openair.js just calls
expand_refs on document ready.
When expand_refs gets around to expanding "MYSELECT", it can't find
any xrefs and so stops expanding that sub-tree and moves on to the
next one. Am I doing something wrong?
Cheers,
Andy
<html>
<head>
<title>
</title>
<script type='text/javascript'>cache = { D2899 : "<div
id='D2899'><xref ref='D2900'></xref><xref ref='D2901'></xref><xref
ref='D2902'></xref></div>" ,
D2900 : "<div id='D2900'><span id='S2903'>one</span></div>" ,
D2901 : "<div id='D2901'><span id='S2904'>two</span><xref
ref='MYSELECT'></xref></div>" ,
MYSELECT : "<select id='MYSELECT'><xref ref='O2906'></xref></
select>" ,
O2906 : "<option id='O2906'><span id='S2907'>one</span></option>" ,
D2902 : "<div id='D2902'><span id='S2908'>three</span></div>" };
</script>
<script type='text/javascript' src='/js/jquery.js'></script>
<script type='text/javascript' src='/js/openair.js'></script>
<style type='text/css'></style>
</head>
<body>
<div id='banner'>
<h1>
</h1>
</div>
<div id='content'>
<div id='D2899'>
<xref ref='D2900'></xref>
<xref ref='D2901'></xref>
<xref ref='D2902'></xref>
</div>
</div>
</body>
</html>