dcl.delegate()
Version 1.x
This is a utility function that facilitates a delegation from one object to another bypassing a constructor.
It is used inside dcl
and exposed because it is frequently required by user’s code.
Description
It creates an empty object with a desired prototypal inheritance. All missing properties will be delegated.
The best way to describe dcl.delegate()
is to give its definition:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Notes
dcl.delegate()
is a first half of
Object.create(),
which is defined in ECMAScript 5, and supported by all modern browsers. Unfortunately IE supports it starting from IE9,
so dcl
carries this manual implementation to support previous IE browsers.