Leandro Vieira Pinho wrote:
Hummmm, I don´t think it´s a good suggestion.

Imagine: I use the filter to avoid submit/reset/button buttons, for
example, so if I did it:

$('input').resetDefaultValue().height(30);

All the input elements affected by plugin will have 30 pixels of
height. If I use the .end() function, the submit/reset/buttons will
have 30 pixels of height too, so, but these kind of input elements isn
´s affected by plugin.

Do you agree?

No. I would expect every matched element to get the height. For someone, who is simply using your plugin and does not know how it works it would be totally inobvious why some elements are missing and he would simply assume it's a bug somewhere in jQuery.

It's just not transparent what is going on to anyone else than you or one who studied the plugin code carefully (which you cannot expect as a plugin author).

If I write

$('input').height(30);

or

$('input').resetDefaultValue().height(30);

or

$('input').height(30).resetDefaultValue();

I do expect all matched inputs having the height of 30!

Otherwies you'd need to call the plugin resetDefaultValueWithFilter or something.

It should be up to the user to do the filtering in the selector anyway - the intention what the code should do is much more obvious to others reading the code. The filter in the plugin should simply serve as a little safety mechanism if at all required.

The example you've given should be written as this anyway:

$('[EMAIL PROTECTED]"text"]').resetDefaultValue().height(30);



--Klaus

Reply via email to