I've simplified the HTML() bookmarklet library
's invocation significantly. True to its name, the HTML() function can now be called (implicitly on window), with a string parameter that specifies what tags/attributes/containers to implement. These are identified by mixed/lower/uppercase respectively. I used to impose my huge list of 108 tag/attrs. But now you provide only what you need! By itself (without comments or volumes of tag/attrs), it weighs in at only 0.81K
Per Algorithm's suggestion, the factory functions (formerly called "template" functions) return lowercased tag names and attributes with the trailing space-slash inside of tags (formerly called "elemental" tags -- namely, those without any end tag). Attributes are still returned with a leading space, for easy concatenation and subsequent inclusion as the attributes
parameter to the tag/container functions. These changes should not affect any existing html constructs that folks have already built with the old returns-everything-capitalized library.
One interesting optimization I made to both the HTML() bookmarklet library
of html for each calendar!).
See you at the5k.org contest next year!
Originally posted by Algorithm
After looking over your code, I found a number of things that could be improved upon, so I tinkered with it. Hope you don't mind!
I removed the global templates (improving interoperability), updated the syntax to meet XHTML standards, removed that annoying 'empty string' bug, and squeezed the filesize down to 1.4KB.
This is a great concept, and I can definitely see myself using this in the future. Thanks!