more xml
This commit is contained in:
parent
631bf47a96
commit
5cb7951d44
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
!function n(e,t,r){function o(u,s){if(!t[u]){if(!e[u]){var c="function"==typeof require&&require;if(!s&&c)return c(u,!0);if(i)return i(u,!0);throw new Error("Cannot find module '"+u+"'")}var a=t[u]={exports:{}};e[u][0].call(a.exports,function(n){var t=e[u][1][n];return o(t?t:n)},a,a.exports,n,e,t,r)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(n,e){var t;t=function(){var n,e,t;return t=null,2===arguments.length?(t=new Peer(arguments[0]),e=arguments[1]):(t=new Peer(arguments[0],arguments[1]),t.on("error",function(n){throw new Error("Peerjs connector: "+n)}),t.on("disconnected",function(){throw new Error("Peerjs connector disconnected from signalling server. Cannot accept new connections. Not fatal, but not so good either..")}),e=arguments[2]),n=function(){function n(n,e,r,o){var i,u;this.engine=n,this.HB=e,this.execution_listener=r,this.yatta=o,this.peer=t,this.connections={},this.peer.on("connection",function(n){return function(e){return n.addConnection(e)}}(this)),u=function(n){return function(){var e,t,r,o;r=n.connections,o=[];for(t in r)e=r[t],o.push(e.send({sync_state_vector:n.HB.getOperationCounter()}));return o}}(this),setInterval(u,4e3),i=function(n){return function(e){var t,r,o,i;if(e.uid.creator===n.HB.getUserId()&&"string"!=typeof e.uid.op_number){o=n.connections,i=[];for(r in o)t=o[r],i.push(t.send({op:e}));return i}}}(this),this.execution_listener.push(i)}return n.prototype.connectToPeer=function(n){return null==this.connections[n]&&n!==this.yatta.getUserId()?this.addConnection(t.connect(n)):void 0},n.prototype.getAllConnectionIds=function(){var n,e;e=[];for(n in this.connections)e.push(n);return e},n.prototype.addConnection=function(n){var e,t,r;return this.connections[n.peer]=n,t=!1,e=!1,n.on("data",function(r){return function(o){var i,u,s,c,a;if("empty_message"===o);else if(null!=o.HB){if(t=!0,r.engine.applyOpsCheckDouble(o.HB),!o.initialized)return n.send({conns:r.getAllConnectionIds()})}else{if(null!=o.op)return r.engine.applyOp(o.op);if(null!=o.conns){for(c=o.conns,a=[],u=0,s=c.length;s>u;u++)i=c[u],a.push(r.connectToPeer(i));return a}if(null!=o.sync_state_vector)return n.send({HB:r.yatta.getHistoryBuffer()._encode(o.sync_state_vector),initialized:!0});if(null==o.state_vector)throw new Error("Can't parse this operation "+o);if(!e)return n.send({HB:r.yatta.getHistoryBuffer()._encode(o.state_vector),initialized:!1}),e=!0}}}(this)),r=function(e){return function(){return n.send({state_vector:e.HB.getOperationCounter()}),t?void 0:setTimeout(r,100)}}(this),r()},n}(),t.on("open",function(t){return e(n,t)})},e.exports=t,"undefined"!=typeof window&&null!==window&&(null==window.Y&&(window.Y={}),window.Y.createPeerJsConnector=t)},{}]},{},[1]);
|
!function n(e,t,r){function o(u,s){if(!t[u]){if(!e[u]){var c="function"==typeof require&&require;if(!s&&c)return c(u,!0);if(i)return i(u,!0);throw new Error("Cannot find module '"+u+"'")}var a=t[u]={exports:{}};e[u][0].call(a.exports,function(n){var t=e[u][1][n];return o(t?t:n)},a,a.exports,n,e,t,r)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(n,e){var t;t=function(){var n,e,t;return t=null,2===arguments.length?(t=new Peer(arguments[0]),e=arguments[1]):(t=new Peer(arguments[0],arguments[1]),t.on("error",function(n){throw new Error("Peerjs connector: "+n)}),t.on("disconnected",function(){throw new Error("Peerjs connector disconnected from signalling server. Cannot accept new connections. Not fatal, but not so good either..")}),e=arguments[2]),n=function(){function n(n,e,r,o){var i,u;this.engine=n,this.HB=e,this.execution_listener=r,this.yatta=o,this.peer=t,this.connections={},this.peer.on("connection",function(n){return function(e){return n.addConnection(e)}}(this)),u=function(n){return function(){var e,t,r,o;r=n.connections,o=[];for(t in r)e=r[t],o.push(e.send({sync_state_vector:n.HB.getOperationCounter()}));return o}}(this),setInterval(u,4e3),i=function(n){return function(e){var t,r,o,i;if(e.uid.creator===n.HB.getUserId()&&"string"!=typeof e.uid.op_number){o=n.connections,i=[];for(r in o)t=o[r],i.push(t.send({op:e}));return i}}}(this),this.execution_listener.push(i)}return n.prototype.connectToPeer=function(n){return null==this.connections[n]&&n!==this.yatta.getUserId()?this.addConnection(t.connect(n)):void 0},n.prototype.getAllConnectionIds=function(){var n,e;e=[];for(n in this.connections)e.push(n);return e},n.prototype.addConnection=function(n){var e,t,r;return this.connections[n.peer]=n,t=!1,e=!1,n.on("data",function(r){return function(o){var i,u,s,c,a;if("empty_message"===o);else if(null!=o.HB){if(t=!0,r.engine.applyOpsCheckDouble(o.HB),!o.initialized)return n.send({conns:r.getAllConnectionIds()})}else{if(null!=o.op)return r.engine.applyOp(o.op);if(null!=o.conns){for(c=o.conns,a=[],u=0,s=c.length;s>u;u++)i=c[u],a.push(r.connectToPeer(i));return a}if(null!=o.sync_state_vector)return n.send({HB:r.yatta.getHistoryBuffer()._encode(o.sync_state_vector),initialized:!0});if(null==o.state_vector)throw new Error("Can't parse this operation: "+o);if(!e)return n.send({HB:r.yatta.getHistoryBuffer()._encode(o.state_vector),initialized:!1}),e=!0}}}(this)),r=function(e){return function(){return n.send({state_vector:e.HB.getOperationCounter()}),t?void 0:setTimeout(r,100)}}(this),r()},n}(),t.on("open",function(t){return e(n,t)})},e.exports=t,"undefined"!=typeof window&&null!==window&&(null==window.Y&&(window.Y={}),window.Y.createPeerJsConnector=t)},{}]},{},[1]);
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
build/browser/Frameworks/XmlFramework.min.js
vendored
4
build/browser/Frameworks/XmlFramework.min.js
vendored
File diff suppressed because one or more lines are too long
@ -122,7 +122,7 @@
|
|||||||
return initialized_him = true;
|
return initialized_him = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Can't parse this operation " + data);
|
throw new Error("Can't parse this operation: " + data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})(this));
|
})(this));
|
||||||
|
File diff suppressed because one or more lines are too long
@ -51,8 +51,9 @@
|
|||||||
return this.getSharedObject().toJson();
|
return this.getSharedObject().toJson();
|
||||||
};
|
};
|
||||||
|
|
||||||
JsonFramework.prototype.val = function(name, content, mutable) {
|
JsonFramework.prototype.val = function() {
|
||||||
return this.getSharedObject().val(name, content, mutable);
|
var _ref;
|
||||||
|
return (_ref = this.getSharedObject()).val.apply(_ref, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
JsonFramework.prototype.on = function() {
|
JsonFramework.prototype.on = function() {
|
||||||
|
File diff suppressed because one or more lines are too long
@ -142,7 +142,7 @@
|
|||||||
HB.addOperation(json).execute();
|
HB.addOperation(json).execute();
|
||||||
this.replace_manager.replace(json);
|
this.replace_manager.replace(json);
|
||||||
return this;
|
return this;
|
||||||
} else if ((name != null) && ((content != null) || content === null)) {
|
} else if ((name != null) && arguments.length > 1) {
|
||||||
if (mutable != null) {
|
if (mutable != null) {
|
||||||
if (mutable === true || mutable === 'mutable') {
|
if (mutable === true || mutable === 'mutable') {
|
||||||
mutable = true;
|
mutable = true;
|
||||||
@ -154,7 +154,7 @@
|
|||||||
}
|
}
|
||||||
if (typeof content === 'function') {
|
if (typeof content === 'function') {
|
||||||
return this;
|
return this;
|
||||||
} else if (content === null || (((!mutable) || typeof content === 'number') && content.constructor !== Object)) {
|
} else if ((content == null) || (((!mutable) || typeof content === 'number') && content.constructor !== Object)) {
|
||||||
obj = HB.addOperation(new types.ImmutableObject(void 0, content)).execute();
|
obj = HB.addOperation(new types.ImmutableObject(void 0, content)).execute();
|
||||||
return JsonType.__super__.val.call(this, name, obj);
|
return JsonType.__super__.val.call(this, name, obj);
|
||||||
} else {
|
} else {
|
||||||
|
File diff suppressed because one or more lines are too long
@ -25,7 +25,11 @@
|
|||||||
__extends(TextInsert, _super);
|
__extends(TextInsert, _super);
|
||||||
|
|
||||||
function TextInsert(content, uid, prev, next, origin) {
|
function TextInsert(content, uid, prev, next, origin) {
|
||||||
|
if ((content != null ? content.creator : void 0) != null) {
|
||||||
|
this.saveOperation('content', content);
|
||||||
|
} else {
|
||||||
this.content = content;
|
this.content = content;
|
||||||
|
}
|
||||||
if (!((prev != null) && (next != null))) {
|
if (!((prev != null) && (next != null))) {
|
||||||
throw new Error("You must define prev, and next for TextInsert-types!");
|
throw new Error("You must define prev, and next for TextInsert-types!");
|
||||||
}
|
}
|
||||||
@ -56,14 +60,18 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
TextInsert.prototype._encode = function() {
|
TextInsert.prototype._encode = function() {
|
||||||
var json;
|
var json, _ref;
|
||||||
json = {
|
json = {
|
||||||
'type': "TextInsert",
|
'type': "TextInsert",
|
||||||
'content': this.content,
|
|
||||||
'uid': this.getUid(),
|
'uid': this.getUid(),
|
||||||
'prev': this.prev_cl.getUid(),
|
'prev': this.prev_cl.getUid(),
|
||||||
'next': this.next_cl.getUid()
|
'next': this.next_cl.getUid()
|
||||||
};
|
};
|
||||||
|
if (((_ref = this.content) != null ? _ref.getUid : void 0) != null) {
|
||||||
|
json['content'] = this.content.getUid();
|
||||||
|
} else {
|
||||||
|
json['content'] = this.content;
|
||||||
|
}
|
||||||
if (this.origin !== this.prev_cl) {
|
if (this.origin !== this.prev_cl) {
|
||||||
json["origin"] = this.origin.getUid();
|
json["origin"] = this.origin.getUid();
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,21 +1,27 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var json_types_uninitialized,
|
var json_types_uninitialized, proxy_token,
|
||||||
__hasProp = {}.hasOwnProperty,
|
__hasProp = {}.hasOwnProperty,
|
||||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||||
|
|
||||||
json_types_uninitialized = require("./JsonTypes");
|
json_types_uninitialized = require("./JsonTypes");
|
||||||
|
|
||||||
|
proxy_token = false;
|
||||||
|
|
||||||
if (typeof Element !== "undefined" && Element !== null) {
|
if (typeof Element !== "undefined" && Element !== null) {
|
||||||
Element.prototype._proxy = function(f_name, f) {
|
Element.prototype._proxy = function(f_name, f) {
|
||||||
var old_f;
|
var old_f;
|
||||||
old_f = this[f_name];
|
old_f = this[f_name];
|
||||||
if (old_f != null) {
|
if (old_f != null) {
|
||||||
return this[f_name] = function() {
|
return this[f_name] = function() {
|
||||||
|
if (!proxy_token) {
|
||||||
|
proxy_token = true;
|
||||||
|
old_f.apply(this, arguments);
|
||||||
f.apply(this, arguments);
|
f.apply(this, arguments);
|
||||||
return old_f.apply(this, arguments);
|
return proxy_token = false;
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
return this[f_name] = f;
|
return old_f.apply(this, arguments);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -95,8 +101,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
XmlType.prototype.setXmlProxy = function() {
|
XmlType.prototype.setXmlProxy = function() {
|
||||||
|
var insertBefore, that;
|
||||||
this.xml._yatta = this;
|
this.xml._yatta = this;
|
||||||
return this.xml._proxy('insertBefore', function(insertedNode, adjacentNode) {
|
that = this;
|
||||||
|
insertBefore = function(insertedNode, adjacentNode) {
|
||||||
var element, next, prev;
|
var element, next, prev;
|
||||||
next = adjacentNode != null ? adjacentNode._yatta : void 0;
|
next = adjacentNode != null ? adjacentNode._yatta : void 0;
|
||||||
prev = null;
|
prev = null;
|
||||||
@ -105,10 +113,16 @@
|
|||||||
} else {
|
} else {
|
||||||
prev = this._yatta.elements.end.prev_cl;
|
prev = this._yatta.elements.end.prev_cl;
|
||||||
}
|
}
|
||||||
element = new XmlType(void 0, void 0, void 0, void 0);
|
element = new XmlType(void 0, void 0, void 0, void 0, insertedNode);
|
||||||
HB.addOperation(element).execute();
|
HB.addOperation(element).execute();
|
||||||
return this.elements.insertAfter(prev, element);
|
return that.elements.insertAfter(prev, element);
|
||||||
|
};
|
||||||
|
this.xml._proxy('insertBefore', insertBefore);
|
||||||
|
this.xml._proxy('appendChild', insertBefore);
|
||||||
|
this.xml._proxy('removeAttribute', function(name) {
|
||||||
|
return that.attributes.val(name, void 0);
|
||||||
});
|
});
|
||||||
|
return this.xml._proxy('removeChild', function(node) {});
|
||||||
};
|
};
|
||||||
|
|
||||||
XmlType.prototype.val = function(enforce) {
|
XmlType.prototype.val = function(enforce) {
|
||||||
@ -122,10 +136,12 @@
|
|||||||
attr = this.attributes.val();
|
attr = this.attributes.val();
|
||||||
for (attr_name in attr) {
|
for (attr_name in attr) {
|
||||||
value = attr[attr_name];
|
value = attr[attr_name];
|
||||||
|
if (value != null) {
|
||||||
a = document.createAttribute(attr_name);
|
a = document.createAttribute(attr_name);
|
||||||
a.value = value;
|
a.value = value;
|
||||||
this.xml.setAttributeNode(a);
|
this.xml.setAttributeNode(a);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
e = this.elements.beginning.next_cl;
|
e = this.elements.beginning.next_cl;
|
||||||
while (e.type !== "Delimiter") {
|
while (e.type !== "Delimiter") {
|
||||||
n = e.content;
|
n = e.content;
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -6,7 +6,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="mocha"></div>
|
<div id="mocha"></div>
|
||||||
<div id="test_dom"><p>This is a test object for <b>XmlFramework</b></p></div>
|
<div id="test_dom" test_attribute="the test"><p id="removeme">remove me</p><p>This is a test object for <b>XmlFramework</b></p></div>
|
||||||
<script src="../../node_modules/mocha/mocha.js" class="awesome"></script>
|
<script src="../../node_modules/mocha/mocha.js" class="awesome"></script>
|
||||||
<script>
|
<script>
|
||||||
mocha.setup('bdd');
|
mocha.setup('bdd');
|
||||||
|
@ -271,7 +271,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -302,7 +302,7 @@ data from the received intent.</p>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -120,7 +120,7 @@ Known values that are supported:</p><ul>
|
|||||||
<a href='#val-dynamic'>
|
<a href='#val-dynamic'>
|
||||||
#
|
#
|
||||||
(void)
|
(void)
|
||||||
<b>val</b><span>(name, content, mutable)</span>
|
<b>val</b><span>()</span>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
<span class='desc'>
|
<span class='desc'>
|
||||||
@ -288,7 +288,7 @@ JsonFramework was initialized (Depending on the HistoryBuffer implementation).</
|
|||||||
<p class='signature' id='val-dynamic'>
|
<p class='signature' id='val-dynamic'>
|
||||||
#
|
#
|
||||||
(void)
|
(void)
|
||||||
<b>val</b><span>(name, content, mutable)</span>
|
<b>val</b><span>()</span>
|
||||||
<br>
|
<br>
|
||||||
</p>
|
</p>
|
||||||
<div class='tags'>
|
<div class='tags'>
|
||||||
@ -335,7 +335,7 @@ JsonFramework was initialized (Depending on the HistoryBuffer implementation).</
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -466,7 +466,7 @@ if (x.type === "JsonType") {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -139,7 +139,7 @@ console.log(w.newProperty == "Awesome") # true!</code></pre>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -222,7 +222,7 @@ on how to do that with urls.</p>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -356,7 +356,7 @@ JsonFramework was initialized (Depending on the HistoryBuffer implementation).</
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -455,7 +455,7 @@ yatta.bind(textbox);</code></pre>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -41,7 +41,13 @@
|
|||||||
</table>
|
</table>
|
||||||
<h2>Overview</h2>
|
<h2>Overview</h2>
|
||||||
<div class='docstring'>
|
<div class='docstring'>
|
||||||
<p>Manages XML types</p>
|
<p>Manages XML types
|
||||||
|
Not supported:</p><ul>
|
||||||
|
<li>Attribute nodes</li>
|
||||||
|
<li>Real replace of child elements (to much overhead). Currently, the new element is inserted after the 'replaced' element, and then it is deleted.
|
||||||
|
*</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class='tags'>
|
<div class='tags'>
|
||||||
</div>
|
</div>
|
||||||
@ -252,7 +258,7 @@ This result can be send to other clients.</p>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -70,7 +70,7 @@ But I would become really motivated if you gave me some feedback :) (<a href="ht
|
|||||||
<ul>
|
<ul>
|
||||||
<li>XML support</li>
|
<li>XML support</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h2 id="support">Support</h2><p>Please report any issues to the <a href="https://github.com/DadaMonad/Yatta/issues">Github issue page</a>!</p><h2 id="license">License</h2><p>Yatta! is licensed under the <a href="./LICENSE.txt">MIT License</a>.</p><a href="mailto:kevin.jahns@rwth-aachen.de">kevin.jahns@rwth-aachen.de</a>
|
<h2 id="support">Support</h2><p>Please report any issues to the <a href="https://github.com/DadaMonad/Yatta/issues">Github issue page</a>!</p><h2 id="license">License</h2><p>Yatta! is licensed under the <a href="./LICENSE.txt">MIT License</a>.</p><a href="mailto:kevin.jahns@rwth-aachen.de">kevin.jahns@rwth-aachen.de</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ But I would become really motivated if you gave me some feedback :) (<a href="ht
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -100,7 +100,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -158,7 +158,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -37,6 +37,23 @@
|
|||||||
<td>lib/Types</td>
|
<td>lib/Types</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<h2>Variables Summary</h2>
|
||||||
|
<dl class='constants'>
|
||||||
|
<dt id='proxy_token-variable'>
|
||||||
|
proxy_token
|
||||||
|
=
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
<pre><code class='coffeescript'>false</code></pre>
|
||||||
|
<div class='docstring'>
|
||||||
|
<p>some dom implementations may call another dom.method that simulates the behavior of another.
|
||||||
|
For example xml.insertChild(dom) , wich inserts an element at the end, and xml.insertAfter(dom,null) wich does the same
|
||||||
|
But yatta's proxy may be called only once!</p>
|
||||||
|
</div>
|
||||||
|
<div class='tags'>
|
||||||
|
</div>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
<h2>Method Summary</h2>
|
<h2>Method Summary</h2>
|
||||||
<ul class='summary'>
|
<ul class='summary'>
|
||||||
<li>
|
<li>
|
||||||
@ -65,7 +82,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
September 29, 14 12:25:30 by
|
September 29, 14 15:28:15 by
|
||||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||||
Codo
|
Codo
|
||||||
</a>
|
</a>
|
||||||
|
@ -76,8 +76,8 @@ class JsonFramework
|
|||||||
#
|
#
|
||||||
# @see JsonType.val
|
# @see JsonType.val
|
||||||
#
|
#
|
||||||
val : (name, content, mutable)->
|
val : ()->
|
||||||
@getSharedObject().val(name, content, mutable)
|
@getSharedObject().val arguments...
|
||||||
|
|
||||||
#
|
#
|
||||||
# @see Operation.on
|
# @see Operation.on
|
||||||
|
@ -207,7 +207,7 @@ module.exports = (HB)->
|
|||||||
HB.addOperation(json).execute()
|
HB.addOperation(json).execute()
|
||||||
@replace_manager.replace json
|
@replace_manager.replace json
|
||||||
@
|
@
|
||||||
else if name? and (content? or content is null)
|
else if name? and arguments.length > 1
|
||||||
if mutable?
|
if mutable?
|
||||||
if mutable is true or mutable is 'mutable'
|
if mutable is true or mutable is 'mutable'
|
||||||
mutable = true
|
mutable = true
|
||||||
@ -217,7 +217,7 @@ module.exports = (HB)->
|
|||||||
mutable = @mutable_default
|
mutable = @mutable_default
|
||||||
if typeof content is 'function'
|
if typeof content is 'function'
|
||||||
@ # Just do nothing
|
@ # Just do nothing
|
||||||
else if content is null or (((not mutable) or typeof content is 'number') and content.constructor isnt Object)
|
else if (not content?) or (((not mutable) or typeof content is 'number') and content.constructor isnt Object)
|
||||||
obj = HB.addOperation(new types.ImmutableObject undefined, content).execute()
|
obj = HB.addOperation(new types.ImmutableObject undefined, content).execute()
|
||||||
super name, obj
|
super name, obj
|
||||||
else
|
else
|
||||||
|
@ -22,7 +22,11 @@ module.exports = (HB)->
|
|||||||
# @param {String} content The content of this Insert-type Operation. Usually you restrict the length of content to size 1
|
# @param {String} content The content of this Insert-type Operation. Usually you restrict the length of content to size 1
|
||||||
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
|
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
|
||||||
#
|
#
|
||||||
constructor: (@content, uid, prev, next, origin)->
|
constructor: (content, uid, prev, next, origin)->
|
||||||
|
if content?.creator?
|
||||||
|
@saveOperation 'content', content
|
||||||
|
else
|
||||||
|
@content = content
|
||||||
if not (prev? and next?)
|
if not (prev? and next?)
|
||||||
throw new Error "You must define prev, and next for TextInsert-types!"
|
throw new Error "You must define prev, and next for TextInsert-types!"
|
||||||
super uid, prev, next, origin
|
super uid, prev, next, origin
|
||||||
@ -61,11 +65,14 @@ module.exports = (HB)->
|
|||||||
json =
|
json =
|
||||||
{
|
{
|
||||||
'type': "TextInsert"
|
'type': "TextInsert"
|
||||||
'content': @content
|
|
||||||
'uid' : @getUid()
|
'uid' : @getUid()
|
||||||
'prev': @prev_cl.getUid()
|
'prev': @prev_cl.getUid()
|
||||||
'next': @next_cl.getUid()
|
'next': @next_cl.getUid()
|
||||||
}
|
}
|
||||||
|
if @content?.getUid?
|
||||||
|
json['content'] = @content.getUid()
|
||||||
|
else
|
||||||
|
json['content'] = @content
|
||||||
if @origin isnt @prev_cl
|
if @origin isnt @prev_cl
|
||||||
json["origin"] = @origin.getUid()
|
json["origin"] = @origin.getUid()
|
||||||
json
|
json
|
||||||
|
@ -1,14 +1,23 @@
|
|||||||
|
|
||||||
json_types_uninitialized = require "./JsonTypes"
|
json_types_uninitialized = require "./JsonTypes"
|
||||||
|
|
||||||
|
# some dom implementations may call another dom.method that simulates the behavior of another.
|
||||||
|
# For example xml.insertChild(dom) , wich inserts an element at the end, and xml.insertAfter(dom,null) wich does the same
|
||||||
|
# But yatta's proxy may be called only once!
|
||||||
|
proxy_token = false
|
||||||
Element?.prototype._proxy = (f_name, f)->
|
Element?.prototype._proxy = (f_name, f)->
|
||||||
old_f = @[f_name]
|
old_f = @[f_name]
|
||||||
if old_f?
|
if old_f?
|
||||||
@[f_name] = ()->
|
@[f_name] = ()->
|
||||||
f.apply this, arguments
|
if not proxy_token
|
||||||
|
proxy_token = true
|
||||||
old_f.apply this, arguments
|
old_f.apply this, arguments
|
||||||
|
f.apply this, arguments
|
||||||
|
proxy_token = false
|
||||||
else
|
else
|
||||||
@[f_name] = f
|
old_f.apply this, arguments
|
||||||
|
#else
|
||||||
|
# @[f_name] = f
|
||||||
|
|
||||||
|
|
||||||
module.exports = (HB)->
|
module.exports = (HB)->
|
||||||
@ -18,7 +27,10 @@ module.exports = (HB)->
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Manages XML types
|
# Manages XML types
|
||||||
#
|
# Not supported:
|
||||||
|
# * Attribute nodes
|
||||||
|
# * Real replace of child elements (to much overhead). Currently, the new element is inserted after the 'replaced' element, and then it is deleted.
|
||||||
|
# *
|
||||||
class XmlType extends types.Insert
|
class XmlType extends types.Insert
|
||||||
|
|
||||||
constructor: (uid, @tagname, attributes, elements, @xml)->
|
constructor: (uid, @tagname, attributes, elements, @xml)->
|
||||||
@ -82,16 +94,24 @@ module.exports = (HB)->
|
|||||||
|
|
||||||
setXmlProxy: ()->
|
setXmlProxy: ()->
|
||||||
@xml._yatta = @
|
@xml._yatta = @
|
||||||
@xml._proxy 'insertBefore', (insertedNode, adjacentNode)->
|
that = @
|
||||||
|
insertBefore = (insertedNode, adjacentNode)->
|
||||||
next = adjacentNode?._yatta
|
next = adjacentNode?._yatta
|
||||||
prev = null
|
prev = null
|
||||||
if next?
|
if next?
|
||||||
prev = next.prev_cl
|
prev = next.prev_cl
|
||||||
else
|
else
|
||||||
prev = @_yatta.elements.end.prev_cl
|
prev = @_yatta.elements.end.prev_cl
|
||||||
element = new XmlType undefined, undefined, undefined, undefined
|
element = new XmlType undefined, undefined, undefined, undefined, insertedNode
|
||||||
HB.addOperation(element).execute()
|
HB.addOperation(element).execute()
|
||||||
@elements.insertAfter prev, element
|
that.elements.insertAfter prev, element
|
||||||
|
@xml._proxy 'insertBefore', insertBefore
|
||||||
|
@xml._proxy 'appendChild', insertBefore
|
||||||
|
@xml._proxy 'removeAttribute', (name)->
|
||||||
|
that.attributes.val(name, undefined)
|
||||||
|
@xml._proxy 'removeChild', (node)->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val: (enforce = false)->
|
val: (enforce = false)->
|
||||||
if document?
|
if document?
|
||||||
@ -100,6 +120,7 @@ module.exports = (HB)->
|
|||||||
|
|
||||||
attr = @attributes.val()
|
attr = @attributes.val()
|
||||||
for attr_name, value of attr
|
for attr_name, value of attr
|
||||||
|
if value?
|
||||||
a = document.createAttribute attr_name
|
a = document.createAttribute attr_name
|
||||||
a.value = value
|
a.value = value
|
||||||
@xml.setAttributeNode a
|
@xml.setAttributeNode a
|
||||||
|
@ -37,19 +37,43 @@ describe "XmlFramework", ->
|
|||||||
@users = @yTest.users
|
@users = @yTest.users
|
||||||
###
|
###
|
||||||
@test_user = @yTest.makeNewUser 0, (Connector_uninitialized [])
|
@test_user = @yTest.makeNewUser 0, (Connector_uninitialized [])
|
||||||
|
@dom = $("#test_dom")[0]
|
||||||
|
@test_user.val(@dom)
|
||||||
|
|
||||||
|
@check = ()=>
|
||||||
|
dom_ = @test_user.val(true)
|
||||||
|
expect(dom_.outerHTML).to.equal(@dom.outerHTML)
|
||||||
done()
|
done()
|
||||||
|
|
||||||
it "can transform to a real Dom element", ->
|
it "can transform to a new real Dom element", ->
|
||||||
dom = $("#test_dom")[0]
|
|
||||||
@test_user.val(dom)
|
|
||||||
dom_ = @test_user.val(true)
|
dom_ = @test_user.val(true)
|
||||||
expect(dom_ isnt dom).to.be.true
|
expect(dom_ isnt @dom).to.be.true
|
||||||
expect(dom_.outerHTML).to.equal(dom.outerHTML)
|
@check()
|
||||||
|
|
||||||
it "can transform to a real Dom element", ->
|
it "supports dom.insertBefore", ->
|
||||||
dom = $("#test_dom")[0]
|
|
||||||
@test_user.val(dom)
|
|
||||||
newdom = $("<p>dtrn</p>")[0]
|
newdom = $("<p>dtrn</p>")[0]
|
||||||
dom.insertBefore(newdom)
|
@dom.insertBefore(newdom, null)
|
||||||
dom_ = @test_user.val(true)
|
@check()
|
||||||
|
|
||||||
|
it "supports dom.appendChild", ->
|
||||||
|
newdom = $("<p>dtrn</p>")[0]
|
||||||
|
@dom.appendChild(newdom)
|
||||||
|
@check()
|
||||||
|
|
||||||
|
it "supports dom.removeAttribute", ->
|
||||||
|
@dom.removeAttribute("test_attribute")
|
||||||
|
@check()
|
||||||
|
|
||||||
|
it "supports dom.removeAttribute", ->
|
||||||
|
@dom.removeChild($("#removeme")[0])
|
||||||
|
expect($("#removeme").length).to.equal(0)
|
||||||
|
@check()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user