Coder Social home page Coder Social logo

Comments (4)

jaz303 avatar jaz303 commented on June 12, 2024

Yep this should be fixed. What's the expected behaviour when there has been no tipsification? Return null? Throw a catchable error? My gut reaction is the latter but that doesn't seem very idiomatic JS. Keen to hear your thoughts.

-J

from tipsy.

TrevorBurnham avatar TrevorBurnham commented on June 12, 2024

I'd much prefer a null return to an exception.

Having said that, it wasn't until I peeked at the source code that I realized that the tipsy() function doesn't simply return this, like a typical jQuery function (or rather, it doesn't when an option string is given). What's the reason for this? The examples in the docs never use the return value.

If there isn't a reason, then I think the ideal behavior would be for $obj.tipsy('hide') to always return $obj. That's what jQuery users expect, right? For instance, $obj.hide() will always return $obj even if $obj is already hidden.

from tipsy.

jaz303 avatar jaz303 commented on June 12, 2024

This was a deliberate decision, the reasoning was that since the option string form of tipsy() is basically a dumb proxy to the Tipsy object, that it would be unwise to assume (either now or in the future) the proxied method's return value to be insignificant.

However I can see the argument for chainability. If one needs the return value I guess there's nothing to stop them doing var tipsy = $foo.tipsy(true), retVal = tipsy.blahBlah();.

So, agreed, I'll change it to return the jQuery object.

from tipsy.

jaz303 avatar jaz303 commented on June 12, 2024

tipsy object proxy method tolerates null object and now returns this. closed by 23994f5

from tipsy.

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.