@@ -64,44 +64,6 @@ $.extend(Model.prototype, /** @lends Model.prototype */ {
6464 }
6565} ) ;
6666
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-
10567
10668/**
10769 * Root abstract object
@@ -177,7 +139,7 @@ var Node = function(parent, $el) {
177139 this . parent = parent ;
178140} ;
179141
180- Model . defineModelProperties ( Node , [ 'level' , 'error' , 'data' , 'flags' ] ) ;
142+ Utils . defineModelProperties ( Node , [ 'level' , 'error' , 'data' , 'flags' ] ) ;
181143
182144Object . defineProperty ( Node . prototype , 'parent' , {
183145 enumerable : true ,
@@ -340,7 +302,7 @@ var Group = function(parent, $el) {
340302Group . prototype = Object . create ( Node . prototype ) ;
341303Group . prototype . constructor = Group ;
342304
343- Model . defineModelProperties ( Group , [ 'condition' ] ) ;
305+ Utils . defineModelProperties ( Group , [ 'condition' ] ) ;
344306
345307/**
346308 * Removes group's content
@@ -561,7 +523,7 @@ var Rule = function(parent, $el) {
561523Rule . prototype = Object . create ( Node . prototype ) ;
562524Rule . prototype . constructor = Rule ;
563525
564- Model . defineModelProperties ( Rule , [ 'filter' , 'operator' , 'value' ] ) ;
526+ Utils . defineModelProperties ( Rule , [ 'filter' , 'operator' , 'value' ] ) ;
565527
566528/**
567529 * Checks if this Node is the root
0 commit comments