wlxml: Use smartxml hook for XML normalization
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 11 Dec 2013 12:15:44 +0000 (13:15 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Sun, 15 Dec 2013 21:32:50 +0000 (22:32 +0100)
src/wlxml/wlxml.js

index b3783af..a320da3 100644 (file)
@@ -161,7 +161,11 @@ $.extend(WLXMLDocument.prototype, {
     ElementNodeFactory: WLXMLElementNode,
     loadXML: function(xml) {
         smartxml.Document.prototype.loadXML.call(this, xml, {silent: true});
-        $(this.dom).find(':not(iframe)').addBack().contents()
+        this.trigger('contentSet');
+    },
+
+    normalizeXML: function(nativeNode) {
+        $(nativeNode).find(':not(iframe)').addBack().contents()
             .filter(function() {return this.nodeType === Node.TEXT_NODE;})
             .each(function() {
                 var el = $(this),
@@ -243,7 +247,6 @@ $.extend(WLXMLDocument.prototype, {
                 /* globals document */
                 el.replaceWith(document.createTextNode(text.transformed));
             });
-        this.trigger('contentSet');
     },
 
     registerClassTransformation: function(Transformation, className) {