Skip to main content

Bug Tracker

Side navigation

#4555 closed enhancement (duplicate)

Opened April 17, 2009 01:31PM UTC

Closed November 11, 2009 07:59PM UTC

load has inconsistant behavior

Reported by: h3 Owned by:
Priority: minor Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

Mostly every core functions can be ran without prior element verification.

So instead of;

if ($('#el').length) {

$('#el').show();

}

It's possible to just do;

$('#el').show();

We know that if "#el" is non-existent, the show method wont be called. So far so good.

But if we do this;

$('#el').load('somefile');

If #el is non-existent the Ajax request is performed anyway, thus making it mandatory to write something like this instead;

if ($('#el').length) {

$('#el').load('somefile');

}

In this regard, I think this behavior is counter intuitive and inconsistent with other functions.

There might be good reasons why one would want to perform a Ajax requests to load HTML into a non-existent element, but it's beyond my understanding.

Attachments (0)
Change History (2)

Changed April 21, 2009 02:32AM UTC by dmethvin comment:1

Hmm, seems reasonable. Note that if a callback is provided in that case, it wouldn't be called.

Changed November 11, 2009 07:59PM UTC by john comment:2

resolution: → duplicate
status: newclosed

Duplicate of #4235.