Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Replace DOM manipulation code with equvilent jQuery api calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
RaymondLim committed Jul 9, 2012
1 parent 8978529 commit 0159dc2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
11 changes: 5 additions & 6 deletions src/search/FindInFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,10 @@ define(function (require, exports, module) {
* Creates a dialog div floating on top of the current code mirror editor
*/
FindInFilesDialog.prototype._createDialogDiv = function (template) {
// FUTURE: consider using jQuery for all the DOM manipulation here
var wrap = $("#editor-holder")[0];
this.dialog = wrap.insertBefore(window.document.createElement("div"), wrap.firstChild);
this.dialog.className = "CodeMirror-dialog";
this.dialog.innerHTML = "<div>" + template + "</div>";
$("<div />").insertBefore($("#editor-holder > :first"));
this.dialog = $("#editor-holder > div:first")
.attr("class", "CodeMirror-dialog")
.html("<div>" + template + "</div>");
};

/**
Expand All @@ -84,7 +83,7 @@ define(function (require, exports, module) {
}

this.closed = true;
this.dialog.parentNode.removeChild(this.dialog);
this.dialog.remove();
EditorManager.focusEditor();
this.result.resolve(value);
};
Expand Down
12 changes: 5 additions & 7 deletions src/search/QuickOpen.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ define(function (require, exports, module) {
* Creates a dialog div floating on top of the current code mirror editor
*/
QuickNavigateDialog.prototype._createDialogDiv = function (template) {
var $wrap = $("#editor-holder")[0];
this.dialog = $wrap.insertBefore(window.document.createElement("div"), $wrap.firstChild);
this.dialog.className = "CodeMirror-dialog";
this.dialog.innerHTML = '<div align="right">' + template + '</div>';
$("<div />").insertBefore($("#editor-holder > :first"));
this.dialog = $("#editor-holder > div:first")
.attr("class", "CodeMirror-dialog")
.html("<div align='right'>" + template + "</div>");
};

function _filenameFromPath(path, includeExtension) {
Expand Down Expand Up @@ -354,9 +354,7 @@ define(function (require, exports, module) {

EditorManager.focusEditor();

// for some odd reason I need to remove the dialog like this through the parent
// If I do it more directly listeners are not removed by the smart auto complete plug-in
this.dialog.parentNode.removeChild(this.dialog);
this.dialog.remove();
$(".smart_autocomplete_container").remove();

$(window.document).off("mousedown", this.handleDocumentClick);
Expand Down

0 comments on commit 0159dc2

Please sign in to comment.