Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
plugin options that take an element as a value
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Scott González  
View profile  
 More options Nov 12 2009, 9:46 pm
From: Scott González <scott.gonza...@gmail.com>
Date: Thu, 12 Nov 2009 21:46:59 -0500
Local: Thurs, Nov 12 2009 9:46 pm
Subject: plugin options that take an element as a value

We've got a lot of plugins that take an element as a option's value
(position's of, draggable's helper, etc.). Each of these work slightly
differently because there are so many cases to handle that some of them get
overlooked. I wrote a function a long time ago to handle this, but never
ended up using it anywhere. Here are the cases I came up with back then as
possible options:

Note: In many cases there is a context for determining the element. For
example, draggable's helper has a context of the actual draggable element.

jQuery object - just return the object again
DOMElement - wrap it in a jQuery object
array of DOMElements - wrap them in a jQuery object
selector - return the jQuery object that matches the selection
the string "parent" - return the parent of the context element
the string "clone" - return a clone of the context element
function - return the result of executing the function and passing the
context element as a parameter
anything else - return an empty jQuery object

I'd like to go through and test this on all of our plugins, but I wanted to
see if anything had any other cases that we should be handling.

Here's the code: http://gist.github.com/233531


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul Bakaus  
View profile  
 More options Nov 13 2009, 2:22 am
From: Paul Bakaus <paul.bak...@googlemail.com>
Date: Fri, 13 Nov 2009 08:22:50 +0100
Local: Fri, Nov 13 2009 2:22 am
Subject: Re: [jquery-ui-dev] plugin options that take an element as a value

Good idea, code looks nifty as well :)

Yeah, let's get this into the widget factory or core, it's tiny and
important enough to justify.

2009/11/13 Scott González <scott.gonza...@gmail.com>

--
Paul Bakaus
UI Architect @ smart.fm
--
http://paulbakaus.com
http://www.linkedin.com/in/paulbakaus

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jörn Zaefferer  
View profile  
 More options Nov 13 2009, 2:52 am
From: Jörn Zaefferer <joern.zaeffe...@googlemail.com>
Date: Fri, 13 Nov 2009 08:52:12 +0100
Local: Fri, Nov 13 2009 2:52 am
Subject: Re: [jquery-ui-dev] plugin options that take an element as a value

Would this work?

.positionTo({
 my: ...,
 at: ..,
 of: "parent"

})

Jörn

2009/11/13 Scott González <scott.gonza...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard D. Worth  
View profile  
 More options Nov 13 2009, 7:44 am
From: "Richard D. Worth" <rdwo...@gmail.com>
Date: Fri, 13 Nov 2009 07:44:07 -0500
Local: Fri, Nov 13 2009 7:44 am
Subject: Re: [jquery-ui-dev] plugin options that take an element as a value

the string "self" - return the context element ? Or maybe "this" ?

- Richard

2009/11/12 Scott González <scott.gonza...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Scott González  
View profile  
 More options Nov 13 2009, 8:05 am
From: Scott González <scott.gonza...@gmail.com>
Date: Fri, 13 Nov 2009 08:05:08 -0500
Local: Fri, Nov 13 2009 8:05 am
Subject: Re: [jquery-ui-dev] Re: plugin options that take an element as a value

On Fri, Nov 13, 2009 at 2:52 AM, Jörn Zaefferer <

joern.zaeffe...@googlemail.com> wrote:
> Would this work?

> .positionTo({
>  my: ...,
>  at: ..,
>  of: "parent"
> })

I don't see why not. It currently doesn't, but that's the point of this
thread :-)

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Scott González  
View profile  
 More options Nov 13 2009, 8:09 am
From: Scott González <scott.gonza...@gmail.com>
Date: Fri, 13 Nov 2009 08:09:20 -0500
Local: Fri, Nov 13 2009 8:09 am
Subject: Re: [jquery-ui-dev] Re: plugin options that take an element as a value

On Fri, Nov 13, 2009 at 7:44 AM, Richard D. Worth <rdwo...@gmail.com> wrote:

> the string "self" - return the context element ? Or maybe "this" ?

I think everywhere that we would currently do this we just use null for the
option, e.g., draggable's helper. I'm not sure if that means we should
return the context element as a fallback instead of an empty jQuery object
or if we should add "self" as an option and make that the default for
draggable's helper option. A third option would be to have the plugin check
if a value even exists:

var helper = options.helper ? element(options.helper) : this.element;

I'd prefer not having to do that check, so I think one of the first two
options is better.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jörn Zaefferer  
View profile  
 More options Nov 13 2009, 8:15 am
From: Jörn Zaefferer <joern.zaeffe...@googlemail.com>
Date: Fri, 13 Nov 2009 14:15:13 +0100
Local: Fri, Nov 13 2009 8:15 am
Subject: Re: [jquery-ui-dev] Re: plugin options that take an element as a value

Ok, one more: Where would you put that method and how to you call it? On the
widget prototype? A static method in the $.ui namespace?

Jörn

2009/11/13 Scott González <scott.gonza...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Scott González  
View profile  
 More options Nov 13 2009, 8:31 am
From: Scott González <scott.gonza...@gmail.com>
Date: Fri, 13 Nov 2009 08:31:03 -0500
Local: Fri, Nov 13 2009 8:31 am
Subject: Re: [jquery-ui-dev] Re: plugin options that take an element as a value

On Fri, Nov 13, 2009 at 8:15 AM, Jörn Zaefferer <

joern.zaeffe...@googlemail.com> wrote:
> Ok, one more: Where would you put that method and how to you call it? On
> the widget prototype? A static method in the $.ui namespace?

I'd want to put it in the $.ui namespace because it is useful outside of
widgets. I'm not sure what to name it though.

Usage: var helper = $.ui.element(this.options.helper, this.element);


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »