Merge pull request #802 from dexteryy/dollar.js

Added DollarJS 1.1.0
This commit is contained in:
Ryan Kirkman
2013-01-21 01:24:25 -08:00
3 changed files with 762 additions and 0 deletions
+719
View File
@@ -0,0 +1,719 @@
/**
* DollarJS
* A jQuery-compatible and non-All-in-One library which is more "Zepto" than Zepto.js
* Focus on DOM operations and mobile platform, wrap native API wherever possible.
*
* using AMD (Asynchronous Module Definition) API with OzJS
* see http://ozjs.org for details
*
* Copyright (C) 2010-2012, Dexter.Yy, MIT License
* vim: et:ts=4:sw=4:sts=4
*/
define("dollar", [
"mo/lang/es5",
"mo/lang/mix",
"mo/lang/type"
], function(es5, _, detect){
var window = this,
doc = window.document,
NEXT_SIB = 'nextElementSibling',
PREV_SIB = 'prevElementSibling',
FIRST_CHILD = 'firstElementChild',
MATCHES_SELECTOR = ['webkitMatchesSelector', 'mozMatchesSelector', 'matchesSelector']
.map(function(name){
return this[name] && name;
}, doc.body).filter(pick)[0],
_MOE = 'MouseEvents',
SPECIAL_EVENTS = { click: _MOE, mousedown: _MOE, mouseup: _MOE, mousemove: _MOE },
CSS_NUMBER = {
'column-count': 1, 'columns': 1, 'font-weight': 1,
'line-height': 1, 'opacity': 1, 'z-index': 1, 'zoom': 1
},
RE_HTMLTAG = /^\s*<(\w+|!)[^>]*>/,
isFunction = detect.isFunction,
_array_each = Array.prototype.forEach,
_array_map = Array.prototype.map,
_array_push = Array.prototype.push,
_getComputedStyle = document.defaultView.getComputedStyle,
_next_pointer,
_elm_display = {},
_html_containers = {};
function $(selector, context){
if (selector) {
if (selector.constructor === $) {
return selector;
} else if (typeof selector !== 'string') {
var nodes = new $();
_array_push[selector.push === _array_push
? 'apply' : 'call'](nodes, selector);
return nodes;
} else if (RE_HTMLTAG.test(selector)) {
return create_nodes(selector);
} else if (context) {
return $(context).find(selector);
} else {
return ext.find(selector);
}
} else if (this === window) {
return new $();
}
}
var ext = $.fn = $.prototype = [];
['map', 'filter', 'slice', 'reverse', 'sort'].forEach(function(method){
var origin = this['_' + method] = this[method];
this[method] = function(){
return $(origin.apply(this, arguments));
};
}, ext);
['splice', 'concat'].forEach(function(method){
var origin = this['_' + method] = this[method];
this[method] = function(){
return $(origin.apply(this._slice(), _array_map.call(
arguments, function(i){
return i._slice();
})
));
};
}, ext);
_.mix(ext, {
constructor: $,
// Traversing
find: function(selector){
var nodes = new $(), contexts;
if (this === ext) {
contexts = [doc];
} else {
nodes.prevObject = contexts = this;
}
if (/^#/.test(selector)) {
var elm = (contexts[0] || doc).getElementById(selector.substr(1));
if (elm) {
nodes.push(elm);
}
} else {
var query = /\W/.test(selector) ? 'querySelectorAll'
: 'getElementsByTagName';
if (contexts[1]) {
contexts.forEach(function(context){
this.push.apply(this, context[query](selector));
}, nodes);
} else if (contexts[0]) {
nodes.push.apply(nodes, contexts[0][query](selector));
}
}
return nodes;
},
eq: function(i){
return i === -1 ? this.slice(-1) : this.slice(i, i + 1);
},
not: function(selector){
return this.filter(function(node){
return node && !this(node, selector);
}, matches_selector);
},
has: function(selector){
return this.filter(function(node){
return this(node, selector);
}, matches_selector);
},
parent: find_near('parentNode'),
parents: function(selector){
var ancestors = new $(), p = this,
finding = selector ? find_selector(selector, 'parentNode') : function(node){
return this[this.push(node.parentNode) - 1];
};
while (p.length) {
p = p.map(finding, ancestors);
}
return ancestors;
},
closest: function(selector){
var ancestors = new $(), p = this,
finding = find_selector(selector, 'parentNode');
while (p.length && !ancestors.length) {
p = p.map(finding, ancestors);
}
return ancestors.length && ancestors || this;
},
siblings: find_sibs(NEXT_SIB, FIRST_CHILD),
next: find_near(NEXT_SIB),
nextAll: find_sibs(NEXT_SIB),
nextUntil: find_sibs(NEXT_SIB, false, true),
prev: find_near(PREV_SIB),
prevAll: find_sibs(PREV_SIB),
prevUntil: find_sibs(PREV_SIB, false, true),
children: function(){
return _.merge.apply(_, this.map(function(node){
return this(node.children);
}, $));
},
contents: function(){
return _.merge.apply(_, this.map(function(node){
return this(node.childNodes);
}, $));
},
// Detection
is: function(selector){
return this.some(function(node){
return matches_selector(node, selector);
});
},
hasClass: function(cname){
for (var i = 0, l = this.length; i < l; i++) {
if (this[i].classList.contains(cname)) {
return true;
}
}
return false;
},
// Properties
addClass: function(cname){
return foreach_farg(this, cname, 'className', function(node, cname){
node.classList.add(cname);
});
},
removeClass: function(cname){
return foreach_farg(this, cname, 'className', function(node, cname){
node.classList.remove(cname);
});
},
toggleClass: function(cname, force){
return foreach_farg(this, cname, 'className', function(node, cname){
node.classList[typeof this === 'undefined' && 'toggle'
|| this && 'add' || 'remove'](cname);
}, force);
},
attr: kv_access(function(node, name, value){
node.setAttribute(name, value);
}, function(node, name){
return node && node.getAttribute(name);
}),
removeAttr: function(name){
this.forEach(function(node){
node.removeAttribute(this);
}, name);
return this;
},
prop: kv_access(function(node, name, value){
node[name] = value;
}, function(node, name){
return (node || {})[name];
}),
removeProp: function(name){
this.forEach(function(node){
delete node[this];
}, name);
return this;
},
data: kv_access(function(node, name, value){
node.dataset[css_method(name)] = value;
}, function(node, name){
return (node || {}).dataset[css_method(name)];
}),
removeData: function(name){
this.forEach(function(node){
delete node.dataset[this];
}, name);
return this;
},
val: function(value){
var node = this[0];
if (value === undefined) {
if (node) {
if (node.multiple) {
return $('option', this).filter(function(item){
return item.selected;
}).map(function(item){
return item.value;
});
}
return node.value;
}
} else {
return foreach_farg(this, value, 'value', function(node, value){
node.value = value;
});
}
},
empty: function(){
this.forEach(function(node){
node.innerHTML = '';
});
return this;
},
html: function(str){
return str === undefined ? (this[0] || {}).innerHTML
: foreach_farg(this, str, 'innerHTML', function(node, str){
if (RE_HTMLTAG.test(str)) {
this(node).empty().append(str);
} else {
node.innerHTML = str;
}
}, $);
},
text: function(str){
return str === undefined ? (this[0] || {}).textContent
: foreach_farg(this, str, 'textContent', function(node, str){
node.textContent = str;
});
},
clone: function(){
return this.map(function(node){
return node.cloneNode(true);
});
},
css: kv_access(function(node, name, value){
var prop = css_prop(name);
if (!value && value !== 0) {
node.style.removeProperty(prop);
} else {
node.style.cssText += ';' + prop + ":" + css_unit(prop, value);
}
}, function(node, name){
return node && (node.style[css_method(name)]
|| _getComputedStyle(node, '').getPropertyValue(name));
}, function(self, dict){
var prop, value, css = '';
for (var name in dict) {
value = dict[name];
prop = css_prop(name);
if (!value && value !== 0) {
self.forEach(function(node){
node.style.removeProperty(this);
}, prop);
} else {
css += prop + ":" + css_unit(prop, value) + ';';
}
}
self.forEach(function(node){
node.style.cssText += ';' + this;
}, css);
}),
hide: function(){
return this.css("display", "none");
},
show: function(){
this.forEach(function(node){
if (node.style.display === "none") {
node.style.display = null;
}
if (this(node, '').getPropertyValue("display") === "none") {
node.style.display = default_display(node.nodeName);
}
}, _getComputedStyle);
return this;
},
// Dimensions
offset: function(){
var set = this[0].getBoundingClientRect();
return {
left: set.left + window.pageXOffset,
top: set.top + window.pageYOffset,
width: set.width,
height: set.height
};
},
width: dimension('Width'),
height: dimension('Height'),
// Manipulation
appendTo: operator_insert_to(1),
append: operator_insert(1),
prependTo: operator_insert_to(3),
prepend: operator_insert(3),
insertBefore: operator_insert_to(2),
before: operator_insert(2),
insertAfter: operator_insert_to(4),
after: operator_insert(4),
replaceAll: function(targets){
var t = $(targets);
this.insertBefore(t);
t.remove();
return this;
},
replaceWith: function(contents){
return $(contents).replaceAll(this);
},
wrap: function(boxes){
return foreach_farg(this, boxes, false, function(node, boxes){
this(boxes).insertBefore(node).append(node);
}, $);
},
wrapAll: function(boxes){
$(boxes).insertBefore(this.eq(0)).append(this);
return this;
},
wrapInner: function(boxes){
return foreach_farg(this, boxes, false, function(node, boxes){
this(node).contents().wrapAll(boxes);
}, $);
},
unwrap: function(){
this.parent().forEach(function(node){
this(node).children().replaceAll(node);
}, $);
return this;
},
remove: function(){
this.forEach(function(node){
var parent = node.parentNode;
if (parent) {
parent.removeChild(node);
}
});
return this;
},
// Event
bind: event_access('add'),
unbind: event_access('remove'),
trigger: function(event, argv){
if (typeof event === 'string') {
event = Event(event);
}
_.mix(event, argv);
this.forEach(event.type == 'submit'
&& !event.defaultPrevented ? function(node){
node.submit();
} : function(node){
if ('dispatchEvent' in node) {
node.dispatchEvent(this);
}
}, event);
return this;
},
// Miscellaneous
end: function(){
return this.prevObject || new $();
},
each: function(fn){
for (var i = 0, l = this.length; i < l; i++){
var re = fn.call(this[i], i);
if (re === false) {
break;
}
}
return this;
}
});
// private
function pick(v){
return v;
}
function matches_selector(elm, selector){
return elm && elm[MATCHES_SELECTOR](selector);
}
function find_selector(selector, attr){
return function(node){
if (attr) {
node = node[attr];
}
if (matches_selector(node, selector)) {
this.push(node);
}
return node;
};
}
function find_near(prop){
return function(selector){
return $(_.unique([undefined, doc, null].concat(
this._map(selector ? function(node){
var n = node[prop];
if (n && matches_selector(n, selector)) {
return n;
}
} : function(node){
return node[prop];
})
)).slice(3));
};
}
function find_sibs(prop, start, has_until){
return function(target, selector){
if (!has_until) {
selector = target;
}
var sibs = new $();
this.forEach(function(node){
var until,
n = start ? node.parentNode[start] : node;
if (has_until) {
until = $(target, node.parentNode);
}
do {
if (until && until.indexOf(n) > -1) {
break;
}
if (node !== n && (!selector
|| matches_selector(n, selector))) {
this.push(n);
}
} while (n = n[prop]);
}, sibs);
return _.unique(sibs);
};
}
function foreach_farg(nodes, arg, prop, cb, context){
var is_fn_arg = isFunction(arg);
nodes.forEach(function(node, i){
cb.call(context, node, !is_fn_arg ? arg
: arg.call(this, i, prop && node[prop]));
}, nodes);
return nodes;
}
function kv_access(setter, getter, map){
return function(name, value){
if (typeof name === 'object') {
if (map) {
map(this, name);
} else {
for (var k in name) {
this.forEach(function(node){
setter(node, this, name[this]);
}, k);
}
}
} else {
if (value !== undefined) {
var is_fn_arg = isFunction(value);
this.forEach(function(node, i){
setter(node, name, !is_fn_arg ? value
: value.call(this, i, getter(node, name)));
}, this);
} else {
return getter(this[0], name);
}
}
return this;
};
}
function event_access(action){
function access(subject, cb){
if (typeof subject === 'object') {
for (var i in subject) {
access.call(this, [i, subject[i]]);
}
} else if (cb) {
this.forEach(function(node){
node[action + 'EventListener'](subject, this, false);
}, cb);
} // not support 'removeAllEventListener'
return this;
}
return access;
}
function Event(type, props) {
var bubbles = true,
event = document.createEvent(SPECIAL_EVENTS[type] || 'Events');
if (props) {
if ('bubbles' in props) {
bubbles = !!props.bubbles;
delete props.bubbles;
}
_.mix(event, props);
}
event.initEvent(type, bubbles, true);
return event;
}
function css_method(name){
return name.replace(/-+(.)?/g, function($0, $1){
return $1 ? $1.toUpperCase() : '';
});
}
function css_prop(name) {
return name.replace(/::/g, '/')
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
.replace(/([a-z\d])([A-Z])/g, '$1_$2')
.replace(/_/g, '-')
.toLowerCase();
}
function css_unit(name, value) {
return typeof value == "number" && !CSS_NUMBER[name]
&& value + "px" || value;
}
function default_display(tag) {
var display = _elm_display[tag];
if (!display) {
var tmp = document.createElement(tag);
doc.body.appendChild(tmp);
display = _getComputedStyle(tmp, '').getPropertyValue("display");
tmp.parentNode.removeChild(tmp);
if (display === "none") {
display = "block";
}
_elm_display[tag] = display;
}
return display;
}
function dimension(method){
return function(){
var offset;
return this[0] === window
? window['inner' + method]
: this[0] === doc
? doc.documentElement['offset' + method]
: (this.offset() || {})[method.toLowerCase()];
};
}
function create_nodes(str, attrs){
var tag = (RE_HTMLTAG.exec(str) || [])[0] || str;
var temp = _html_containers[tag];
if (!temp) {
temp = _html_containers[tag] = tag === 'tr' && document.createElement('tbody')
|| (tag === 'tbody' || tag === 'thead' || tag === 'tfoot')
&& document.createElement('table')
|| (tag === 'td' || tag === 'th') && document.createElement('tr')
|| document.createElement('div');
}
temp.innerHTML = str;
var nodes = new $();
_array_push.apply(nodes, temp.childNodes);
nodes.forEach(function(node){
this.removeChild(node);
}, temp);
if (attrs) {
for (var k in attrs) {
nodes.attr(k, attrs[k]);
}
}
return nodes;
}
function insert_node(target, node, action){
if (node.nodeName.toUpperCase() === 'SCRIPT'
&& (!node.type || node.type === 'text/javascript')) {
window['eval'].call(window, node.innerHTML);
}
switch(action) {
case 1: target.appendChild(node); break;
case 2: target.parentNode.insertBefore(node, target); break;
case 3: target.insertBefore(node, target.firstChild); break;
case 4: target.parentNode.insertBefore(node, target.nextSibling); break;
default: break;
}
}
function insert_nodes(action, is_reverse){
var fn = is_reverse ? function(target){
insert_node(target, this, action);
} : function(content){
insert_node(this, content, action);
};
return function(elms){
this.forEach(function(node){
this.forEach(fn, node);
}, $(elms));
return this;
};
}
function operator_insert_to(action){
return insert_nodes(action, true);
}
function operator_insert(action){
return insert_nodes(action);
}
// public static API
$.find = $;
$.matchesSelector = matches_selector;
$.createNodes = create_nodes;
$.camelize = css_method;
$.dasherize = css_prop;
$.Event = Event;
$.VERSION = '1.1.0';
return $;
});
+17
View File
@@ -0,0 +1,17 @@
define("dollar",["mo/lang/es5","mo/lang/mix","mo/lang/type"],function(M,f,I){function d(a,b){if(a){if(a.constructor===d)return a;if("string"!==typeof a){var c=new d;r[a.push===r?"apply":"call"](c,a);return c}return s.test(a)?y(a):b?d(b).find(a):m.find(a)}if(this===h)return new d}function k(a,b){return a&&a[J](b)}function z(a,b){return function(c){b&&(c=c[b]);k(c,a)&&this.push(c);return c}}function t(a){return function(b){return d(f.unique([void 0,l,null].concat(this._map(b?function(c){if((c=c[a])&&
k(c,b))return c}:function(b){return b[a]}))).slice(3))}}function n(a,b,c){return function(e,u){c||(u=e);var g=new d;this.forEach(function(g){var v,f=b?g.parentNode[b]:g;c&&(v=d(e,g.parentNode));do{if(v&&-1<v.indexOf(f))break;g!==f&&(!u||k(f,u))&&this.push(f)}while(f=f[a])},g);return f.unique(g)}}function i(a,b,c,e,d){var g=A(b);a.forEach(function(a,f){e.call(d,a,!g?b:b.call(this,f,c&&a[c]))},a);return a}function p(a,b,c){return function(e,d){if("object"===typeof e)if(c)c(this,e);else for(var g in e)this.forEach(function(b){a(b,
this,e[this])},g);else if(void 0!==d){var f=A(d);this.forEach(function(c,g){a(c,e,!f?d:d.call(this,g,b(c,e)))},this)}else return b(this[0],e);return this}}function B(a){function b(c,e){if("object"===typeof c)for(var d in c)b.call(this,[d,c[d]]);else e&&this.forEach(function(b){b[a+"EventListener"](c,this,!1)},e);return this}return b}function C(a,b){var c=!0,e=document.createEvent(K[a]||"Events");b&&("bubbles"in b&&(c=!!b.bubbles,delete b.bubbles),f.mix(e,b));e.initEvent(a,c,!0);return e}function q(a){return a.replace(/-+(.)?/g,
function(a,c){return c?c.toUpperCase():""})}function w(a){return a.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function D(a){return function(){return this[0]===h?h["inner"+a]:this[0]===l?l.documentElement["offset"+a]:(this.offset()||{})[a.toLowerCase()]}}function y(a,b){var c=(s.exec(a)||[])[0]||a,e=E[c];e||(e=E[c]="tr"===c&&document.createElement("tbody")||("tbody"===c||"thead"===c||"tfoot"===c)&&document.createElement("table")||
("td"===c||"th"===c)&&document.createElement("tr")||document.createElement("div"));e.innerHTML=a;c=new d;r.apply(c,e.childNodes);c.forEach(function(a){this.removeChild(a)},e);if(b)for(var f in b)c.attr(f,b[f]);return c}function F(a,b,c){"SCRIPT"===b.nodeName.toUpperCase()&&(!b.type||"text/javascript"===b.type)&&h.eval.call(h,b.innerHTML);switch(c){case 1:a.appendChild(b);break;case 2:a.parentNode.insertBefore(b,a);break;case 3:a.insertBefore(b,a.firstChild);break;case 4:a.parentNode.insertBefore(b,
a.nextSibling)}}function j(a,b){var c=b?function(b){F(b,this,a)}:function(b){F(this,b,a)};return function(a){this.forEach(function(a){this.forEach(c,a)},d(a));return this}}var h=this,l=h.document,J=["webkitMatchesSelector","mozMatchesSelector","matchesSelector"].map(function(a){return this[a]&&a},l.body).filter(function(a){return a})[0],K={click:"MouseEvents",mousedown:"MouseEvents",mouseup:"MouseEvents",mousemove:"MouseEvents"},G={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,
"z-index":1,zoom:1},s=/^\s*<(\w+|!)[^>]*>/,A=I.isFunction,L=Array.prototype.map,r=Array.prototype.push,x=document.defaultView.getComputedStyle,H={},E={},m=d.fn=d.prototype=[];["map","filter","slice","reverse","sort"].forEach(function(a){var b=this["_"+a]=this[a];this[a]=function(){return d(b.apply(this,arguments))}},m);["splice","concat"].forEach(function(a){var b=this["_"+a]=this[a];this[a]=function(){return d(b.apply(this._slice(),L.call(arguments,function(a){return a._slice()})))}},m);f.mix(m,
{constructor:d,find:function(a){var b=new d,c;this===m?c=[l]:b.prevObject=c=this;if(/^#/.test(a))(c=(c[0]||l).getElementById(a.substr(1)))&&b.push(c);else{var e=/\W/.test(a)?"querySelectorAll":"getElementsByTagName";c[1]?c.forEach(function(b){this.push.apply(this,b[e](a))},b):c[0]&&b.push.apply(b,c[0][e](a))}return b},eq:function(a){return-1===a?this.slice(-1):this.slice(a,a+1)},not:function(a){return this.filter(function(b){return b&&!this(b,a)},k)},has:function(a){return this.filter(function(b){return this(b,
a)},k)},parent:t("parentNode"),parents:function(a){for(var b=new d,c=this,a=a?z(a,"parentNode"):function(a){return this[this.push(a.parentNode)-1]};c.length;)c=c.map(a,b);return b},closest:function(a){for(var b=new d,c=this,a=z(a,"parentNode");c.length&&!b.length;)c=c.map(a,b);return b.length&&b||this},siblings:n("nextElementSibling","firstElementChild"),next:t("nextElementSibling"),nextAll:n("nextElementSibling"),nextUntil:n("nextElementSibling",!1,!0),prev:t("prevElementSibling"),prevAll:n("prevElementSibling"),
prevUntil:n("prevElementSibling",!1,!0),children:function(){return f.merge.apply(f,this.map(function(a){return this(a.children)},d))},contents:function(){return f.merge.apply(f,this.map(function(a){return this(a.childNodes)},d))},is:function(a){return this.some(function(b){return k(b,a)})},hasClass:function(a){for(var b=0,c=this.length;b<c;b++)if(this[b].classList.contains(a))return!0;return!1},addClass:function(a){return i(this,a,"className",function(a,c){a.classList.add(c)})},removeClass:function(a){return i(this,
a,"className",function(a,c){a.classList.remove(c)})},toggleClass:function(a,b){return i(this,a,"className",function(a,b){a.classList["undefined"===typeof this&&"toggle"||this&&"add"||"remove"](b)},b)},attr:p(function(a,b,c){a.setAttribute(b,c)},function(a,b){return a&&a.getAttribute(b)}),removeAttr:function(a){this.forEach(function(a){a.removeAttribute(this)},a);return this},prop:p(function(a,b,c){a[b]=c},function(a,b){return(a||{})[b]}),removeProp:function(a){this.forEach(function(a){delete a[this]},
a);return this},data:p(function(a,b,c){a.dataset[q(b)]=c},function(a,b){return(a||{}).dataset[q(b)]}),removeData:function(a){this.forEach(function(a){delete a.dataset[this]},a);return this},val:function(a){var b=this[0];if(void 0===a){if(b)return b.multiple?d("option",this).filter(function(a){return a.selected}).map(function(a){return a.value}):b.value}else return i(this,a,"value",function(a,b){a.value=b})},empty:function(){this.forEach(function(a){a.innerHTML=""});return this},html:function(a){return void 0===
a?(this[0]||{}).innerHTML:i(this,a,"innerHTML",function(a,c){s.test(c)?this(a).empty().append(c):a.innerHTML=c},d)},text:function(a){return void 0===a?(this[0]||{}).textContent:i(this,a,"textContent",function(a,c){a.textContent=c})},clone:function(){return this.map(function(a){return a.cloneNode(!0)})},css:p(function(a,b,c){b=w(b);!c&&0!==c?a.style.removeProperty(b):a.style.cssText+=";"+b+":"+("number"==typeof c&&!G[b]&&c+"px"||c)},function(a,b){return a&&(a.style[q(b)]||x(a,"").getPropertyValue(b))},
function(a,b){var c,d,f="",g;for(g in b)d=b[g],c=w(g),!d&&0!==d?a.forEach(function(a){a.style.removeProperty(this)},c):f+=c+":"+("number"==typeof d&&!G[c]&&d+"px"||d)+";";a.forEach(function(a){a.style.cssText+=";"+this},f)}),hide:function(){return this.css("display","none")},show:function(){this.forEach(function(a){"none"===a.style.display&&(a.style.display=null);if("none"===this(a,"").getPropertyValue("display")){var b=a.style,a=a.nodeName,c=H[a];if(!c){var d=document.createElement(a);l.body.appendChild(d);
c=x(d,"").getPropertyValue("display");d.parentNode.removeChild(d);"none"===c&&(c="block");H[a]=c}b.display=c}},x);return this},offset:function(){var a=this[0].getBoundingClientRect();return{left:a.left+h.pageXOffset,top:a.top+h.pageYOffset,width:a.width,height:a.height}},width:D("Width"),height:D("Height"),appendTo:j(1,!0),append:j(1),prependTo:j(3,!0),prepend:j(3),insertBefore:j(2,!0),before:j(2),insertAfter:j(4,!0),after:j(4),replaceAll:function(a){a=d(a);this.insertBefore(a);a.remove();return this},
replaceWith:function(a){return d(a).replaceAll(this)},wrap:function(a){return i(this,a,!1,function(a,c){this(c).insertBefore(a).append(a)},d)},wrapAll:function(a){d(a).insertBefore(this.eq(0)).append(this);return this},wrapInner:function(a){return i(this,a,!1,function(a,c){this(a).contents().wrapAll(c)},d)},unwrap:function(){this.parent().forEach(function(a){this(a).children().replaceAll(a)},d);return this},remove:function(){this.forEach(function(a){var b=a.parentNode;b&&b.removeChild(a)});return this},
bind:B("add"),unbind:B("remove"),trigger:function(a,b){"string"===typeof a&&(a=C(a));f.mix(a,b);this.forEach("submit"==a.type&&!a.defaultPrevented?function(a){a.submit()}:function(a){"dispatchEvent"in a&&a.dispatchEvent(this)},a);return this},end:function(){return this.prevObject||new d},each:function(a){for(var b=0,c=this.length;b<c&&!1!==a.call(this[b],b);b++);return this}});d.find=d;d.matchesSelector=k;d.createNodes=y;d.camelize=q;d.dasherize=w;d.Event=C;d.VERSION="1.1.0";return d});
+26
View File
@@ -0,0 +1,26 @@
{
"name": "dollar.js",
"version": "1.1.0",
"filename": "dollar.min.js",
"description": "A jQuery-compatible and non-All-in-One library which is more \"Zepto\" than Zepto.js.",
"homepage": "http://ozjs.org/DollarJS/",
"author": {
"name": "dexteryy",
"email": "dexter.yy@gmail.com",
"url": "http://github.com/dexteryy"
},
"repository": {
"type": "git",
"url": "git://github.com/dexteryy/DollarJS.git"
},
"licenses": [{
"type": "MIT",
"url": "http://www.opensource.org/licenses/mit-license.php"
}],
"keywords" : [
"AMD",
"oz",
"ozjs"
]
}