madrobby/zepto — pull request #448 by romanrudenko (2012-03-20 22:06:40+00:00)
Title: First try at IE9 compatibility layer for Zepto

Hello,

This is my first take at adding some IE9+ compatibility to Zepto. I have taken an approach of exposing functions to override in main zepto code, and moving out all IE-specific functions into a standalone file. This way, Zepto team could adopt just the hooks and IE ugliness can stay outside.

Notable stuff:

* Instead of copying zepto methods onto an array, I start with object whose prototype is pointing to $.fn. This makes array manipulation a bit trickier, as concat has to be overridden (and splice eventually will have to be as well), but makes sure that Zepto methods remain consistent across objects even if $.fn is extended.

* Some JQuery markup wrapping code is ported into IE shim to allow construction of table elements with innerHTML. Am I exposing fragment the right way?

* Old $() contents are moved into $.fn.init, a la jQuery. This is done to allow easy overriding in future (which would be hard when all behavior is baked in the function).

* TODO: old Z had dom = dom || emptyArray; . I think that is wrong, since we want different $() objects to be independent even if they are created with nothing inside. They way they are created now, they will be linked. Would it make sense to change this to || [] in Zepto core? Note that some tests seem to rely on this strange object sharing behavior.