smartxml: refactoring - more consisten naming
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 25 Nov 2013 22:05:10 +0000 (23:05 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 25 Nov 2013 22:05:10 +0000 (23:05 +0100)
src/smartxml/smartxml.js
src/smartxml/smartxml.test.js

index 0b12620..a60ae9a 100644 (file)
@@ -474,17 +474,17 @@ $.extend(Document.prototype, Backbone.Events, {
     },
 
     wrapNodes: function(params) {
     },
 
     wrapNodes: function(params) {
-        if(!(params.element1.parent().sameNode(params.element2.parent()))) {
+        if(!(params.node1.parent().sameNode(params.node2.parent()))) {
             throw new Error('Wrapping non-sibling nodes not supported.');
         }
 
             throw new Error('Wrapping non-sibling nodes not supported.');
         }
 
-        var parent = params.element1.parent(),
+        var parent = params.node1.parent(),
             parentContents = parent.contents(),
             wrapper = this.createDocumentNode({
                 tagName: params._with.tagName,
                 attrs: params._with.attrs}),
             parentContents = parent.contents(),
             wrapper = this.createDocumentNode({
                 tagName: params._with.tagName,
                 attrs: params._with.attrs}),
-            idx1 = parent.indexOf(params.element1),
-            idx2 = parent.indexOf(params.element2);
+            idx1 = parent.indexOf(params.node1),
+            idx2 = parent.indexOf(params.node2);
 
         if(idx1 > idx2) {
             var tmp = idx1;
 
         if(idx1 > idx2) {
             var tmp = idx1;
index cf7ef2a..289b982 100644 (file)
@@ -438,8 +438,8 @@ describe('smartxml', function() {
                     lastDiv = section.contents()[section.contents().length -1];
 
                 var returned = section.document.wrapNodes({
                     lastDiv = section.contents()[section.contents().length -1];
 
                 var returned = section.document.wrapNodes({
-                        element1: aliceText,
-                        element2: lastDiv,
+                        node1: aliceText,
+                        node2: lastDiv,
                         _with: {tagName: 'header'}
                     });
 
                         _with: {tagName: 'header'}
                     });
 
@@ -462,8 +462,8 @@ describe('smartxml', function() {
                     div3 = section.contents()[2];
 
                 section.document.wrapNodes({
                     div3 = section.contents()[2];
 
                 section.document.wrapNodes({
-                        element1: div2,
-                        element2: div3,
+                        node1: div2,
+                        node2: div3,
                         _with: {tagName: 'header'}
                     });
 
                         _with: {tagName: 'header'}
                     });