Luke Plant avatar 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.

Comments (0)

Files changed (1)

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) {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.