Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: Source/WebCore/inspector/front-end/TextPrompt.js

Issue 10408041: Merge 116305 - Web Inspector: [TextPrompt] Event listeners and CSS style are not removed on detachm… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 this._element = element; 105 this._element = element;
106 106
107 this._boundOnKeyDown = this.onKeyDown.bind(this); 107 this._boundOnKeyDown = this.onKeyDown.bind(this);
108 this._boundSelectStart = this._selectStart.bind(this); 108 this._boundSelectStart = this._selectStart.bind(this);
109 this._proxyElement = element.ownerDocument.createElement("span"); 109 this._proxyElement = element.ownerDocument.createElement("span");
110 this._proxyElement.style.display = this._proxyElementDisplay; 110 this._proxyElement.style.display = this._proxyElementDisplay;
111 element.parentElement.insertBefore(this.proxyElement, element); 111 element.parentElement.insertBefore(this.proxyElement, element);
112 this.proxyElement.appendChild(element); 112 this.proxyElement.appendChild(element);
113 this._element.addStyleClass("text-prompt"); 113 this._element.addStyleClass("text-prompt");
114 this._element.addEventListener("keydown", this._boundOnKeyDown, false); 114 this._element.addEventListener("keydown", this._boundOnKeyDown, false);
115 this._element.addEventListener("selectstart", this._selectStart.bind(thi s), false); 115 this._element.addEventListener("selectstart", this._boundSelectStart, fa lse);
116 116
117 if (typeof this._suggestBoxClassName === "string") 117 if (typeof this._suggestBoxClassName === "string")
118 this._suggestBox = new WebInspector.TextPrompt.SuggestBox(this, this ._element, this._suggestBoxClassName); 118 this._suggestBox = new WebInspector.TextPrompt.SuggestBox(this, this ._element, this._suggestBoxClassName);
119 119
120 return this.proxyElement; 120 return this.proxyElement;
121 }, 121 },
122 122
123 detach: function() 123 detach: function()
124 { 124 {
125 this._removeFromElement(); 125 this._removeFromElement();
126 this.proxyElement.parentElement.insertBefore(this._element, this.proxyEl ement); 126 this.proxyElement.parentElement.insertBefore(this._element, this.proxyEl ement);
127 this.proxyElement.parentElement.removeChild(this.proxyElement); 127 this.proxyElement.parentElement.removeChild(this.proxyElement);
128 this._element.removeStyleClass("text-prompt");
129 this._element.removeEventListener("keydown", this._boundOnKeyDown, false );
130 this._element.removeEventListener("selectstart", this._boundSelectStart, false);
128 delete this._proxyElement; 131 delete this._proxyElement;
129 WebInspector.restoreFocusFromElement(this._element); 132 WebInspector.restoreFocusFromElement(this._element);
130 }, 133 },
131 134
132 get text() 135 get text()
133 { 136 {
134 return this._element.textContent; 137 return this._element.textContent;
135 }, 138 },
136 139
137 set text(x) 140 set text(x)
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 // Report the event as non-handled if there is no selected item, 1260 // Report the event as non-handled if there is no selected item,
1258 // to commit the input or handle it otherwise. 1261 // to commit the input or handle it otherwise.
1259 return hasSelectedItem; 1262 return hasSelectedItem;
1260 }, 1263 },
1261 1264
1262 tabKeyPressed: function(event) 1265 tabKeyPressed: function(event)
1263 { 1266 {
1264 return this.enterKeyPressed(event); 1267 return this.enterKeyPressed(event);
1265 } 1268 }
1266 } 1269 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698