I have a curiosity question,
Imagine I want to apply a function (myplugin()) to a jquery object if this has a particular className. Imagine that NO jquery object has 'myclass' associated and myplugin() NOT exist.
so
$this.filter('.myclass').length == 0
and
$this.is('.myclass') == false

1. most common possibility: throws an error (myplugin doesn't exist: It tries to bind an inexistent function to ZERO)
$this.filter('.myclass').myplugin()

2. alternative possibility: no error (does nothing)
$this.is('.myclass') && $this.myplugin()

Now imagine that myplugin() EXISTS (and you have lot of lines of this kind: different filters and methods) My question: which possibility (1 or 2) is the best in the meaning of time speed and overheads?

thanxs

--
Enrique Meléndez Estrada (976 01 0083)
Dpto. Servicios Informáticos
Área Organización y Servicios Internos
INSTITUTO TECNOLÓGICO DE ARAGÓN
c/ María de Luna 8, 50018, Zaragoza (Spain)
emelen...@ita.es - http://www.ita.es

begin:vcard
fn;quoted-printable:Enrique Mel=C3=A9ndez Estrada
n;quoted-printable:Mel=C3=A9ndez Estrada;Enrique
org;quoted-printable;quoted-printable:Instituto Tecnol=C3=B3gico Arag=C3=B3n;Servicios Inform=C3=A1ticos
adr;quoted-printable;quoted-printable:;;c/ Mar=C3=ADa de Luna, 8;Zaragoza;Zaragoza;50018;Espa=C3=B1a
email;internet:emelen...@ita.es
tel;work:976 01 0083
x-mozilla-html:TRUE
url:http://www.ita.es
version:2.1
end:vcard

Reply via email to