Skip to content

Instantly share code, notes, and snippets.

@ericf
Created February 6, 2011 18:55
Show Gist options
  • Save ericf/813606 to your computer and use it in GitHub Desktop.
Save ericf/813606 to your computer and use it in GitHub Desktop.
New Y.Markout API
// the main difference between the new and current is convenience around writing text in node.
// also a new .node() method which return the Y.Node instance (.getNode() still exits).
// appends <h2>The New <a href="http://oddnut.com/markout/">Markout API</a></h2> to #foo
Y.Markout('#foo').h2('The New ').a({ href: 'http://oddnut.com/markout/' }, 'Markout API');
// appends <div></div> to #foo references the Y.Node instance through the .node method.
Y.Markout().div().node().appendTo('#foo');
// BUT, I was also thinking I would make Markout extend further into the library.
// I thought about extending Y.Node, to add the Y.Markout element methods to the node Prototype.
// So if you .use('gallery-markout') you'd get enhanced Y.Node instances.
Y.one('#foo').h2('Extended Y.Node with ').a({ href: 'http://oddnut.com/markout/ ' }, 'Markout API');
Y.one('body').h1('Heading ').hide().addClass('foo').span('Bla').get('parentNode').show();
@ericf
Copy link
Author

ericf commented Mar 2, 2011

My intention would be that it would always be an append() under the hood. The Markout API is basically append-only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment