Created
February 6, 2011 18:55
-
-
Save ericf/813606 to your computer and use it in GitHub Desktop.
New Y.Markout API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My intention would be that it would always be an append() under the hood. The Markout API is basically append-only