From 036fb7585e69256ed5ec393f7422b853ac7c5f0e Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 15 Apr 2017 23:20:25 +0400 Subject: [PATCH] remove childValue for text button.caption and contents of the text node will not be automatically syncronized --- plugins/c9.ide.ui/lib/dropdown.js | 80 ------------------------------ plugins/c9.ide.ui/lib/menu/menu.js | 2 - plugins/c9.ide.ui/lib_apf.js | 27 +++------- 3 files changed, 8 insertions(+), 101 deletions(-) diff --git a/plugins/c9.ide.ui/lib/dropdown.js b/plugins/c9.ide.ui/lib/dropdown.js index d0baf00f..d1f1774f 100644 --- a/plugins/c9.ide.ui/lib/dropdown.js +++ b/plugins/c9.ide.ui/lib/dropdown.js @@ -3,86 +3,6 @@ return function(apf) { apf.StandardBinding = apf.Presentation; apf.MultiSelect = apf.StandardBinding; -apf.__CHILDVALUE__ = 1 << 27; - - -apf.ChildValue = function(){ - if (!this.$childProperty) - this.$childProperty = "value"; - - this.$regbase = this.$regbase | apf.__CHILDVALUE__; - - var f, re = /^[\s\S]*?>(<\?lm)?([\s\S]*?)(?:\?>)?<[^>]*?>$/; - this.addEventListener("DOMCharacterDataModified", f = function(e) { - if (e && (e.currentTarget == this - || e.currentTarget.nodeType == 2 && e.relatedNode == this) - || this.$amlDestroyed) - return; - - if (this.getAttribute(this.$childProperty)) - return; - - //Get value from xml (could also serialize children, but that is slower - var m = this.serialize().match(re), - v = m && m[2] || ""; - if (m && m[1]) - v = "{" + v + "}"; - - this.$norecur = true; - - - if (this[this.$childProperty] != v) - this.setProperty(this.$childProperty, v); - - this.$norecur = false; - }); - - //@todo Should be buffered - this.addEventListener("DOMAttrModified", f); - this.addEventListener("DOMNodeInserted", f); - this.addEventListener("DOMNodeRemoved", f); - - this.addEventListener("$skinchange", function(e) { - this.$propHandlers[this.$childProperty].call(this, this.caption || ""); - }); - - this.$init(function() { - this.addEventListener("prop." + this.$childProperty, function(e) { - if (!this.$norecur && !e.value && !this.hasAttribute(this.$childProperty)) - f.call(this); - }); - }); - - this.addEventListener("DOMNodeInsertedIntoDocument", function(e) { - var hasNoProp = typeof this[this.$childProperty] == "undefined"; - - //this.firstChild.nodeType != 7 && - if (hasNoProp - && !this.getElementsByTagNameNS(this.namespaceURI, "*", true).length - && (this.childNodes.length > 1 || this.firstChild - && (this.firstChild.nodeType == 1 - || this.firstChild.nodeValue.trim().length))) { - //Get value from xml (could also serialize children, but that is slower - var m = (this.$aml && this.$aml.xml || this.serialize()).match(re), - v = m && m[2] || ""; - if (m && m[1]) - v = "{" + v + "}"; - - this.setProperty(this.$childProperty, apf.html_entity_decode(v)); //@todo should be xml entity decode - } - else if (hasNoProp) - this.$propHandlers[this.$childProperty].call(this, ""); - }); -}; - - - - - - - - - diff --git a/plugins/c9.ide.ui/lib/menu/menu.js b/plugins/c9.ide.ui/lib/menu/menu.js index 1118e70e..59c40752 100644 --- a/plugins/c9.ide.ui/lib/menu/menu.js +++ b/plugins/c9.ide.ui/lib/menu/menu.js @@ -1030,7 +1030,6 @@ apf.divider = function(struct, tagName) { this.minwidth = 0; this.minheight = 0; - this.implement(apf.ChildValue); this.$childProperty = "caption"; //@todo apf3.0 fix this @@ -1126,7 +1125,6 @@ apf.item = function(struct, tagName) { (function() { this.$focussable = false; - this.implement(apf.ChildValue); this.$childProperty = "caption"; this.$canLeechSkin = "item"; diff --git a/plugins/c9.ide.ui/lib_apf.js b/plugins/c9.ide.ui/lib_apf.js index 07ebfc5f..8326763f 100644 --- a/plugins/c9.ide.ui/lib_apf.js +++ b/plugins/c9.ide.ui/lib_apf.js @@ -7147,7 +7147,9 @@ apf.AmlText = function(isPrototype) { this.addEventListener("DOMNodeInsertedIntoDocument", function(e) { var pHtmlNode; - if (!(pHtmlNode = this.parentNode.$int) || this.parentNode.hasFeature(apf.__CHILDVALUE__)) + if (this.parentNode.$childProperty) + return this.parentNode.setAttribute(this.parentNode.$childProperty, this.nodeValue) + if (!(pHtmlNode = this.parentNode.$int)) return; this.$amlLoaded = true; @@ -9849,9 +9851,6 @@ apf.BaseButton = function(){ (function() { - this.implement(apf.ChildValue); - - this.$refKeyDown = // Number of keys pressed. this.$refMouseDown = 0; // Mouse button down? this.$mouseOver = // Mouse hovering over the button? @@ -14004,8 +14003,8 @@ apf.button = function(struct, tagName) { }; this.$propHandlers["caption"] = function(value) { - if (!this.oCaption) - return; + // if (!this.oCaption) + // return; if (value) this.$setStyleClass(this.$ext, "", [this.$baseCSSname + "Empty"]); @@ -14293,6 +14292,9 @@ apf.button = function(struct, tagName) { this.$ext = this.$getExternal(); this.oIcon = this.$getLayoutNode("main", "icon", this.$ext); this.oCaption = this.$getLayoutNode("main", "caption", this.$ext); + + if (this.oCaption.nodeValue && !this.caption) + this.$propHandlers["caption"].call(this, ""); this.$useExtraDiv = apf.isTrue(this.$getOption("main", "extradiv")); if (!apf.button.$extradiv && this.$useExtraDiv) { @@ -15230,10 +15232,6 @@ apf.label = function(struct, tagName) { }; (function(){ - this.implement( - apf.ChildValue - ); - var _self = this; this.$focussable = false; @@ -15326,10 +15324,6 @@ apf.colorbox = function(struct, tagName) { }; (function(){ - this.implement( - apf.ChildValue - ); - var _self = this; this.$focussable = false; @@ -16790,7 +16784,6 @@ apf.radiobutton = function(struct, tagName) { }; (function(){ - this.implement(apf.ChildValue); this.$childProperty = "label"; this.$focussable = apf.KEYBOARD; // This object can get the focus @@ -18135,10 +18128,6 @@ apf.text = function(struct, tagName) { }; (function(){ - this.implement( - - apf.ChildValue - ); this.$focussable = true; // This object can't get the focus this.focussable = false;