madrobby / zepto

Zepto.js is a minimalist JavaScript library for modern browsers, with a jQuery-compatible API
http://zeptojs.com
Other
15k stars 3.93k forks source link

Workaround for mobile safari's innerHTML bug #54

Closed tifroz closed 12 years ago

tifroz commented 13 years ago

Zepto's .html(myHtmlString) is rendered somewhat on mobile safari because of the innerHTML method (most likely a race condition that prevents the DOM from being populated correctly. As usual with race conditions the problem can be reproduced on a somewhat sporadic basis).

The bug is documented here with an example http://bit.ly/ev5BI0. The workaround suggested in the link is clunky, but I haven't seen anything else that would work. Would it make sense to incorporate it in zepto?

goatslacker commented 13 years ago

sounds like an async issue although I can't really tell from the code sample. zepto's html has always worked on mobile safari for me O_o

kossnocorp commented 12 years ago

This problem is still presented?

caffo commented 12 years ago

Still happening.

tifroz commented 12 years ago

It was happening for me when using PhoneGap (pre-0.9.6, it's not happening anymore in PhoneGap versions 0.9.6+, courtesy of this bug fix: https://github.com/phonegap/phonegap-iphone/issues/82).

I think the bug has nothing to do with the webview / mobile safari and it shouldn't be Zepto's concern

madrobby commented 12 years ago

I feel that this is outside the scope of Zepto. When it happens, there are some ways to force redrawing, for example adding an empty text node to your element.