Skip to content

Commit

Permalink
Merge branch 'master' of yuisource.corp.yahoo.com:yui2
Browse files Browse the repository at this point in the history
  • Loading branch information
msweeney committed Feb 24, 2011
2 parents 9d23bf3 + 448c9bb commit c1bf78d
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 55 deletions.
2 changes: 1 addition & 1 deletion build/yahoo/yahoo-debug.js
Expand Up @@ -1095,7 +1095,7 @@ return (o && (typeof o === 'object' || L.isFunction(o))) || false;
throw new TypeError("method undefined");
}

if (d && !L.isArray(d)) {
if (!L.isUndefined(data) && !L.isArray(d)) {
d = [data];
}

Expand Down
2 changes: 1 addition & 1 deletion build/yahoo/yahoo-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/yahoo/yahoo.js
Expand Up @@ -1095,7 +1095,7 @@ return (o && (typeof o === 'object' || L.isFunction(o))) || false;
throw new TypeError("method undefined");
}

if (d && !L.isArray(d)) {
if (!L.isUndefined(data) && !L.isArray(d)) {
d = [data];
}

Expand Down
22 changes: 11 additions & 11 deletions sandbox/yahoo/lang.html
Expand Up @@ -11,7 +11,7 @@
<script src = "../../build/logger/logger.js" ></script>
<script type="text/javascript">

YAHOO.widget.Logger.enableBrowserConsole()
YAHOO.widget.Logger.enableBrowserConsole()
var l = new YAHOO.widget.LogWriter("(");

YAHOO.example.LangTest = function() {
Expand All @@ -22,23 +22,23 @@

var tests = {

"An array literal is an array":
"An array literal is an array":
YAHOO.lang.isArray([1, 2]),

"An object literal is not an array":
"An object literal is not an array":
!YAHOO.lang.isArray({"one": "two"}),

"But, an associative array is an array":
"But, an associative array is an array":
function() {
var a = new Array();
a["one"] = "two";
return YAHOO.lang.isArray(a);
}(),

"A collection of elements is like an array, but isn't":
"A collection of elements is like an array, but isn't":
!YAHOO.lang.isArray(document.getElementsByTagName("body")),

"null is not an array":
"null is not an array":
!YAHOO.lang.isArray(null),

"True/false is a boolean":
Expand Down Expand Up @@ -106,13 +106,13 @@

"a number is not a string":
!YAHOO.lang.isString(123),

"a boolean is not a string":
!YAHOO.lang.isString(true),

"undefined is undefined***":
YAHOO.lang.isUndefined(undefined),

"false is not undefined":
!YAHOO.lang.isUndefined(false),

Expand All @@ -121,7 +121,7 @@

}

return {
return {
init: function() {

alert(typeof null);
Expand Down Expand Up @@ -159,7 +159,7 @@

</script>
</head>
<body><style>.dd {position:absolute; height:50px; width:50px; border:1px solid green}
<body><style>.dd {position:absolute; height:50px; width:50px; border:1px solid green}
#ddel1 {top: 100px; left: 100px; background: red}
#ddel2 {top: 100px; left: 200px; background: red}
#ddel3 {top: 200px; left: 100px; background: blue}
Expand Down
65 changes: 25 additions & 40 deletions sandbox/yahoo/later.html
@@ -1,54 +1,39 @@
<html>
<head>
<script src="../src/js/YAHOO.js" type="text/javascript"></script>
<script src="../src/js/Env.js" type="text/javascript"></script>
<script src="../src/js/Lang.js" type="text/javascript"></script>
<script src="../../build/event/event.js" type="text/javascript"></script>
<script src="../../build/dom/dom.js" type="text/javascript"></script>
<script src="../../build/logger/logger.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="../../build/logger/assets/skins/sam/logger.css" />
</head>
<body class="yui-skin-sam">
<script>

new YAHOO.widget.LogReader();
var count = 0, timer, r=null, f=null, m=null;

function fn(data) {
if (count++ > 5) {
YAHOO.log("fn cancel");
timer.cancel();
} else {
YAHOO.log("fn executed with " + YAHOO.lang.dump(arguments));
}
<script src="../../build/yahoo/yahoo.js" type="text/javascript"></script>
<script>

function accumulator() {
this.sum = 0;
}

accumulator.prototype.add = function(addEnd) { // Adds one number
this.sum += addEnd;
}

function aggregator() {
aggregator.superclass.constructor.apply(this, arguments);
}

var Obj = function(a) {
this.a = a;
this.count = 0;
};

Obj.prototype.doit = function(stuff) {
if (this.count++ > 5) {
YAHOO.log("Obj.doit " + this.a + " canceled");
this.timer.cancel();
} else {
YAHOO.log("Obj.doit " + this.a + ", stuff: " + YAHOO.lang.dump(arguments) + ", count: " + this.count);
YAHOO.extend(aggregator, accumulator, {
add: function() { // Adds many numbers
for (var i = 0; i < arguments.length; i++) {
aggregator.superclass.add.call(this, arguments[i]);
}
}
};
});

YAHOO.lang.later(0, window, fn, "test timeout 1");

YAHOO.lang.later(0, null, fn, "test timeout 2");

//timer = YAHOO.lang.later(1000, window, fn, "lo", true);

var o = new Obj("test interval 1");
o.timer = YAHOO.lang.later(100, o, "doit", "arg1", true);
var calculator = new aggregator();
calculator.add(5, 7, 4);
alert(calculator.sum); // Displays "16"

var o = new Obj("test interval 2");
o.timer = YAHOO.lang.later(100, o, o.doit, ["arg1", "arg2"], true);
YAHOO.lang.later(1, null, function(x){alert(x)}, 0)

</script>
</head>
<body>
</body>
</html>
2 changes: 1 addition & 1 deletion src/yahoo/js/Lang.js
Expand Up @@ -533,7 +533,7 @@ return (o && (typeof o === 'object' || L.isFunction(o))) || false;
throw new TypeError("method undefined");
}

if (d && !L.isArray(d)) {
if (!L.isUndefined(data) && !L.isArray(d)) {
d = [data];
}

Expand Down

0 comments on commit c1bf78d

Please sign in to comment.