Bug Tracker

Ticket #2929 (new feature)

Opened 4 months ago

Last modified 4 months ago

Comparing DOM elements and/or jQuery objects for equality

Reported by: pfm102 Assigned to: anonymous
Type: feature Priority: major
Milestone: 1.3 Component: core
Version: 1.2.5 Keywords:
Cc: Needs: Review

Description

It would be really useful if jQuery.is could be passed a DOM element, and then returns true if the DOM element is equal to the single DOM element in the jQuery array.

Similarly, it would be handy to be able to do .equals to compare two jQuery arrays.

Attachments

Change History

Changed 4 months ago by flesler

You can use:

  $('html,body').index( document.body ) != -1;
or even
  $('html,body').index( $('body') ) != -1;
Note: See TracTickets for help on using tickets.