|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
617 bytes
|
| Line | |
|---|
| 1 | function propertyRemove(name) {
|
|---|
| 2 | return function() {
|
|---|
| 3 | delete this[name];
|
|---|
| 4 | };
|
|---|
| 5 | }
|
|---|
| 6 |
|
|---|
| 7 | function propertyConstant(name, value) {
|
|---|
| 8 | return function() {
|
|---|
| 9 | this[name] = value;
|
|---|
| 10 | };
|
|---|
| 11 | }
|
|---|
| 12 |
|
|---|
| 13 | function propertyFunction(name, value) {
|
|---|
| 14 | return function() {
|
|---|
| 15 | var v = value.apply(this, arguments);
|
|---|
| 16 | if (v == null) delete this[name];
|
|---|
| 17 | else this[name] = v;
|
|---|
| 18 | };
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | export default function(name, value) {
|
|---|
| 22 | return arguments.length > 1
|
|---|
| 23 | ? this.each((value == null
|
|---|
| 24 | ? propertyRemove : typeof value === "function"
|
|---|
| 25 | ? propertyFunction
|
|---|
| 26 | : propertyConstant)(name, value))
|
|---|
| 27 | : this.node()[name];
|
|---|
| 28 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.