Permalink
Browse files

Merge branch 'master' of github.com:enyojs/enyo

  • Loading branch information...
2 parents 1134f75 + 32171a5 commit 4bd2eb83fd37ea0308b177085a7dba21bc89a66b Scott Miles committed Apr 17, 2012
View
@@ -210,14 +210,14 @@
//
// e.g. foo/bar/baz/lib/zot -> zot package
//
- for (var i=parts.length-1, p; p=parts[i]; i--) {
+ for (i=parts.length-1, p; p=parts[i]; i--) {
if (p == "lib" || p == "enyo") {
parts = parts.slice(i+1);
break;
}
}
// remove ".." and "."
- for (var i=parts.length-1, p; p=parts[i]; i--) {
+ for (i=parts.length-1, p; p=parts[i]; i--) {
if (p == ".." || p == ".") {
parts.splice(i, 1);
}
View
@@ -87,7 +87,7 @@ enyo.dispatcher = {
// called in the context of an event
enyo.iePreventDefault = function() {
this.returnValue = false;
-}
+};
enyo.dispatch = function(inEvent) {
return enyo.dispatcher.dispatch(inEvent);
View
@@ -36,6 +36,8 @@ button {
cursor: default;
-webkit-user-select: none;
-moz-user-select: -moz-none;
+ -ms-user-select: -moz-none;
+ user-select: none;
}
.enyo-unselectabe::selection,.enyo-unselectable ::selection {
@@ -46,6 +48,8 @@ button {
cursor: auto;
-webkit-user-select: text;
-moz-user-select: text;
+ -ms-user-select: text;
+ user-select: text;
}
.enyo-selectable::selection, .enyo-selectable ::selection {
@@ -68,9 +72,9 @@ body .enyo-fit {
}
.enyo-border-box {
- box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
+ box-sizing: border-box;
}
/* compositing */
@@ -79,4 +83,6 @@ body .enyo-fit {
-webkit-transform: translateZ(0);
-moz-transform: translateZ(0);
-ms-transform: translateZ(0);
+ -o-transform: translateZ(0);
+ transform: translateZ(0);
}
View
@@ -119,14 +119,14 @@ enyo.gesture.preventDefault = function() {
if (this.srcEvent) {
this.srcEvent.preventDefault();
}
-}
+};
enyo.gesture.disablePrevention = function() {
this.preventDefault = enyo.nop;
if (this.srcEvent) {
this.srcEvent.preventDefault = enyo.nop;
}
-}
+};
enyo.dispatcher.features.push(
function(e) {
@@ -257,10 +257,10 @@ enyo.kind({
nameComponent: function(inComponent) {
var prefix = enyo.Component.prefixFromKindName(inComponent.kindName);
// get last memoized name index
- var i = this._componentNameMap[prefix] || 0;
+ var n, i = this._componentNameMap[prefix] || 0;
// find an available name
do {
- var n = prefix + (++i > 1 ? String(i) : "");
+ n = prefix + (++i > 1 ? String(i) : "");
} while (this.$[n]);
// memoize next likely-unique id tag for this prefix
this._componentNameMap[prefix] = Number(i);
View
@@ -144,9 +144,10 @@ enyo.kind = function(inProps) {
enyo.kind.makeCtor = function() {
return function() {
// two-pass instantiation
+ var result;
if (this._constructor) {
// pure construction
- var result = this._constructor.apply(this, arguments);
+ result = this._constructor.apply(this, arguments);
}
// defer initialization until entire constructor chain has finished
if (this.constructed) {
@@ -8,7 +8,7 @@
};
var _cancelFrame = function(inId) {
return window.clearTimeout(inId);
- }
+ };
for (var i = 0, pl = prefix.length, p, wc, wr; (p = prefix[i]) || i < pl; i++) {
// if prefixed, becomes Request and Cancel
wc = p ? (p + enyo.cap(c)) : c;
@@ -79,7 +79,9 @@ enyo.easing = {
/**
Gives an interpolation of an animated transition's distance from 0 to 1.
- Given a start time (_inT0_) and an animation duration (_inDuration_), applies the _inEasing_ function to the percentage of time elapsed / duration, capped at 100%.
+ Given a start time (_inT0_) and an animation duration (_inDuration_), applies
+ the _inEasing_ function to the percentage of time elapsed / duration, capped
+ at 100%.
*/
enyo.easedLerp = function(inT0, inDuration, inEasing) {
var lerp = (enyo.now() - inT0) / inDuration;
View
@@ -156,7 +156,7 @@
var results = [];
var add = function(e, i, a) {
results.push(inFunc.call(c, e, i, a));
- }
+ };
enyo.forEach(inArray, add, c);
return results;
}
View
@@ -8,7 +8,7 @@ enyo.logging = {
levels: {log: 20, warn: 10, error: 0},
// return true if logging level is lower than the current log level
shouldLog: function(inMethod) {
- var ll = parseInt(this.levels[inMethod]);
+ var ll = parseInt(this.levels[inMethod], 0);
return (ll <= this.level);
},
/*
@@ -61,7 +61,7 @@ enyo.logging = {
Setting the log level lower will prevent logging functions with a higher level from being executed.
*/
enyo.setLogLevel = function(inLevel) {
- var ll = parseInt(inLevel);
+ var ll = parseInt(inLevel, 0);
if (isFinite(ll)) {
enyo.logging.level = ll;
}
@@ -66,4 +66,4 @@ enyo.quickMacroize = function(inText, inMap, inPattern) {
//* @protected
// matches macros of form {$name}
-enyo.macroize.pattern = /{\$([^{}]*)}/g;
+enyo.macroize.pattern = /\{\$([^{}]*)\}/g;
@@ -128,11 +128,11 @@ enyo.kind({
this.canVertical = sb.maxTop > 0 && this.vertical != "hidden";
this.canHorizontal = sb.maxLeft > 0 && this.horizontal != "hidden";
this.startEdges = {
- top: y == 0,
- bottom: y == sb.maxTop,
- left: x == 0,
- right: x == sb.maxLeft
- }
+ top: y === 0,
+ bottom: y === sb.maxTop,
+ left: x === 0,
+ right: x === sb.maxLeft
+ };
},
// NOTE: down, move, and drag handlers are needed only for native touch scrollers
shouldDrag: function(inEvent) {
View
@@ -1,7 +1,7 @@
.enyo-thumb {
position: absolute;
- box-sizing: border-box;
-moz-box-sizing: border-box;
+ box-sizing: border-box;
border-radius: 4px;
background: #333;
border: 1px solid #666;
View
@@ -5,8 +5,8 @@
classes: "enyo-thumb",
axis: "v",
create: function() {
- this.inherited(arguments)
- var v = this.axis == "v";;
+ this.inherited(arguments);
+ var v = this.axis == "v";
this.dimension = v ? "height" : "width";
this.offset = v ? "top" : "left";
this.translation = v ? "translateY" : "translateX";
@@ -24,13 +24,13 @@
update: function(inStrategy) {
var d = this.dimension, o = this.offset;
var bd = this.scrollBounds[this.sizeDimension], sbd = this.scrollBounds[d];
- var overs = 0, overp = 0, over=0;
+ var overs = 0, overp = 0, over = 0;
if (bd >= sbd) {
this.hide();
return;
}
if (inStrategy.isOverscrolling()) {
- var over = inStrategy.getOverScrollBounds()["over" + o];
+ over = inStrategy.getOverScrollBounds()["over" + o];
overs = Math.abs(over);
overp = Math.max(over, 0);
}
@@ -122,7 +122,7 @@ enyo.kind({
},
scrollTo: function(inX, inY) {
this.stop();
- this.$.scrollMath.scrollTo(inY || inY == 0 ? inY : null, inX);
+ this.$.scrollMath.scrollTo(inY || inY === 0 ? inY : null, inX);
},
scrollIntoView: function() {
this.stop();
@@ -1,6 +1,9 @@
<?php
$method = @$_SERVER['REQUEST_METHOD'];
switch ($method) {
+ case 'GET':
+ get();
+ break;
case 'POST':
post();
break;
@@ -14,6 +17,11 @@
echo "invalid method";
}
+function get() {
+ $result = array('status' => "get");
+ echo json_encode($result);
+}
+
function post() {
$q = @$_POST['query'];
if ($q) {
@@ -29,7 +37,8 @@ function post() {
}
function put() {
- $result = array('status' => "put");
+ $c = @$_SERVER["CONTENT_TYPE"];
+ $result = array('status' => "put", 'ctype' => $c);
echo json_encode($result);
}
@@ -2,7 +2,7 @@ enyo.kind({
name: "AjaxTest",
kind: enyo.TestSuite,
_testAjax: function(inProps, inParams, inAssertFn) {
- new enyo.Ajax(inProps)
+ return new enyo.Ajax(inProps)
.response(this, function(inSender, inValue) {
this.finish(inAssertFn.call(null, inValue) ? "" : "bad response: " + inValue);
})
@@ -55,6 +55,22 @@ enyo.kind({
return inValue.response == "This is a test.";
});
},
+ testContentType: function() {
+ var contentType = "text/plain"
+ this._testAjax({url: "php/test2.php", method: "PUT", contentType: contentType}, null, function(inValue) {
+ return inValue.ctype == contentType;
+ });
+ },
+ testXhrStatus: function() {
+ var ajax = this._testAjax({url: "php/test2.php"}, null, function(inValue) {
+ return ajax.xhr.status == 200;
+ });
+ },
+ testXhrFields: function() {
+ var ajax = this._testAjax({url: "php/test2.php", xhrFields: {withCredentials: true}}, null, function(inValue) {
+ return ajax.xhr.withCredentials;
+ });
+ },
// test CORS (Cross-Origin Resource Sharing) by testing against youtube api
testCORS: function() {
this._testAjax({url: "http://gdata.youtube.com/feeds/api/videos/"}, {q: "waterfall", alt: "json", format: 5}, function(inValue) {

0 comments on commit 4bd2eb8

Please sign in to comment.