jed / domo Goto Github PK
View Code? Open in Web Editor NEWMarkup, style, and code in one language.
Home Page: https://jed.github.io/domo/
License: MIT License
Markup, style, and code in one language.
Home Page: https://jed.github.io/domo/
License: MIT License
This doesn't work, the style text-align "right" doesn't take:
P({style:'text-align:right'},
"maybe maybe maybe this works?")
http://jed.github.io/domo/ will redirect to http://domo-js.com/ which returns 403...
Please add AMD support.
i'd like to have HTML generation and DOM generation in the same library, to enable use on both server and client, and to allow client rendering to take place using innerHTML where faster.
but.
i am unsure how to implement it. seems to me there are two choices:
domo.dom.<nodeName>
domo.html.<nodeName>
Node.prototype.toDOM = function(document) {}
Node.prototype.toHTML = function() {}
the first is probably more efficient because there is no intermediate object generation, and easier to use because there is less API surface area and DOM objects are returned directly.
the second is probably cleaner, since no code needs to be duplicated for each approach, and creation of intermediate objects would allow more methods to be introduced if/when needed.
Creating the DOM tree with createDocumentFragment()
and later add it to the actual DOM will bypass expensive Layout operations for each DOM method (Layouting is done only once during inserting the fragment into the actual DOM). This will speed up things a lot.
Plus, sometimes I want to prepare a DOM fragment and only add it later to the DOM tree. This is only possible with the aforementioned method.
/*
Event bindings are defined as mappings of event names to simple
objects which consist of the event callback, the context to bind
'this' to for the event and perhaps additional arguments relative to
the event that should be passed to the handler.
The callback signature would be function (eventName, element, eventArgs)
Maybe a mixin could be created that utilizes one of the many event
micro libraries on microjs.com could be used to make this an
optional extension, modular and also relieve the library of having
to worry about cross browser event support.
My reasoning is that since dom-o is creating the elements, it could
easily attach events as it is creating the elements as opposed to
doing some kind of CSS selector based lookup after the fact in order
to find the element again to attach the event that way. It also
helps keep the beauty of the DSL in tact by not requiring elements
that need events attached to them to be instantiated separately and
then composed into a broader dom-o statement.
*/
FORM({action: "post_here.py", method: "POST"},
LABEL({for: "name"}, "E-mail:"),
INPUT({id: "name", name: "name", type: "text"},
EVENTS({"keyup", {context: this, validateName}})),
INPUT({type: "button"},
EVENTS({"click": {context: this, function() { if (validateForm()) submitForm();}}}))
);
Errors in IE 8, appendChild not supported for IE element DispHTMLStyleElement.
Occurs when building style elements.
STYLE.on('#MY_DIV',{zIndex:10})
Produces:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.