Zepto does not handle multiple self-closing tags the same as jQuery #322

pamelafox opened this Issue Nov 19, 2011 · 1 comment


None yet

3 participants


The jQuery tools dateinput plugin uses this line to create some DOM:

root = $('<div><div><a/><div/><a/></div><div><div/><div/></div></div>').hide().css({position: 'absolute'}).attr("id", css.root);

The DOM produced by Zepto is not the same as the DOM produced by jQuery. To workaround it, I created start and end tags for each of the self-closing tags in the string, and it came out correctly.

You can compare the DOM produced here:

Zepto seems generally to be able to handle self closing tag syntax, but perhaps not when it's mixed in a long string like that.

madrobby commented Apr 5, 2012

Webkit parses this HTML as:


This is the way HTML5 is supposed to be parsed.

In HTML 5, <foo /> means <foo>. The slash is just syntactic sugar for people who are addicted to XML. The syntax is valid, but it is not a "self-closing tag". The distinction is important since (in the HTML syntax at least) <div /> means <div> in HTML 5 and not <div></div> as it does in XHTML. (from http://stackoverflow.com/questions/3558119/are-self-closing-tags-valid-in-html5)

@madrobby madrobby closed this Apr 5, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment