Methods in jQuery JavaScript Profile always return jQuery

Bug Reports and Fixes
Post Reply
sergey_che
Posts: 14
Joined: Tue Mar 11, 2008 10:04 am

Methods in jQuery JavaScript Profile always return jQuery

Post by sergey_che » Tue May 27, 2008 11:20 am

Spket completely ignores JSDoc @return properties in files added in jQuery JavaScript Profile, causing all methods to return jQuery objects, which is incorrect behavior, because jQuery has number of methods that returns different result types (string, boolean, array etc.). For example, offset() method return Object, get() returns Element and so on. Here is a test case:

1. Create simple file and add it to default JavaScript Profile:

Code: Select all

/**
 * @return {Object}
 */
jQuery.prototype.offset = function(){ return {top: 0, left: 0};};
2. Write this in editor:

Code: Select all

$('div').offset(). //code assist shows that offset() return jQuery
Or maybe I do something wrong?

eric_suen
Site Admin
Posts: 678
Joined: Wed Sep 28, 2005 7:00 am
Contact:

Post by eric_suen » Wed May 28, 2008 2:42 am

Currently the jQuery support is not very good, and if you and file to the profile, it will ignore the function body, so the code "return {top: 0, left: 0}" will be ignored by profile...

If you add the code to the file you edited, the code assist will work(please remove the JSDoc, @return {Object} will cause code assist ignore the function body)

Code: Select all

jQuery.prototype.offset = function(){ return {top: 0, left: 0};};

sergey_che
Posts: 14
Joined: Tue Mar 11, 2008 10:04 am

Post by sergey_che » Wed May 28, 2008 8:18 am

Maybe there is a way to add file into JavaScript profile without specifying library type? I made complete documentation js-file for jQuery (I can share it, but I can't post links here until I get 10 posts) and I would like to use it in js editor by default.

eric_suen
Site Admin
Posts: 678
Joined: Wed Sep 28, 2005 7:00 am
Contact:

Post by eric_suen » Wed May 28, 2008 9:08 am

Currently the solution is using include tags, take a look at this thread: viewtopic.php?t=365

I will try to fix this issue in next version.

tiffanly
Posts: 1
Joined: Mon Aug 03, 2009 4:47 pm

Post by tiffanly » Wed Aug 05, 2009 11:29 am

How do you get JavaScript to be turned on? If you already have Javascript downloaded and its turned off then how do you get it turned on again?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest