Code Monkey home page Code Monkey logo

Comments (3)

GalinKrastev avatar GalinKrastev commented on June 17, 2024

For some reason after the code is minified in the return clause there is a missing condition. Before minification the code is

return action && 
    action.indexOf("http") === 0 && 
    action.indexOf(location.hostname)<0;

and after minification the code is:

var e=t.getAttribute("action");return 0===e.indexOf("http")&&e.indexOf(location.hostname)<0

That's why maybe it's a good idea to put the missing condition in assigning the value, e.g.

var action = form.getAttribute("action") || "";

from autotrack.

philipwalton avatar philipwalton commented on June 17, 2024

Something must be wrong with your setup because this case is definitely already being considered and tested.

Here is the relevant text fixture, and here's the test. Note that the autotrack tests run in all browsers, so the IE and FF cases are covered.

By the way, the minified code you're showing above is not correct. I've copied this straight out of the autotrack.js version 0.6.4 file and it's different from what you've pasted above:

n.prototype.shouldTrackOutboundForm=function(t){var e=t.getAttribute("action");return e&&0===e.indexOf("http")&&e.indexOf(location.hostname)<0}

Is it possible the minified code you're looking at is from an older version?

from autotrack.

GalinKrastev avatar GalinKrastev commented on June 17, 2024

sorry about that, you're right, my version is /*! autotrack.js v0.5.0 */ ... I've added it recently just I'm not sure how I got an old version.
BR
Galin

from autotrack.

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.