Skip to main content

Bug Tracker

Side navigation

#1323 closed bug (duplicate)

Opened June 26, 2007 12:34PM UTC

Closed July 15, 2007 02:15PM UTC

Last modified March 15, 2012 04:43PM UTC

Namespace Attributes Selector Missing

Reported by: sosensible Owned by:
Priority: major Milestone: 1.1.4
Component: core Version: 1.1.3
Keywords: Cc:
Blocked by: Blocking:
Description

You can call the attribute correctly like this...

jQuery('form').attr('name:attribute')="true"

but that doesn't return a collection of forms where the condition is true... and if you manually create an array that doesn't work with the jQuery each. The following would be a test case that should work. (Libraries like SPRY are using this technology and it SHOULD be with this release if possible.)

jQuery('form[@name:attribute="true"]').each(function(){});

If another type of selectore or function cared for that it would be fine also... but this is definitely a missing feature in jQuery selectors and selectors are very much what makes jQuery great.

Attachments (0)
Change History (3)

Changed June 26, 2007 01:44PM UTC by sosensible comment:1

Here is an example of a work around I found for others who may need one.

jQuery.fn.coopforms = function(){

var myForms = new Array();

jQuery('form').each(function(){

if(jQuery(this).attr("coop:manage")=="true") {

myForms[myForms.length] = this;

coopformlist = jQuery.ListAppend(coopformlist,this.id);

}

})

return jQuery(myForms);

}

This will wrap your resulting array as a jQuery collection than can be chained like normal jQuery selectors.

Changed June 26, 2007 03:54PM UTC by sosensible comment:2

jQuery.fn.coopforms = function() {

return this.filter(function(){

return jQuery(this).attr("coop:manage") == "true";

});

};

Dan and Mike helped me get this simpler. (Was missing the return on the outer level. Return on the inner side of the loop isn't enough!)

Changed July 15, 2007 02:15PM UTC by john comment:3

milestone: 1.1.31.1.4
priority: blockermajor
resolution: → duplicate
status: newclosed
version: 1.1.21.1.3

Duplicate of #155.