MooTools's flaws

Source: Internet
Author: User

1 each method cannot break.

Example: Find the first even number in an array.

var myarr=[1,2,3,15,5,21,22];

var rs=0;www.hrbfc120.com

Myarr.each (function (VAL,IDX) {

if (val%2 ==0) {

Rs=val;

return; Return is not what I want, I want to be here convenient and quick to end each, what to do?

}

});

What I'm thinking now is throwing an exception with throw, and I don't know if you have a better solution.

(Of course, change the MOO source code can get a better solution)

The 2 element object has no SetValue method. www.120hrb.com

This comparison can not endure ah hehe, want to set the value of the page form field to do their own ways, do not understand why!

3 The HardCode in the Json.remote object.

See the code in this sentence people understand:

Send:function (obj) {

Return this.parent (This.url, ' json= ' + json.tostring (obj));

}

I want to use this method, the server can only accept JSON serialized string named JSON. It's too inflexible.

is 4 json.remote send should consider supporting the sending of multiple Json strings?

5. A bug in Class

var Class = function (properties) {

var klass = function () {

Return (Arguments[0]!== null && this.initialize && $type (this.initialize) = = ' function ')? This.initialize.apply (this, arguments): this;

};

$extend (Klass, this);

Klass.prototype = properties;

Klass.constructor = Class;

Return Klass;

};

var Class = function (properties) {

var klass = function () {

Return (Arguments[0]!== null && this.initialize && $type (this.initialize) = = ' function ')? This.initialize.apply (this, arguments): this;

};

$extend (Klass, this); www.hrbfkyy120.com

Klass.prototype = properties;

Klass.constructor = Class;

Return Klass;

};

If the first argument I'm going to pass is NULL, then the entire class mechanism will be invalidated.

For example, a class that constructs a method has two parameters, and he has a subclass subclass as well

When I create a subclass, I'm going to pass NULL if I construct the first parameter of the method.

Then the method of calling the parent class in the subclass will fail.

Modify the method to replace null with another special value.

In the new version of Moo, a moo-defined $empty

Arguments[0]!== $empty

MooTools's flaws

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.