From 9ce99bf2800fc54c3cef55678e91bf0c73689829 Mon Sep 17 00:00:00 2001
From: Thomas Gelf <thomas@gelf.net>
Date: Tue, 19 Aug 2014 12:22:36 +0200
Subject: [PATCH] js/helpers: add $.hasAttr

Need this for another fix and there is no such jQuery function. As this
seems to also be inconsistant across browsers I thought this would
definitively be worth a custom jQuery plugin.
---
 public/js/helpers.js | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/public/js/helpers.js b/public/js/helpers.js
index 082689e40..416bf1185 100644
--- a/public/js/helpers.js
+++ b/public/js/helpers.js
@@ -95,6 +95,13 @@ if (!Function.prototype.bind) {
 
     'use strict';
 
+    /* Whether a HTML tag has a specific attribute */
+    $.fn.hasAttr = function(name) {
+        // We have inconsistent behaviour across browsers (false VS undef)
+        var val = this.attr(name);
+        return typeof val !== 'undefined' && val !== false;
+    };
+
     /* Get class list */
     $.fn.classes = function (callback) {