Skip to content

Instantly share code, notes, and snippets.

@tommedema
Created December 9, 2010 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommedema/735180 to your computer and use it in GitHub Desktop.
Save tommedema/735180 to your computer and use it in GitHub Desktop.
var attributes = [];
if (node.attributes) {
for (var i = 0, iMax = node.attributes.length; i < iMax; i++) {
//set name
var name = node.attributes[i].name;
//validate name
if (typeof(name) != "string") throw "newTreeNode attr name is not a string.";
//exclude style
if (name == "style") continue;
//value
var value = node.attributes[i].value;
//add
attributes.push(new DOM.Tree.NodeAttribute({name: name, value: value}));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment