Giter VIP home page Giter VIP logo

Comments (8)

terjeto avatar terjeto commented on June 27, 2024

I removed the entire dajaxice.core.js file and produced my own using just a few lines of code which is based on jquery.
I suggest this to be a much more stable and lightweight way...

from django-dajaxice.

nanonyme avatar nanonyme commented on June 27, 2024

How are you getting this xhr object in dajaxice? call doesn't return its XMLHTTPRequest at any rate.

from django-dajaxice.

terjeto avatar terjeto commented on June 27, 2024

I'm not retreiving the XHR object "from" dajaxice. I'm using javascript to access the native browser XHR. (javascript: new XMLHttpRequest)

I beleive dajaxice prototypes the native XHR object, and in this process some of the features of the native XHR object gets lost.
If you have firefox/chrome, open a webpage that uses dajaxice and paste into the browser console:

new XMLHttpRequest().upload ? true :false

You will see that this will result in FALSE which is not correct in a modern browser. (try the same code in a console on this page and you will get TRUE).

Sorry if my explanations are hard to read :-) I can make some screenies if its still unclear.

from django-dajaxice.

nanonyme avatar nanonyme commented on June 27, 2024

It seems to me that this is mainly not dajaxice's problem (though it's using an old version of XMLHttpRequest.js which is not good) but https://github.com/ilinsky/xmlhttprequest which doesn't seem to set upload at all. It seems to me the main thing is that dajaxice replaces your browser's XMLHttpRequest with a cross-browser-compatible alternative.

from django-dajaxice.

nanonyme avatar nanonyme commented on June 27, 2024

FWIW if you want to check this, try new XMLHttpRequest()._object.upload ? true :false. It should handle with the underlying browser-specific XMLHttpRequest object. Not a production-quality solution, just a note.
I think a better workaround is to make sure DAJAXICE_XMLHTTPREQUEST_JS_IMPORT is false when generating dajaxice.core.js. This will prevent XMLHttpRequest from being replaced.

from django-dajaxice.

terjeto avatar terjeto commented on June 27, 2024

quote: "It seems to me the main thing is that dajaxice replaces your browser's XMLHttpRequest with a cross-browser-compatible alternative."

Yepp that is it. However I think that a proprietary crossbrowser XHR object is no longer needed as badly as before and could be skipped. As was what I did. Removed the entire dajaxice.js file and replaced with a few lines of jquery.

Why not make dajaxice (js) dependent on JQuery and use JQuery ajax and also JQuery's JSON parser. (I've had several issues with the json parser aswell). Just a thought.. :-)

from django-dajaxice.

nanonyme avatar nanonyme commented on June 27, 2024

Well, FWIW I'm not the maintainer... Also that is not a proprietary XHR object. It is LGPL. Using jQuery would most likely be completely overkill for this kind of simple stuff. As said, if you know you're dealing with modern browsers, just disable that variable I mentioned before. Not using the compat XHR might make dajaxice less compatible with old browsers. (I wasn't able to find references to how widely XMLHttpRequestUpload is supported)

from django-dajaxice.

jorgebastida avatar jorgebastida commented on June 27, 2024

You can disable the import using DAJAXICE_XMLHTTPREQUEST_JS_IMPORT = False.

from django-dajaxice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.