xuijs / xui

A tiny javascript framework for mobile web apps.
http://xuijs.com
788 stars 106 forks source link

Bug in xhr (fix included, I think) #17

Closed AlexNolasco closed 13 years ago

AlexNolasco commented 13 years ago

https://github.com/xui/xui/blob/master/src/js/xhr.js line 114

req.handleResp = (o.callback != null) ? o.callback : function() { that.html(location, this.responseText); };   

Should it be this instead?

    req.handleResp = (o.callback != null) ? o.callback : function() { 
        that.html(location, req.responseText); // using this.responseText results in undefined (webkit)
    };
filmaj commented 13 years ago

Hmm, in Chrome 8 and Safari 5.0.3 I don't see this issue. "this" inside the makeshift callback always refers to the XHR.

Regardless I will patch it with your suggestion as a) it passes the tests and b) actually reduces the minified code by 3 bytes!

Still curious though, what browser are you seeing this in?

filmaj commented 13 years ago

Committed btw: 9da343a225c86595eefaaa6d25a44498ef21ab85

AlexNolasco commented 13 years ago

filmaj,

I noticed this issue in Safari 5.0.3 and iPhone 3.1.2