Permalink
Browse files

making the specs maintainability easier by usgina php include

  • Loading branch information...
1 parent d6142dd commit 340adbec99dba3af10daa3d67fb277b09051cba7 @fabiomcosta committed Feb 11, 2011
View
@@ -37,6 +37,11 @@ Examples
* $u('div#id.div-class') -> [<div#id.div-class>]
* $u('em') -> []
+Run Tests
+---------
+Enter the tests/ folder on your browser.
+You'll need PHP on your server to run them.
+
License
-------
@@ -1,15 +1,5 @@
var SlickSpec = {
- isHTML: function(document){
- var testNode = document.createElement('div'), isHTML = false;
- try {
- var id = 'slick_getbyid_test';
- testNode.innerHTML = '<a id="'+id+'"></a>';
- isHTML = !!document.getElementById(id);
- } catch(e){};
- return isHTML;
- },
-
addEvent: function(obj, event, handler) {
if (obj.addEventListener) {
obj.addEventListener(event, handler, false);
@@ -142,7 +132,7 @@ var SlickSpec = {
if (!this instanceof Mock.Request) throw new Error('Mock.Request is not callable directly. Must use `new Mock.Request`');
this.mockName = mockName;
- this.url = url;
+ this.url = url + '?nocache=' + (+new Date);
var self = this;
this.rq = new SimpleRequest();
Mock.templateCounter++;
@@ -159,7 +149,7 @@ var SlickSpec = {
Mock.templateCounter++;
template.style.display = 'none';
template.setAttribute('iframeboder', 0);
- template.src = url;
+ template.src = url + '?nocache=' + (+new Date);
document.getElementsByTagName('body')[0].appendChild(template);
};
View
@@ -15,12 +15,12 @@
var $u = function(selector, _context, append){
elements = append || [];
context = _context || $u.context;
- currentDocument = context.ownerDocument || context;
if (supports_querySelectorAll){
try{
arrayFrom(context.querySelectorAll(selector));
} catch (e){}
} else {
+ currentDocument = context.ownerDocument || context;
selector = selector.replace(/^\s+|\s+$/g, '');
parse(selector);
find();
@@ -53,8 +53,9 @@
var find = function(){
- var parsedId = parsed.id, merge = ((parsedId && parsed.tag || parsed.classList) || (!parsedId && parsed.classList)) ?
- arrayFilterAndMerge : arrayMerge;
+ var parsedId = parsed.id,
+ merge = ((parsedId && parsed.tag || parsed.classList) || (!parsedId && parsed.classList)) ?
+ arrayFilterAndMerge : arrayMerge;
if (parsedId){
@@ -91,8 +92,6 @@
return '';
};
- $u.context = document;
-
var slice = Array.prototype.slice;
var arrayFrom = function(collection){
elements = slice.call(collection, 0);
@@ -114,7 +113,6 @@
}
};
- var root = document.documentElement;
var contains = function(node){
if (node){
do {
@@ -123,7 +121,8 @@
}
return false;
};
-
+
+ $u['context'] = document;
global['uSelector'] = $u;
if (!global['$u']) global['$u'] = $u;
Oops, something went wrong.

0 comments on commit 340adbe

Please sign in to comment.