Skip to content

Commit

Permalink
jshinted and identified unused/dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
tiff committed Oct 10, 2012
1 parent 73b6682 commit 826ad5f
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 46 deletions.
21 changes: 0 additions & 21 deletions src/assert/html_equal.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,6 @@ wysihtml5.assert.htmlEqual = (function() {
return div.innerHTML.toLowerCase() != "<a><p></p></a>";
})();

/**
* When setting attributes via DOM API (setAttribute, etc.)
* Firefox reorders them randomly when read via innerHTML, which makes comparing such strings
* with expected strings a pain in the arse
* Issue: https://bugzilla.mozilla.org/show_bug.cgi?id=238686
*/
var REORDERS_ATTRIBUTES = (function() {
var img = document.createElement("img"),
parsedActualHtml,
parsedExpectedHtml;
img.setAttribute("alt", "foo");
img.setAttribute("border", "1");
img.setAttribute("src", "foo.gif");
htmlHost.innerHTML = "";
htmlHost.appendChild(img);
parsedActualHtml = htmlHost.innerHTML;
htmlHost.innerHTML = '<img alt="foo" border="1" src="foo.gif">';
parsedExpectedHtml = htmlHost.innerHTML;
return parsedExpectedHtml != parsedActualHtml;
})();

/**
* Browsers don't preserve original attribute order
* In order to be able to compare html we simply split both, the expected and actual html at spaces and element-ends,
Expand Down
1 change: 0 additions & 1 deletion src/dom/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ wysihtml5.dom.parse = (function() {
function _handleElement(oldNode) {
var rule,
newNode,
endTag,
tagRules = currentRules.tags,
nodeName = oldNode.nodeName.toLowerCase(),
scopeName = oldNode.scopeName;
Expand Down
2 changes: 1 addition & 1 deletion src/dom/set_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
element.setAttribute(mapping[i] || i, attributes[i]);
}
}
}
};
};
})();
2 changes: 1 addition & 1 deletion src/lang/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
by: function(replace) {
return str.split(search).join(replace);
}
}
};
}
};
};
Expand Down
2 changes: 1 addition & 1 deletion src/quirks/ensure_proper_clearing.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* wysihtml5.quirks.ensureProperClearing(myContentEditableElement);
*/
wysihtml5.quirks.ensureProperClearing = (function() {
var clearIfNecessary = function(event) {
var clearIfNecessary = function() {
var element = this;
setTimeout(function() {
var innerHTML = element.innerHTML.toLowerCase();
Expand Down
1 change: 0 additions & 1 deletion src/selection/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@
_selectLine_MSIE: function() {
var range = this.doc.selection.createRange(),
rangeTop = range.boundingTop,
rangeHeight = range.boundingHeight,
scrollWidth = this.doc.body.scrollWidth,
rangeBottom,
rangeEnd,
Expand Down
2 changes: 1 addition & 1 deletion src/toolbar/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
event.stopPropagation();
};

dom.observe(that.link, "click", function(event) {
dom.observe(that.link, "click", function() {
if (dom.hasClass(that.link, CLASS_NAME_OPENED)) {
setTimeout(function() { that.hide(); }, 0);
}
Expand Down
17 changes: 7 additions & 10 deletions src/toolbar/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,12 @@

execAction: function(action) {
var editor = this.editor;
switch(action) {
case "change_view":
if (editor.currentView === editor.textarea) {
editor.fire("change_view", "composer");
} else {
editor.fire("change_view", "textarea");
}
break;
if (action === "change_view") {
if (editor.currentView === editor.textarea) {
editor.fire("change_view", "composer");
} else {
editor.fire("change_view", "textarea");
}
}
},

Expand Down Expand Up @@ -207,8 +205,7 @@
},

_updateLinkStates: function() {
var element = this.composer.element,
commandMapping = this.commandMapping,
var commandMapping = this.commandMapping,
actionMapping = this.actionMapping,
i,
state,
Expand Down
1 change: 0 additions & 1 deletion src/views/composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@
setTimeout(function() {
// Unwrap paragraph after leaving a list or a H1-6
var selectedNode = that.selection.getSelectedNode(),
isHeadline,
list;

if (blockElement.nodeName === "LI") {
Expand Down
2 changes: 1 addition & 1 deletion src/views/composer.observe.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
that.parent.fire("unset_placeholder");
});

dom.observe(element, pasteEvents, function(event) {
dom.observe(element, pasteEvents, function() {
setTimeout(function() {
that.parent.fire("paste").fire("paste:composer");
}, 0);
Expand Down
7 changes: 0 additions & 7 deletions src/views/composer.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@
"-webkit-border-top-left-radius", "-moz-border-radius-topleft", "border-top-left-radius",
"width", "height"
],
/**
* Styles to sync while the window gets resized
*/
RESIZE_STYLE = [
"width", "height",
"top", "left", "right", "bottom"
],
ADDITIONAL_CSS_RULES = [
"html { height: 100%; }",
"body { height: 100%; padding: 1px 0 0 0; margin: -1px 0 0 0; }",
Expand Down

0 comments on commit 826ad5f

Please sign in to comment.