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; | ||||
| 
 | ||||
| Y = require('./y'); | ||||
| var bindToChildren; | ||||
| 
 | ||||
| bindToChildren = function(that) { | ||||
|   var attr, i, j, ref; | ||||
| @ -52,7 +50,7 @@ Polymer("y-object", { | ||||
|     } | ||||
|   }, | ||||
|   valChanged: function() { | ||||
|     if ((this.val != null) && this.val.type === "Object") { | ||||
|     if ((this.val != null) && this.val._name === "Object") { | ||||
|       return bindToChildren(this); | ||||
|     } | ||||
|   }, | ||||
| @ -68,11 +66,11 @@ Polymer("y-property", { | ||||
|   ready: function() { | ||||
|     if ((this.val != null) && (this.name != null)) { | ||||
|       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") { | ||||
|         this.parentElement.val(this.name, this.val); | ||||
|       } | ||||
|       if (this.val.type === "Object") { | ||||
|       if (this.val._name === "Object") { | ||||
|         return bindToChildren(this); | ||||
|       } | ||||
|     } | ||||
| @ -81,8 +79,8 @@ Polymer("y-property", { | ||||
|     var ref; | ||||
|     if ((this.val != null) && (this.name != null)) { | ||||
|       if (this.val.constructor === Object) { | ||||
|         return this.val = this.parentElement.val.val(this.name, this.val).val(this.name); | ||||
|       } else if (this.val.type === "Object") { | ||||
|         return this.val = this.parentElement.val.val(this.name, new Y.Object(this.val)).val(this.name); | ||||
|       } else if (this.val._name === "Object") { | ||||
|         return bindToChildren(this); | ||||
|       } 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); | ||||
|  | ||||
| @ -30,7 +30,7 @@ | ||||
|       var that = this; | ||||
|       this.connector.whenSynced(function(){ | ||||
|         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) | ||||
|       }) | ||||
|  | ||||
| @ -1,6 +1,4 @@ | ||||
| 
 | ||||
| Y = require './y' | ||||
| 
 | ||||
| bindToChildren = (that)-> | ||||
|   for i in [0...that.children.length] | ||||
|     attr = that.children.item(i) | ||||
| @ -25,7 +23,7 @@ Polymer "y-object", | ||||
|       bindToChildren @ | ||||
| 
 | ||||
|   valChanged: ()-> | ||||
|     if @val? and @val.type is "Object" | ||||
|     if @val? and @val._name is "Object" | ||||
|       bindToChildren @ | ||||
| 
 | ||||
|   connectorChanged: ()-> | ||||
| @ -37,23 +35,21 @@ Polymer "y-property", | ||||
|   ready: ()-> | ||||
|     if @val? and @name? | ||||
|       if @val.constructor is Object | ||||
|         @val = @parentElement.val(@name,@val).val(@name) | ||||
|         # TODO: please use instanceof instead of .type, | ||||
|         @val = @parentElement.val(@name,new Y.Object(@val)).val(@name) | ||||
|         # TODO: please use instanceof instead of ._name, | ||||
|         # since it is more safe (consider someone putting a custom Object type here) | ||||
|       else if typeof @val is "string" | ||||
|         @parentElement.val(@name,@val) | ||||
|       if @val.type is "Object" | ||||
|       if @val._name is "Object" | ||||
|         bindToChildren @ | ||||
| 
 | ||||
|   valChanged: ()-> | ||||
|     if @val? and @name? | ||||
|       if @val.constructor is Object | ||||
|         @val = @parentElement.val.val(@name,@val).val(@name) | ||||
|         # TODO: please use instanceof instead of .type, | ||||
|         @val = @parentElement.val.val(@name, new Y.Object(@val)).val(@name) | ||||
|         # TODO: please use instanceof instead of ._name, | ||||
|         # 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 @ | ||||
|       else if @parentElement.val?.val? and @val isnt @parentElement.val.val(@name) | ||||
|         @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