kangax said:
Garrett said:
kangax wrote: [...]
I'm also open to any suggestions/corrections, of course.
There is no need to use an empty statement following a
FunctionDeclaration.
You've taken APE.dom.contains[1], renamed it to "contans" and did not
mention where the code came from and you know exactly where it came from
Garrett, I did not rename anything. I did take `contains` "as is" from
APE of course. I should have mentioned where it is taken from but
Yes.
// (GS) contans?
var contans = (function() {
var docEl = document.documentElement;
if (typeof docEl.compareDocumentPosition != 'undefined') {
return function(el, b) {
return (el.compareDocumentPosition(b) & 16) !== 0;
}
}
else if (typeof docEl.contains != 'undefined') {
return function(el, b) {
return el !== b && el.contains(b);
}
}
return function(el, b) {
if (el === b) return false;
// (GS) Should use !==.
while (el != b && (b = b.parentNode) != null);
return el === b;
}
})() // (GS) don't rely on automatic semicolon insertion.
[...]
Please, let me know if there are any other oversights.
Time to go the the gym.
Garrett