You have to loop on your element attributes :
$('span[data-type="yesno"]').replaceWith(function(){
$li = $("<li>", {html: $(this).html()});
$.each(this.attributes, function(i, attribute){
$li.attr(attribute.name, attribute.value);
});
return $li;
})