Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

compile

  • Loading branch information...
commit 991431c47aeb39e7af04b49b862768fea4befaef 1 parent 2b921d9
@vol4ok authored
Showing with 35 additions and 38 deletions.
  1. +35 −38 lib/core.js
View
73 lib/core.js
@@ -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;
}
@@ -1059,30 +1059,6 @@ var $ = Core;
};
})(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 ***/
/*!
@@ -1201,6 +1177,30 @@ var $ = Core;
};
})(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) {
Please sign in to comment.
Something went wrong with that request. Please try again.