Commits

Luke Plant  committed 3fecad8

Removed some unnecessary code.

updateCommandBlocks was very buggy, and doesn't seem to serve a useful
purpose, except in case that doesn't seem to be possible under normal usage
anymore i.e. a container without an id that has command blocks before it.

assignId is a single line without it, and so was inlined.

  • Participants
  • Parent commits 12f94da

Comments (0)

Files changed (1)

File semanticeditor/media/semanticeditor/javascript/wymeditor/plugins/semantic/wymeditor.semantic.js

 
     if (id == undefined || id == "") {
         id = this.nextId(node.tagName.toLowerCase());
-        this.assignId(node, id);
+        node.id = id;
         this.registerSection(id);
     }
     return id;
 };
 
-PresentationControls.prototype.assignId = function(node, id) {
-    // Assign an ID to an element.  This can be tricky, because, if the section
-    // has a command block before it, we need to make sure that the id of those
-    // blocks are changed, since the 'position' of the command blocks are only stored
-    // by giving them the right id.
-    node.id = id;
-    // Need to change (up to) the two previous siblings.
-    this.updateCommandBlocks(node, id, 2);
-};
-
 PresentationControls.prototype.nextId = function(tagName) {
     // All sections that can receive styles need a section ID.
     // For the initial HTML, this is assigned server-side when the
             node.className.match(/\bsecommand\b/));
 };
 
-PresentationControls.prototype.updateCommandBlocks = function(node, id, max) {
-    // Updates the 'id' of any HTML block that represents a command.
-    if (max == 0) {
-        return;
-    };
-    var prev = node.previousSibling;
-    if (this.isCommandBlock(prev)) {
-        var prevId = prev.id;
-        // Update id
-        prev.id = prev.className + "_" + id;
-        // need to update presentationInfo as well
-        this.presentationInfo[prev.id] = this.presentationInfo[prevId];
-        delete this.presentationInfo[prevId];
-        // and then the visible indicators
-        this.updateStyleDisplay(prev.id);
-        // do the next one.
-        this.updateCommandBlocks(prev, id, max - 1);
-    }
-};
-
 // ---- Display of style information on document.
 
 PresentationControls.prototype.updateStyleDisplay = function(sectId) {