// adds the .data function to nodes inorder
// to parse JSON from html5 data- attributes
YUI.add("node-data", function (Y) {
	
  Y.Node.addMethod("data", function (node, attr, d) {

    if (typeof attr === 'undefined') { 
      throw new Error("Please supply the HTML5 data attribute you wish to fetch"); 
    }

    if (d) {
      node.setAttribute("data-" + attr, d);

    }
    else {
      return node.getAttribute('data-' + attr);
    }
  });

}, "1.0.0", {requires: ["node", "json"]});

