This project is archived and is in readonly mode.

#1220 ✓resolved
Aaron Newton

Request.HTML's update and filter options don't work together

Reported by Aaron Newton | May 3rd, 2011 @ 12:28 AM | in 1.4.0 (closed)

Request.HTML allows you to update a given target with its update option.

It also allows you to filter the response with a given filter option.

If you look at the code, you'll see that these two things do not work together at all:

  if (options.filter) response.tree = response.elements.filter(options.filter);
    if (options.update) document.id(options.update).empty().set('html', response.html);

If you look at the line just above this, you'll also see this line:

  response.elements = temp.getElements('*');

Given that we're running the response tree through getElements anyway, why not pass the options.filter value there (which would have the benefit of allowing the filter to work through the deep tree rather than just on the root elements, which I think the user would expect; at least I do).

If you did that and used the response tree for the update value instead of the response.html, you'd have update and filter working together with the filter working on the entire response:

  response.elements = temp.getElements(options.filter || '*');

    if (options.update) document.id(options.update).empty().adopt(response.elements);

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket

Referenced by

Pages