jQuery: The Write Less, Do More JavaScript Library

Ticket #1271 (closed bug: fixed)

Opened 1 year ago

Last modified 3 months ago

attribute in FORM?

Reported by: achun Assigned to: john
Type: bug Priority: major
Milestone: 1.2.2 Component: core
Version: 1.2.1 Keywords:
Cc: Needs: Patch

Description

html code:

<div foo='defineattribute'></div>
<form>
<input name='foo'>
</form>

js code:

$('[@act]').each(function(){
//code
});

I want cat DIV only,but FORM ........ Of course . fixed js code:

$('[@act]').each(function(){
if ('FORM'==this.tagName) return;//Trouble.......
//code
});

Attachments

test1271.diff (1.0 kB) - added by joern 8 months ago.
Test

Change History

Changed 1 year ago by achun

sory!

$('[@foo]').each(function(){
//code
});
$('[@foo]').each(function(){
if ('FORM'==this.tagName) return;//Trouble.......
//code
});

Changed 1 year ago by john

  • owner set to john
  • version changed from 1.1.2 to 1.1.3
  • milestone changed from 1.1.3 to 1.1.4

Changed 8 months ago by joern

Test

Changed 8 months ago by joern

  • need changed from Review to Patch
  • version changed from 1.1.3 to 1.2.1
  • milestone changed from 1.1.4 to 1.2.2

Changed 3 months ago by flesler

  • status changed from new to closed
  • resolution set to fixed

Although this case is now improved, .attr() will still return the element if no attribute is found.

That means that if do add a foo attribute to the form, at least empty, it will work as expected.

Note: See TracTickets for help on using tickets.