Permalink
Browse files

Add Element#isTagName

  • Loading branch information...
1 parent 26a3893 commit 3e4349f375b6a4953d18f1e361e14edeaabadb8a kangax committed Jun 13, 2008
Showing with 13 additions and 0 deletions.
  1. +13 −0 element.methods.js
View
@@ -221,4 +221,17 @@ Element.Methods.indexOf = function(element) {
return parent.childElements().indexOf(element);
};
+/**
+ * Element.isTagName(@element, tagName) -> Boolean | null
+ * returns true if element has tagName equal to the one specified
+ * returns null if element has no tagName
+ *
+ *
+ *
+ **/
+Element.Methods.isTagName = function(element, tagName) {
+ if (!element.tagName) return null;
+ return element.tagName.toUpperCase() == String(tagName).toUpperCase();
+};
+
Element.addMethods();

0 comments on commit 3e4349f

Please sign in to comment.