From 86839b70ffcd05bb375df3bc63d0e13ee9203c25 Mon Sep 17 00:00:00 2001 From: daper Date: Sun, 22 Sep 2013 18:17:46 +0200 Subject: [PATCH] Fix Beginning/Trailing Spaces on Classes I applied the trim function to string class before it is split what caused an error output if it had beginning or trailing spaces. --- unique-selector/src/unique-selector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unique-selector/src/unique-selector.js b/unique-selector/src/unique-selector.js index a2273f0..c59d5e0 100644 --- a/unique-selector/src/unique-selector.js +++ b/unique-selector/src/unique-selector.js @@ -30,7 +30,7 @@ return a.length - b.length; }; if (el.attr("class")) { - classes = el.attr("class").split(" "); + classes = $.trim(el.attr("class")).split(" "); for (i = 0; i < classes.length; i += 1) { if (1 === $(tagName + "." + classes[i]).length) { simple_candidates.push(tagName + "." + classes[i]);