--- /dev/null
+define([
+
+], function() {
+
+'use strict';
+
+
+var ChangeEvent = function(type, meta) {
+ this.type = type;
+ this.meta = meta;
+};
+
+
+return {
+ ChangeEvent: ChangeEvent
+};
+
+});
\ No newline at end of file
define([
- 'libs/jquery'
-], function($) {
+ 'libs/jquery',
+ 'libs/backbone',
+ 'smartxml/events'
+], function($, Backbone, events) {
'use strict';
}
node.append(this);
},
+
+ triggerChangeEvent: function(type, metaData) {
+ var event = new events.ChangeEvent(type, $.extend({node: this}, metaData || {}));
+ this.document.trigger('change', event);
+ },
});
var ElementNode = function(nativeNode, document) {
},
setAttr: function(name, value) {
+ var oldVal = this.getAttr(name);
this._$.attr(name, value);
+ this.triggerChangeEvent('nodeAttrChange', {attr: name, oldVal: oldVal, newVal: value});
},
getAttrs: function() {
return $document[0];
}});
};
-$.extend(Document.prototype, {
+$.extend(Document.prototype, Backbone.Events, {
ElementNodeFactory: ElementNode,
TextNodeFactory: TextNode,