remove childValue

for <a:button>text</a:button> button.caption and
contents of the text node will not be automatically syncronized
pull/428/merge
nightwing 2017-04-15 23:20:25 +04:00
rodzic 0abea800c5
commit 036fb7585e
3 zmienionych plików z 8 dodań i 101 usunięć

Wyświetl plik

@ -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, "");
});
};

Wyświetl plik

@ -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";

Wyświetl plik

@ -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;