Permalink
Browse files

compile

  • Loading branch information...
vol4ok committed Mar 30, 2012
1 parent 2b921d9 commit 991431c47aeb39e7af04b49b862768fea4befaef
Showing with 35 additions and 38 deletions.
  1. +35 −38 lib/core.js
View
@@ -24,7 +24,7 @@ var Core = (function() {
$.extend = function(target) {
$.slice.call(arguments, 1).forEach(function(source) {
for (key in source) target[key] = source[key];
- })
+ });
return target;
}
@@ -1058,30 +1058,6 @@ var $ = Core;
return num === 0 && ''+str !== '0' ? Number.NaN : num;
};
-})(Core);
-/*** MISC.JS ***/
-
-(function($){
-
- $.guid = function() {
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
- var
- r = Math.random() * 16 | 0,
- v = c === 'x' ? r : r & 3 | 8;
- return v.toString(16);
- }).toUpperCase();
- };
-
- var idCounter = 0;
- $.uniqId = function(prefix) {
- var id = idCounter++;
- return prefix ? prefix + id : id;
- };
-
-
- $.noop = function(){};
- $.identity = function(value) { return value; };
-
})(Core);
/*** ASYNC.JS ***/
@@ -1200,6 +1176,30 @@ var $ = Core;
}, callback);
};
+})(Core);
+/*** MISC.JS ***/
+
+(function($){
+
+ $.guid = function() {
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
+ var
+ r = Math.random() * 16 | 0,
+ v = c === 'x' ? r : r & 3 | 8;
+ return v.toString(16);
+ }).toUpperCase();
+ };
+
+ var idCounter = 0;
+ $.uniqId = function(prefix) {
+ var id = idCounter++;
+ return prefix ? prefix + id : id;
+ };
+
+
+ $.noop = function(){};
+ $.identity = function(value) { return value; };
+
})(Core);
/*** DOM.JS ***/
@@ -1219,6 +1219,7 @@ var $ = Core;
, uniq = $.uniq
, slice = $.slice
, compact = $.compact
+ , flatten = $.flatten
, pluck = $.pluck
, map = $.map
, isFunction = $.isFunction
@@ -1228,6 +1229,7 @@ var $ = Core;
$.Dom = (function(Core) {
var document = window.document
+ , emptyArray = []
, getComputedStyle = document.defaultView.getComputedStyle
, elementTypes = [1, 9, 11] //ELEMENT_NODE, DOCUMENT_NODE, DOCUMENT_FRAGMENT_NODE
, classSelectorRE = /^\.([\w-]+)$/
@@ -1358,9 +1360,9 @@ var $ = Core;
},
children: function(selector) {
- return filtered(this.map(function(){
+ return filtered(flatten(this.map(function(){
return slice.call(this.children);
- }), selector);
+ })), selector);
},
parent: function(selector) {
@@ -1587,7 +1589,12 @@ var $ = Core;
},
data: function(name, value) {
- return this.attr('data-' + name, value);
+ var d = this[0].dataset;
+ if (value === undefined)
+ return name === undefined ? d : d[name];
+ else
+ d[name] = value;
+ return this;
},
val: function() {
@@ -1995,16 +2002,6 @@ var $ = Core;
return this;
};
});
-
- // each({mouseenter: "mouseover", mouseleave: "mouseout"}, function(fixed, orig) {
- // Dom.fn[orig] = function(callback) {
- // return this.on(fixed, function(event){
- // var related = event.relatedTarget;
- // if (!related || (related !== this && !this.contains(related)))
- // return callback.apply( this, arguments );
- // });
- // };
- // });
Event = Dom.Event = function(type, props) {

0 comments on commit 991431c

Please sign in to comment.