Skip to content

Instantly share code, notes, and snippets.

@ericf
Created January 21, 2011 20:07
Show Gist options
  • Select an option

  • Save ericf/790310 to your computer and use it in GitHub Desktop.

Select an option

Save ericf/790310 to your computer and use it in GitHub Desktop.
var caseResource = new Y.Resource({
uri : this.get(CASE_INFO_PATH),
headers : { Accept: 'application/xhtml+xml' },
entityTranslators : { XML: {
contentType : 'application/xhtml+xml',
deserialize : function(r){
var doc = r.responseXML.documentElement,
title = Y.DOM.getText(Y.Selector.query('title', doc, true)),
steps = Y.Selector.query('div', doc),
i, len;
// clone step nodes because they came from a different doc
for (i = 0, len = steps.length; i < len; i++) {
steps[i] = steps[i].cloneNode(true);
}
return { title: title, steps: Y.all(steps) };
}
}},
on : {
success : Y.bind(function(e){
this.set(TITLE, e.entity.title);
this.set(INFO_NODES, e.entity.steps);
}, this)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment