kopia lustrzana https://github.com/c9/core
remove childValue
for <a:button>text</a:button> button.caption and contents of the text node will not be automatically syncronizedpull/428/merge
rodzic
0abea800c5
commit
036fb7585e
|
@ -3,86 +3,6 @@ return function(apf) {
|
||||||
|
|
||||||
apf.StandardBinding = apf.Presentation;
|
apf.StandardBinding = apf.Presentation;
|
||||||
apf.MultiSelect = apf.StandardBinding;
|
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, "");
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1030,7 +1030,6 @@ apf.divider = function(struct, tagName) {
|
||||||
this.minwidth = 0;
|
this.minwidth = 0;
|
||||||
this.minheight = 0;
|
this.minheight = 0;
|
||||||
|
|
||||||
this.implement(apf.ChildValue);
|
|
||||||
this.$childProperty = "caption";
|
this.$childProperty = "caption";
|
||||||
|
|
||||||
//@todo apf3.0 fix this
|
//@todo apf3.0 fix this
|
||||||
|
@ -1126,7 +1125,6 @@ apf.item = function(struct, tagName) {
|
||||||
(function() {
|
(function() {
|
||||||
this.$focussable = false;
|
this.$focussable = false;
|
||||||
|
|
||||||
this.implement(apf.ChildValue);
|
|
||||||
this.$childProperty = "caption";
|
this.$childProperty = "caption";
|
||||||
this.$canLeechSkin = "item";
|
this.$canLeechSkin = "item";
|
||||||
|
|
||||||
|
|
|
@ -7147,7 +7147,9 @@ apf.AmlText = function(isPrototype) {
|
||||||
|
|
||||||
this.addEventListener("DOMNodeInsertedIntoDocument", function(e) {
|
this.addEventListener("DOMNodeInsertedIntoDocument", function(e) {
|
||||||
var pHtmlNode;
|
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;
|
return;
|
||||||
|
|
||||||
this.$amlLoaded = true;
|
this.$amlLoaded = true;
|
||||||
|
@ -9849,9 +9851,6 @@ apf.BaseButton = function(){
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
this.implement(apf.ChildValue);
|
|
||||||
|
|
||||||
|
|
||||||
this.$refKeyDown = // Number of keys pressed.
|
this.$refKeyDown = // Number of keys pressed.
|
||||||
this.$refMouseDown = 0; // Mouse button down?
|
this.$refMouseDown = 0; // Mouse button down?
|
||||||
this.$mouseOver = // Mouse hovering over the button?
|
this.$mouseOver = // Mouse hovering over the button?
|
||||||
|
@ -14004,8 +14003,8 @@ apf.button = function(struct, tagName) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$propHandlers["caption"] = function(value) {
|
this.$propHandlers["caption"] = function(value) {
|
||||||
if (!this.oCaption)
|
// if (!this.oCaption)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
this.$setStyleClass(this.$ext, "", [this.$baseCSSname + "Empty"]);
|
this.$setStyleClass(this.$ext, "", [this.$baseCSSname + "Empty"]);
|
||||||
|
@ -14294,6 +14293,9 @@ apf.button = function(struct, tagName) {
|
||||||
this.oIcon = this.$getLayoutNode("main", "icon", this.$ext);
|
this.oIcon = this.$getLayoutNode("main", "icon", this.$ext);
|
||||||
this.oCaption = this.$getLayoutNode("main", "caption", 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"));
|
this.$useExtraDiv = apf.isTrue(this.$getOption("main", "extradiv"));
|
||||||
if (!apf.button.$extradiv && this.$useExtraDiv) {
|
if (!apf.button.$extradiv && this.$useExtraDiv) {
|
||||||
(apf.button.$extradiv = document.createElement("div"))
|
(apf.button.$extradiv = document.createElement("div"))
|
||||||
|
@ -15230,10 +15232,6 @@ apf.label = function(struct, tagName) {
|
||||||
};
|
};
|
||||||
|
|
||||||
(function(){
|
(function(){
|
||||||
this.implement(
|
|
||||||
apf.ChildValue
|
|
||||||
);
|
|
||||||
|
|
||||||
var _self = this;
|
var _self = this;
|
||||||
|
|
||||||
this.$focussable = false;
|
this.$focussable = false;
|
||||||
|
@ -15326,10 +15324,6 @@ apf.colorbox = function(struct, tagName) {
|
||||||
};
|
};
|
||||||
|
|
||||||
(function(){
|
(function(){
|
||||||
this.implement(
|
|
||||||
apf.ChildValue
|
|
||||||
);
|
|
||||||
|
|
||||||
var _self = this;
|
var _self = this;
|
||||||
|
|
||||||
this.$focussable = false;
|
this.$focussable = false;
|
||||||
|
@ -16790,7 +16784,6 @@ apf.radiobutton = function(struct, tagName) {
|
||||||
};
|
};
|
||||||
|
|
||||||
(function(){
|
(function(){
|
||||||
this.implement(apf.ChildValue);
|
|
||||||
this.$childProperty = "label";
|
this.$childProperty = "label";
|
||||||
|
|
||||||
this.$focussable = apf.KEYBOARD; // This object can get the focus
|
this.$focussable = apf.KEYBOARD; // This object can get the focus
|
||||||
|
@ -18135,10 +18128,6 @@ apf.text = function(struct, tagName) {
|
||||||
};
|
};
|
||||||
|
|
||||||
(function(){
|
(function(){
|
||||||
this.implement(
|
|
||||||
|
|
||||||
apf.ChildValue
|
|
||||||
);
|
|
||||||
|
|
||||||
this.$focussable = true; // This object can't get the focus
|
this.$focussable = true; // This object can't get the focus
|
||||||
this.focussable = false;
|
this.focussable = false;
|
||||||
|
|
Ładowanie…
Reference in New Issue