fixed y-object polymer
This commit is contained in:
		
							parent
							
								
									4d926cf841
								
							
						
					
					
						commit
						b2c7706a2e
					
				
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -1,6 +1,4 @@ | |||||||
| var Y, bindToChildren; | var bindToChildren; | ||||||
| 
 |  | ||||||
| Y = require('./y'); |  | ||||||
| 
 | 
 | ||||||
| bindToChildren = function(that) { | bindToChildren = function(that) { | ||||||
|   var attr, i, j, ref; |   var attr, i, j, ref; | ||||||
| @ -52,7 +50,7 @@ Polymer("y-object", { | |||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   valChanged: function() { |   valChanged: function() { | ||||||
|     if ((this.val != null) && this.val.type === "Object") { |     if ((this.val != null) && this.val._name === "Object") { | ||||||
|       return bindToChildren(this); |       return bindToChildren(this); | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
| @ -68,11 +66,11 @@ Polymer("y-property", { | |||||||
|   ready: function() { |   ready: function() { | ||||||
|     if ((this.val != null) && (this.name != null)) { |     if ((this.val != null) && (this.name != null)) { | ||||||
|       if (this.val.constructor === Object) { |       if (this.val.constructor === Object) { | ||||||
|         this.val = this.parentElement.val(this.name, this.val).val(this.name); |         this.val = this.parentElement.val(this.name, new Y.Object(this.val)).val(this.name); | ||||||
|       } else if (typeof this.val === "string") { |       } else if (typeof this.val === "string") { | ||||||
|         this.parentElement.val(this.name, this.val); |         this.parentElement.val(this.name, this.val); | ||||||
|       } |       } | ||||||
|       if (this.val.type === "Object") { |       if (this.val._name === "Object") { | ||||||
|         return bindToChildren(this); |         return bindToChildren(this); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
| @ -81,8 +79,8 @@ Polymer("y-property", { | |||||||
|     var ref; |     var ref; | ||||||
|     if ((this.val != null) && (this.name != null)) { |     if ((this.val != null) && (this.name != null)) { | ||||||
|       if (this.val.constructor === Object) { |       if (this.val.constructor === Object) { | ||||||
|         return this.val = this.parentElement.val.val(this.name, this.val).val(this.name); |         return this.val = this.parentElement.val.val(this.name, new Y.Object(this.val)).val(this.name); | ||||||
|       } else if (this.val.type === "Object") { |       } else if (this.val._name === "Object") { | ||||||
|         return bindToChildren(this); |         return bindToChildren(this); | ||||||
|       } else if ((((ref = this.parentElement.val) != null ? ref.val : void 0) != null) && this.val !== this.parentElement.val.val(this.name)) { |       } else if ((((ref = this.parentElement.val) != null ? ref.val : void 0) != null) && this.val !== this.parentElement.val.val(this.name)) { | ||||||
|         return this.parentElement.val.val(this.name, this.val); |         return this.parentElement.val.val(this.name, this.val); | ||||||
|  | |||||||
| @ -30,7 +30,7 @@ | |||||||
|       var that = this; |       var that = this; | ||||||
|       this.connector.whenSynced(function(){ |       this.connector.whenSynced(function(){ | ||||||
|         if(that.y.val("text") == null){ |         if(that.y.val("text") == null){ | ||||||
|           that.y.val("text",Y.Text("stuff")); |           that.y.val("text",new Y.Text("stuff")); | ||||||
|         } |         } | ||||||
|         that.y.val("text").bind(that.$.text,that.shadowRoot) |         that.y.val("text").bind(that.$.text,that.shadowRoot) | ||||||
|       }) |       }) | ||||||
|  | |||||||
| @ -1,6 +1,4 @@ | |||||||
| 
 | 
 | ||||||
| Y = require './y' |  | ||||||
| 
 |  | ||||||
| bindToChildren = (that)-> | bindToChildren = (that)-> | ||||||
|   for i in [0...that.children.length] |   for i in [0...that.children.length] | ||||||
|     attr = that.children.item(i) |     attr = that.children.item(i) | ||||||
| @ -25,7 +23,7 @@ Polymer "y-object", | |||||||
|       bindToChildren @ |       bindToChildren @ | ||||||
| 
 | 
 | ||||||
|   valChanged: ()-> |   valChanged: ()-> | ||||||
|     if @val? and @val.type is "Object" |     if @val? and @val._name is "Object" | ||||||
|       bindToChildren @ |       bindToChildren @ | ||||||
| 
 | 
 | ||||||
|   connectorChanged: ()-> |   connectorChanged: ()-> | ||||||
| @ -37,23 +35,21 @@ Polymer "y-property", | |||||||
|   ready: ()-> |   ready: ()-> | ||||||
|     if @val? and @name? |     if @val? and @name? | ||||||
|       if @val.constructor is Object |       if @val.constructor is Object | ||||||
|         @val = @parentElement.val(@name,@val).val(@name) |         @val = @parentElement.val(@name,new Y.Object(@val)).val(@name) | ||||||
|         # TODO: please use instanceof instead of .type, |         # TODO: please use instanceof instead of ._name, | ||||||
|         # since it is more safe (consider someone putting a custom Object type here) |         # since it is more safe (consider someone putting a custom Object type here) | ||||||
|       else if typeof @val is "string" |       else if typeof @val is "string" | ||||||
|         @parentElement.val(@name,@val) |         @parentElement.val(@name,@val) | ||||||
|       if @val.type is "Object" |       if @val._name is "Object" | ||||||
|         bindToChildren @ |         bindToChildren @ | ||||||
| 
 | 
 | ||||||
|   valChanged: ()-> |   valChanged: ()-> | ||||||
|     if @val? and @name? |     if @val? and @name? | ||||||
|       if @val.constructor is Object |       if @val.constructor is Object | ||||||
|         @val = @parentElement.val.val(@name,@val).val(@name) |         @val = @parentElement.val.val(@name, new Y.Object(@val)).val(@name) | ||||||
|         # TODO: please use instanceof instead of .type, |         # TODO: please use instanceof instead of ._name, | ||||||
|         # since it is more safe (consider someone putting a custom Object type here) |         # since it is more safe (consider someone putting a custom Object type here) | ||||||
|       else if @val.type is "Object" |       else if @val._name is "Object" | ||||||
|         bindToChildren @ |         bindToChildren @ | ||||||
|       else if @parentElement.val?.val? and @val isnt @parentElement.val.val(@name) |       else if @parentElement.val?.val? and @val isnt @parentElement.val.val(@name) | ||||||
|         @parentElement.val.val @name, @val |         @parentElement.val.val @name, @val | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|  | |||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user