JS standards were not followed entierely.

Always use .on and .trigger, never the event aliases. Always use typeof for undefined checks.

CommentFileSizeAuthor
core-js-1963340-234.patch1.88 KBnod_

Comments

amateescu’s picture

Status: Needs review » Reviewed & tested by the community

I have to admit I haven't looked for a documentation page on d.o that describes our JS standards when I wrote that patch. Thanks for the follow-up, good to know in the future :)

yched’s picture

@nod_: I was wondering, what's our recommended way of using once() ?

$element = $(context).find('#selector).once('foo');
if ($element.length) {
  // do stuff on '$element'
}

or

$(context).find('#selector).once('foo').each(function () {
  // do stuff on 'this'
});

?

nod_’s picture

#1, less function nesting, and we usually select only 1 element and do stuff with it. There is a case for .each() sometimes but it's not that often.

yched’s picture

@nod_: makes sense, thks :-)

RTBC +1

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Good catch, thanks!

Committed and pushed to 8.0.x.

  • webchick committed 7c6c7ae on 8.0.x
    Issue #2393391 by nod_: JS clean-up for re-worked Field UI
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.