Skip to content
This repository
Browse code

Remove put as a dependency of has-class

  • Loading branch information...
commit 1e4e80a4cd35db17ad3ded9938b4e6e582870357 1 parent 4165324
Kris Zyp authored

Showing 1 changed file with 12 additions and 8 deletions. Show diff stats Hide diff stats

  1. 20  has-class.js
20  has-class.js
... ...
@@ -1,14 +1,18 @@
1  
-define(["dojo/has", "./put"], function(has, put){
  1
+define(["dojo/has"], function(has){
  2
+	var tested = {};
2 3
 	return function(){
3 4
 		var test, args = arguments;
4 5
 		for(var i = 0; i < args.length; i++){
5  
-			var test = args[i],
6  
-				parts = test.match(/^(no-)?(.+?)((-[\d\.]+)(-[\d\.]+)?)?$/), // parse the class name
7  
-				hasResult = has(parts[2]), // the actual has test
8  
-				lower = -parts[4]; // lower bound if it is in the form of test-4 or test-4-6 (would be 4)
9  
-			if((lower > 0 ? lower <= hasResult && (-parts[5] || lower) >= hasResult :  // if it has a range boundary, compare to see if we are in it
10  
-					!!hasResult) == !parts[1]){ // parts[1] is the no- prefix that can negate the result
11  
-				put(document.documentElement, '.has-' + test);
  6
+			var test = args[i];
  7
+			if(!tested[test]){
  8
+				tested[test] = true;
  9
+				var parts = test.match(/^(no-)?(.+?)((-[\d\.]+)(-[\d\.]+)?)?$/), // parse the class name
  10
+					hasResult = has(parts[2]), // the actual has test
  11
+					lower = -parts[4]; // lower bound if it is in the form of test-4 or test-4-6 (would be 4)
  12
+				if((lower > 0 ? lower <= hasResult && (-parts[5] || lower) >= hasResult :  // if it has a range boundary, compare to see if we are in it
  13
+						!!hasResult) == !parts[1]){ // parts[1] is the no- prefix that can negate the result
  14
+					document.documentElement.className += ' has-' + test;
  15
+				}
12 16
 			}
13 17
 		}
14 18
 	}

0 notes on commit 1e4e80a

Please sign in to comment.
Something went wrong with that request. Please try again.