Skip to main content

Bug Tracker

Side navigation

Ticket #4101: 0001-Adds-.fn.has-depends-on-Sizzle-patch.patch
File 0001-Adds-.fn.has-depends-on-Sizzle-patch.patch, 2.6 KB (added by yehuda, July 21, 2009 07:52AM UTC)
From 6b860c88e1edb6833a57905d9dc38a0e378e6e06 Mon Sep 17 00:00:00 2001
From: Yehuda Katz 
Date: Tue, 21 Jul 2009 00:51:11 -0700
Subject: [PATCH] Adds $.fn.has (depends on Sizzle patch)

---
 src/traversing.js       |    8 ++++++++
 test/unit/traversing.js |   38 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 45 insertions(+), 1 deletions(-)

diff --git a/src/traversing.js b/src/traversing.js
index 669c70a..f6b7e62 100644
--- a/src/traversing.js
+++ b/src/traversing.js
@@ -43,6 +43,14 @@ jQuery.fn.extend({
 		return ret;
 	},
 
+	has: function( target ) {
+	  var targets = jQuery(target);
+	  return this.filter(function() {
+			for( var i=0, j=targets.length; i

Download in other formats:

Original Format