tnhu / jsface

Small, fast, elegant, powerful, and cross platform JavaScript OOP library. Support main(), singleton, super call, private, mixins, plugins, AOP and more.
MIT License
301 stars 46 forks source link

issue Mixin with instance and Mixin with native classes #2

Closed luakri closed 12 years ago

luakri commented 12 years ago

hello Tannhu

i have tested the new files from git, and regarding the issue of ie7 and ie8 the page of unit tests displays no errors. my congrats.

thank for your work fixing the issue. once again my congrats for such a helpful library.

i have a file with your implementations of the api, the examples from the github and i have 2 issues

in all browsers

Mixin with instance:

var person = new Person("Rika", 20);

extend(person, Options);

console.log(person);

/* - inspecting in console age 20
name "Rika" $super function()
toString function() */

person.setOptions({ foo: true });

gives this error:

person.setOptions is not a function person.setOptions({ foo: true });

it appears that extends is not working, since it has no prop from the options class

another issue but only in ie7, ie8, works in ie9, ff, chrome, safari

regarding

Mixin with native classes:

extend(Array.prototype, { trim: function() { return this.replace(/^\s+|\s+$/g, ""); } });

" Hello World ".trim(); // "Hello World"

in ie7 and ie8

SCRIPT438: Object doesn't support property or method 'trim'

thank you very much

tnhu commented 12 years ago

Hi Luakri,

I fixed the first issue, also added some unit tests for it.

There's an copy-and-paste error in the README, the example should be:

extend(String.prototype, { trim: function() { return this.replace(/^\s+|\s+$/g, ""); } });

Thanks a lot for reporting! I really appreciate.

Tan

luakri commented 12 years ago

hello Tannhu

i am pleased to announce that i pulled from github the latest files, and regarding those 2 issues, it is solved. my deepest appreciation for quickly fixing those issues, and once more my congrats.

cheers