Permalink
Browse files

spring clean

  • Loading branch information...
1 parent 5ab05b6 commit 2fbf0a7234cc429665216ab1450ccb59efb9695e @adamsilver committed Apr 24, 2012
View
8 functions/attachListener/rendition1.js
@@ -1,20 +1,20 @@
/*
-Degrades in IE 8-
+Degrades in IE 8-
*/
var attachListener;
if(html && isHostMethod(html, 'addEventListener')) {
- attachListener = function(el, eventType, fn) {
+ attachListener = function(el, eventType, fn) {
var listener = function(e) {
fn.call(e, e);
};
- el.addEventListener(eventType, listener, false);
+ el.addEventListener(eventType, listener, false);
return listener;
};
-};
+};
View
4 functions/cancelDefault/rendition1.js
@@ -1,5 +1,7 @@
+var cancelDefault;
+
if(html && isHostMethod(html, 'addEventListener')) {
- var cancelDefault = function(e) {
+ cancelDefault = function(e) {
e.preventDefault();
};
}
View
4 functions/cancelDefault/rendition2.js
@@ -1,5 +1,7 @@
+var cancelDefault;
+
if(html && isHostMethod(html, 'attachEvent')) {
- var cancelDefault = function(e) {
+ cancelDefault = function(e) {
e.returnValue = false;
}
}
View
3 functions/delegateBoundListener/rendition1.js
@@ -8,7 +8,6 @@ if(delegateListener && bind) {
}
}, thisObject);
- attachListener(el, eventType, listener);
- return listener;
+ return attachListener(el, eventType, listener);
};
};
View
4 functions/delegateListener/rendition1.js
@@ -3,7 +3,7 @@ var delegateListener;
if(attachListener && getEventTarget) {
delegateListener = function(el, eventType, fn, fnDelegate) {
- var listener = function(e) {
+ var listener = function(e) {
if(fnDelegate(getEventTarget(e))) {
fn.call(e, e);
}
@@ -12,4 +12,4 @@ if(attachListener && getEventTarget) {
return attachListener(el, eventType, listener);
};
-}
+};
View
6 functions/delegateQueryListener/rendition1.js
@@ -5,8 +5,8 @@ if(delegateListener && isInQuery) {
var fnDelegate = function(target) {
return isInQuery(target, selector);
- }
+ };
return delegateListener(el, eventType, fn, fnDelegate);
- }
-}
+ };
+};
View
15 functions/delegateTagNameListener/rendition1.js
@@ -0,0 +1,15 @@
+var delegateTagNameListener;
+
+if(delegateListener && getElementTagName) {
+ delegateTagNameListener = function(el, eventType, tagName, fn) {
+
+ var fnDelegate = function(target) {
+ var targetTag
+
+
+ return isInQuery(target, selector);
+ }
+
+ return delegateListener(el, eventType, fn, fnDelegate);
+ }
+}
View
5 functions/forEach/rendition1.js
@@ -1,7 +1,8 @@
//Uses native forEach
var forEach;
+
if (Array.prototype.forEach) {
- forEach = function(elements, callback, thisObject) {
- elements.forEach(callback, thisObject);
+ forEach = function(elements, callback, thisObject) {
+ elements.forEach(callback, thisObject);
};
}
View
11 functions/getAncestorByTagName/rendition1.js
@@ -1,10 +1,11 @@
var getAncestorByTagName;
+
if(getElementParent && getElementTagName){
- getAncestorByTagName = function(el, tagName) {
- el = getElementParent(el);
- while (el && tagName && getElementTagName(el) != tagName) {
- el = getElementParent(el);
- }
+ getAncestorByTagName = function(el, tagName) {
+ el = getElementParent(el);
+ while (el && tagName && getElementTagName(el) != tagName) {
+ el = getElementParent(el);
+ }
return el;
};
}
View
7 functions/getDescendantsByClassName/rendition1
@@ -1,7 +0,0 @@
-var getDescendantsByClassName;
-
-if(globalDocument && isHostMethod(globalDocument, "getElementsByClassName") && toArray) {
- getDescendantsByClassName = function(el, className) {
- return toArray((el || document).getElementsByClassName(className));
- };
-};
View
7 functions/getDescendantsByClassName/rendition1.js
@@ -0,0 +1,7 @@
+var getDescendantsByClassName;
+
+if(globalDocument && isHostMethod(globalDocument, "getElementsByClassName") && toArray) {
+ getDescendantsByClassName = function(el, className) {
+ return toArray((el || document).getElementsByClassName(className));
+ };
+};
View
14 functions/getEventTarget/rendition1.js
@@ -5,13 +5,13 @@
var getEventTarget;
if(html && isHostMethod(html, 'addEventListener')) {
- getEventTarget = function(e) {
- var target = e.target;
+ getEventTarget = function(e) {
+ var target = e.target;
// Check if not an element (e.g. a text node)
- if (1 != target.nodeType) {
+ if (1 != target.nodeType) {
// Set reference to parent node (which must be an element)
- target = target.parentNode;
- }
- return target;
+ target = target.parentNode;
+ };
+ return target;
};
-}
+};
View
18 functions/xhrSend/rendition1.js
@@ -22,8 +22,8 @@ if(createXhr) {
xhr.open(method, url);
var defaultHeaders = {
- 'Accept': 'text/javascript, application/json, text/html, application/xml, text/xml, */*',
- 'Content-Type': 'application/x-www-form-urlencoded'
+ //'Accept': 'text/javascript, application/json, text/html, application/xml, text/xml, */*',
+ //'Content-Type': 'application/x-www-form-urlencoded'
};
for(var key in defaultHeaders) {
@@ -33,7 +33,7 @@ if(createXhr) {
if(options.headers) {
for(var key in options.headers) {
xhr.setRequestHeader(key, options.headers[key]);
- }
+ }
}
xhr.onreadystatechange = handleReadyStateChange;
@@ -51,7 +51,6 @@ if(createXhr) {
function handleReadyStateChange() {
if(xhr.readyState === 4) {
- // what constitutes a success
if(options.success && isSuccessfulResponse(xhr)) {
options.success(xhr);
}
@@ -64,17 +63,6 @@ if(createXhr) {
}
};
- //if(isHostMethod(xmlHttp, "overrideMimeType")) {
- // xmlHttp.overrideMimeType(mimetype);
- //}
- //xmlHttp.abort();
- //xmlHttp.getAllResponseHeaders();
- //xmlHttp.getResponseHeader();
- //xmlHttp.init
- //xmlHttp.openRequest
- //xmlHttp.sendAsBinary
-
xmlHttp.send(data);
-
};
};

0 comments on commit 2fbf0a7

Please sign in to comment.