remove attributeNode accessors and fix tests

pull/125/merge
nightwing 2017-03-23 02:56:13 +04:00
rodzic b99bcddf65
commit bc6a86902f
5 zmienionych plików z 13 dodań i 129 usunięć

Wyświetl plik

@ -121,7 +121,7 @@ apf.ChildValue = function(){
this.$init(function() { this.$init(function() {
this.addEventListener("prop." + this.$childProperty, function(e) { this.addEventListener("prop." + this.$childProperty, function(e) {
if (!this.$norecur && !e.value && !this.getAttributeNode(this.$childProperty)) if (!this.$norecur && !e.value && !this.hasAttribute(this.$childProperty))
f.call(this); f.call(this);
}); });
}); });
@ -486,6 +486,9 @@ apf.dropdown = function(struct, tagName) {
}; };
this.setValue = function() {
};
// *** Keyboard Support *** // // *** Keyboard Support *** //

Wyświetl plik

@ -1211,8 +1211,6 @@ apf.Class.prototype = new (function(){
}; };
var realAddEventListener = function(eventName, callback, useCapture) { var realAddEventListener = function(eventName, callback, useCapture) {
if (eventName.substr(0, 2) == "on") if (eventName.substr(0, 2) == "on")
eventName = eventName.substr(2); eventName = eventName.substr(2);
@ -1327,7 +1325,7 @@ apf.Class.prototype = new (function(){
if (this.parentNode && this.removeNode) if (this.parentNode && this.removeNode)
this.removeNode(); this.removeNode();
else if (this.ownerElement && !this.ownerElement.$amlDestroyed) else if (this.ownerElement && !this.ownerElement.$amlDestroyed)
this.ownerElement.removeAttributeNode(this); this.ownerElement.removeAttribute(this.name);
//Remove from focus list - Should be in AmlNode //Remove from focus list - Should be in AmlNode
@ -4126,9 +4124,6 @@ apf.queryValues = function(xmlNode, xpath) {
apf.queryNodes = function(contextNode, sExpr) { apf.queryNodes = function(contextNode, sExpr) {
if (contextNode && (apf.hasXPathHtmlSupport && contextNode.selectSingleNode || !contextNode.style)) if (contextNode && (apf.hasXPathHtmlSupport && contextNode.selectSingleNode || !contextNode.style))
return contextNode.selectNodes(sExpr); //IE55 return contextNode.selectNodes(sExpr); //IE55
//if (contextNode.ownerDocument != document)
// return contextNode.selectNodes(sExpr);
console.log(sExpr)
return apf.XPath.selectNodes(sExpr, contextNode); return apf.XPath.selectNodes(sExpr, contextNode);
}; };
@ -8344,7 +8339,6 @@ apf.AmlNode = function(){
if (!apf.XPath) if (!apf.XPath)
apf.runXpath(); apf.runXpath();
console.log(sExpr)
return apf.XPath.selectNodes(sExpr, return apf.XPath.selectNodes(sExpr,
contextNode || (this.nodeType == 9 ? this.documentElement : this)); contextNode || (this.nodeType == 9 ? this.documentElement : this));
}; };
@ -8457,8 +8451,6 @@ apf.AmlElement = function(struct, tagName) {
//These exceptions should be generalized //These exceptions should be generalized
if (prop == "id") if (prop == "id")
this.$propHandlers["id"].call(this, this.id = struct.id); this.$propHandlers["id"].call(this, this.id = struct.id);
else if (prop == "hotkey")
this.$propHandlers["hotkey"].call(this, this.hotkey = struct.hotkey);
else if (prop.substr(0, 2) == "on") else if (prop.substr(0, 2) == "on")
attr.$triggerUpdate(); attr.$triggerUpdate();
@ -8663,23 +8655,9 @@ apf.AmlElement = function(struct, tagName) {
a.$triggerUpdate(null, oldValue); a.$triggerUpdate(null, oldValue);
}; };
//@todo apf3.0 domattr
this.setAttributeNode = function(attrNode) {
this.attributes.setNamedItem(attrNode);
};
this.setAttributeNS = function(namespaceURI, name, value) {
return this.setAttribute(name, value);
};
//@todo apf3.0 domattr //@todo apf3.0 domattr
this.hasAttribute = function(name) { this.hasAttribute = function(name) {
return this.getAttributeNode(name) ? true : false; return this.attributes.getNamedItem(name) ? true : false;
};
//@todo
this.hasAttributeNS = function(namespaceURI, name) {
return this.hasAttribute(name);
}; };
/** /**
@ -8693,16 +8671,6 @@ apf.AmlElement = function(struct, tagName) {
return this; return this;
}; };
//@todo apf3.0 domattr
this.removeAttributeNS = function(namespaceURI, name) {
return this.removeAttribute(name);
};
//@todo apf3.0 domattr
this.removeAttributeNode = function(attrNode) {
this.attributes.removeNamedItem(attrNode.name); //@todo this should probably be slightly different.
};
/** /**
* Retrieves the value of an attribute of this element. * Retrieves the value of an attribute of this element.
* *
@ -8717,16 +8685,6 @@ apf.AmlElement = function(struct, tagName) {
: item.nodeValue) : null; : item.nodeValue) : null;
}; };
/**
* Retrieves the attribute node for a given name
*
* @param {String} name The name of the attribute to find.
* @return {apf.AmlNode} The attribute node, or `null` if none was found with the name specified.
*/
this.getAttributeNode = function(name) {
return this.attributes.getNamedItem(name);
};
this.getBoundingClientRect = function(){ this.getBoundingClientRect = function(){
return new apf.AmlTextRectangle(this); return new apf.AmlTextRectangle(this);
}; };
@ -8746,50 +8704,6 @@ apf.AmlElement = function(struct, tagName) {
}; };
/**
* Replaces the child AML elements with new AML.
* @param {Mixed} amlDefNode The AML to be loaded. This can be a string or a parsed piece of XML.
* @param {HTMLElement} oInt The HTML parent of the created AML elements.
*/
this.replaceMarkup = function(amlDefNode, options) {
if (!options)
options = {};
if (!options.$intAML)
options.$intAML = this.$aml;
if (!options.$int)
options.$int = this.$int;
options.clear = true;
//Remove All the childNodes
for (var i = this.childNodes.length - 1; i >= 0; i--) {
var oItem = this.childNodes[i];
/*var nodes = oItem.childNodes;
for (var k = 0; k < nodes.length; k++)
if (nodes[k].destroy)
nodes[k].destroy(true);
if (oItem.$aml && oItem.$aml.parentNode)
oItem.$aml.parentNode.removeChild(oItem.$aml);*/
if (oItem.destroy)
oItem.destroy(true);
if (oItem.$ext != this.$int)
apf.destroyHtmlNode(oItem.$ext);
}
this.childNodes.length = 0;
if (options.noLoadingMsg !== false)
this.$int.innerHTML = "<div class='loading'>loading...</div>";
//Do an insertMarkup
this.insertMarkup(amlDefNode, options);
};
/** /**
* Inserts new AML into this element. * Inserts new AML into this element.
* @param {Mixed} amlDefNode The AML to be loaded. This can be a string or a parsed piece of XML. * @param {Mixed} amlDefNode The AML to be loaded. This can be a string or a parsed piece of XML.
@ -8798,10 +8712,6 @@ apf.AmlElement = function(struct, tagName) {
* - clear ([[Boolean]]): If set, the AML has the attribute "clear" attached to it * - clear ([[Boolean]]): If set, the AML has the attribute "clear" attached to it
*/ */
this.insertMarkup = function(amlDefNode, options) { this.insertMarkup = function(amlDefNode, options) {
var _self = this; var _self = this;
var include = new apf.XiInclude(); var include = new apf.XiInclude();
@ -11425,25 +11335,6 @@ apf.GuiElement.propHandlers = {
} }
}, },
//Load subAML
/**
* @attribute {String} aml Sets or gets the {@link term.datainstruction data instruction}
* that loads new AML as children of this element.
*/
"aml": function(value) {
this.replaceMarkup(value);
}
/*
* @attribute {String} sets this aml element to be editable
* that loads new aml as children of this element.
*/
// @todo Doc WTF?
}; };
@ -11973,20 +11864,17 @@ apf.Presentation = function(){
var oExt = this.$getLayoutNode(tag); var oExt = this.$getLayoutNode(tag);
var node; var node;
if (node = (aml || this).getAttributeNode("style")) if (node = (aml || this).getAttribute("style"))
oExt.setAttribute("style", node.nodeValue); oExt.setAttribute("style", node);
//if (node = (aml || this).getAttributeNode("class"))
//this.$setStyleClass(oExt, (oldClass = node.nodeValue));
if (func) if (func)
func.call(this, oExt); func.call(this, oExt);
oExt = apf.insertHtmlNode(oExt, pNode); oExt = apf.insertHtmlNode(oExt, pNode);
oExt.host = this; oExt.host = this;
if (node = (aml || this).getAttributeNode("bgimage")) if (node = (aml || this).getAttribute("bgimage"))
oExt.style.backgroundImage = "url(" + apf.getAbsolutePath( oExt.style.backgroundImage = "url(" + apf.getAbsolutePath(
this.mediaPath, node.nodeValue) + ")"; this.mediaPath, node) + ")";
if (!this.$baseCSSname) if (!this.$baseCSSname)
this.$baseCSSname = oExt.className.trim().split(" ")[0]; this.$baseCSSname = oExt.className.trim().split(" ")[0];
@ -15487,8 +15375,6 @@ apf.runIE = function(){
try {var m = this.sns(sExpr, contextNode); } catch(e) {} try {var m = this.sns(sExpr, contextNode); } catch(e) {}
silent = !true silent = !true
if (n != m && m) { if (n != m && m) {
console.log(sExpr)
debugger
n = m n = m
findNode(contextNode, sExpr); findNode(contextNode, sExpr);
} }
@ -15532,7 +15418,6 @@ function findNode(htmlNode, textNode, parts, maxRecur) {
if (ch[i].nodeType == 3 || ch[i].nodeType == 4) if (ch[i].nodeType == 3 || ch[i].nodeType == 4)
return ch[i]; return ch[i];
} }
debugger
throw new Error("can't find node " + textNode); throw new Error("can't find node " + textNode);
} else if (textNode[0] == "@") { } else if (textNode[0] == "@") {
var name = textNode.substr(1); var name = textNode.substr(1);

Wyświetl plik

@ -62,7 +62,7 @@ define(function(require, exports, module) {
if (oldHandler && oldHandler.value != value) { if (oldHandler && oldHandler.value != value) {
commands.commandManager.off("prop." + oldHandler.prop, oldHandler.handler); commands.commandManager.off("prop." + oldHandler.prop, oldHandler.handler);
} }
if (value && /^commands./.test(value)) { if (value && /^commands./.test(value) && commands.commandManager) {
// TODO replace this with the mechanism from events // TODO replace this with the mechanism from events
oldHandler = amlNode.$funcHandlers.hotkey = oldHandler || { oldHandler = amlNode.$funcHandlers.hotkey = oldHandler || {
handler: function(e) { handler: function(e) {

Wyświetl plik

@ -40,10 +40,6 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai)
var Plugin = imports.Plugin; var Plugin = imports.Plugin;
describe('ui', function() { describe('ui', function() {
it('should provide an easy way to create xml nodes', function(done) {
expect(ui.n("<test />").xml()).to.equal("<test/>");
done();
});
it('should provide a way to insert CSS into the browser', function(done) { it('should provide a way to insert CSS into the browser', function(done) {
var plugin = new Plugin("", []); var plugin = new Plugin("", []);
plugin.load("test"); plugin.load("test");

Wyświetl plik

@ -12,11 +12,11 @@
state="true" value="0" margin="6 5 0 0" state="true" value="0" margin="6 5 0 0"
top="-31" right="-15" zindex="100" /> top="-31" right="-15" zindex="100" />
<a:list id="lstUploadActivity" <a:bar id="lstUploadActivity"
skin = "list-uploadactivity" skin = "list-uploadactivity"
skinset = "uploadfiles" skinset = "uploadfiles"
height="160" height="160"
> >
</a:list> </a:bar>
</a:frame> </a:frame>
</a:application> </a:application>