@@ -64,44 +64,6 @@ $.extend(Model.prototype, /** @lends Model.prototype */ {
64
64
}
65
65
} ) ;
66
66
67
- /**
68
- * Defines properties on an Node prototype with getter and setter.<br>
69
- * Update events are emitted in the setter through root Model (if any).<br>
70
- * The object must have a `__` object, non enumerable property to store values.
71
- * @param {function } obj
72
- * @param {string[] } fields
73
- */
74
- Model . defineModelProperties = function ( obj , fields ) {
75
- fields . forEach ( function ( field ) {
76
- Object . defineProperty ( obj . prototype , field , {
77
- enumerable : true ,
78
- get : function ( ) {
79
- return this . __ [ field ] ;
80
- } ,
81
- set : function ( value ) {
82
- var previousValue = ( this . __ [ field ] !== null && typeof this . __ [ field ] == 'object' ) ?
83
- $ . extend ( { } , this . __ [ field ] ) :
84
- this . __ [ field ] ;
85
-
86
- this . __ [ field ] = value ;
87
-
88
- if ( this . model !== null ) {
89
- /**
90
- * After a value of the model changed
91
- * @event model:update
92
- * @memberof Model
93
- * @param {Node } node
94
- * @param {string } field
95
- * @param {* } value
96
- * @param {* } previousValue
97
- */
98
- this . model . trigger ( 'update' , this , field , value , previousValue ) ;
99
- }
100
- }
101
- } ) ;
102
- } ) ;
103
- } ;
104
-
105
67
106
68
/**
107
69
* Root abstract object
@@ -177,7 +139,7 @@ var Node = function(parent, $el) {
177
139
this . parent = parent ;
178
140
} ;
179
141
180
- Model . defineModelProperties ( Node , [ 'level' , 'error' , 'data' , 'flags' ] ) ;
142
+ Utils . defineModelProperties ( Node , [ 'level' , 'error' , 'data' , 'flags' ] ) ;
181
143
182
144
Object . defineProperty ( Node . prototype , 'parent' , {
183
145
enumerable : true ,
@@ -340,7 +302,7 @@ var Group = function(parent, $el) {
340
302
Group . prototype = Object . create ( Node . prototype ) ;
341
303
Group . prototype . constructor = Group ;
342
304
343
- Model . defineModelProperties ( Group , [ 'condition' ] ) ;
305
+ Utils . defineModelProperties ( Group , [ 'condition' ] ) ;
344
306
345
307
/**
346
308
* Removes group's content
@@ -561,7 +523,7 @@ var Rule = function(parent, $el) {
561
523
Rule . prototype = Object . create ( Node . prototype ) ;
562
524
Rule . prototype . constructor = Rule ;
563
525
564
- Model . defineModelProperties ( Rule , [ 'filter' , 'operator' , 'value' ] ) ;
526
+ Utils . defineModelProperties ( Rule , [ 'filter' , 'operator' , 'value' ] ) ;
565
527
566
528
/**
567
529
* Checks if this Node is the root
0 commit comments