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

Unified Diff: ui/webui/resources/js/util.js

Issue 1304883005: Make |context| passed to queryRequiredElement optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: whoops Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/file_manager/video_player/js/video_player.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/util.js
diff --git a/ui/webui/resources/js/util.js b/ui/webui/resources/js/util.js
index 63ca9bb1fb0d211d9125cc0cf1d00152a31efed2..3907c5215aa302660dd221706cfda9e6028ea6c0 100644
--- a/ui/webui/resources/js/util.js
+++ b/ui/webui/resources/js/util.js
@@ -274,13 +274,13 @@ function getRequiredElement(id) {
* Query an element that's known to exist by a selector. We use this instead of
* just calling querySelector and not checking the result because this lets us
* satisfy the JSCompiler type system.
- * @param {(!Document|!DocumentFragment|!Element)} context The context object
- * for querySelector.
* @param {string} selectors CSS selectors to query the element.
+ * @param {(!Document|!DocumentFragment|!Element)=} opt_context An optional
+ * context object for querySelector.
* @return {!HTMLElement} the Element.
*/
-function queryRequiredElement(context, selectors) {
- var element = context.querySelector(selectors);
+function queryRequiredElement(selectors, opt_context) {
+ var element = (opt_context || document).querySelector(selectors);
return assertInstanceof(element, HTMLElement,
'Missing required element: ' + selectors);
}
« no previous file with comments | « ui/file_manager/video_player/js/video_player.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698