Bug Tracker

Ticket #1323 (closed bug: duplicate)

Opened 7 years ago

Last modified 3 years ago

Namespace Attributes Selector Missing

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

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.

Change History

comment:1 Changed 7 years ago by sosensible

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.

comment:2 Changed 7 years ago by sosensible

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!)

comment:3 Changed 7 years ago by john

  • Priority changed from blocker to major
  • Status changed from new to closed
  • Version changed from 1.1.2 to 1.1.3
  • Resolution set to duplicate
  • Milestone changed from 1.1.3 to 1.1.4

Duplicate of #155.

Note: See TracTickets for help on using tickets.