Skip to content

Commit

Permalink
Fix up the rest of console $ change
Browse files Browse the repository at this point in the history
  • Loading branch information
steve authored and sroussey committed Oct 2, 2012
1 parent 354a0bf commit d8eca50
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
30 changes: 17 additions & 13 deletions extension/content/firebug/console/commandLine.js
Expand Up @@ -1052,20 +1052,23 @@ function FirebugCommandLineAPI(context)
this.$ = function(selector, start) // returns unwrapped elements from the page this.$ = function(selector, start) // returns unwrapped elements from the page
{ {
var result; var result;
if (start && start.querySelector && (start.nodeType == Node.ELEMENT_NODE || start.nodeType == Node.DOCUMENT_NODE || start.nodeType == Node.DOCUMENT_FRAGMENT_NODE)) if (start && start.querySelector && (
result = start.querySelector(selector); start.nodeType == Node.ELEMENT_NODE ||
else start.nodeType == Node.DOCUMENT_NODE ||
start.nodeType == Node.DOCUMENT_FRAGMENT_NODE)) {
return start.querySelector(selector);
}

result = Wrapper.unwrapObject(context.baseWindow.document).querySelector(selector);
if (result == null && (selector||"")[0] !== "#")
{ {
result = Wrapper.unwrapObject(context.baseWindow.document).querySelector(selector); result = Wrapper.unwrapObject(context.baseWindow.document).querySelector("#" + selector);
if (result == null && (selector||"")[0] !== "#") if (result != null)
{ {
result = Wrapper.unwrapObject(context.baseWindow.document).querySelector("#" + selector); // This should be removed in the next minor (non-bugfix) version
if (result != null) var msg = Locale.$STRF("warning.dollar_change", [selector]);
{ Firebug.Console.log(msg, context, "warn");
// This should be removed in the next minor (non-bugfix) version result = null;
Firebug.Console.log("The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $(\"#" + selector + "\")", context, "warn");
result = null;
}
} }
} }
return result; return result;
Expand All @@ -1074,8 +1077,9 @@ function FirebugCommandLineAPI(context)
this.$$ = function(selector, start) // returns unwrapped elements from the page this.$$ = function(selector, start) // returns unwrapped elements from the page
{ {
var result; var result;
if (start && start.querySelectorAll && (start.nodeType == Node.ELEMENT_NODE || start.nodeType == Node.DOCUMENT_NODE || start.nodeType == Node.DOCUMENT_FRAGMENT_NODE)) if (start && start.querySelectorAll && (start.nodeType == Node.ELEMENT_NODE || start.nodeType == Node.DOCUMENT_NODE || start.nodeType == Node.DOCUMENT_FRAGMENT_NODE)) {
result = start.querySelectorAll(selector); result = start.querySelectorAll(selector);
}
else else
result = Wrapper.unwrapObject(context.baseWindow.document).querySelectorAll(selector); result = Wrapper.unwrapObject(context.baseWindow.document).querySelectorAll(selector);
return Arr.cloneArray(result); return Arr.cloneArray(result);
Expand Down
1 change: 1 addition & 0 deletions extension/locale/en-US/firebug.properties
Expand Up @@ -1367,6 +1367,7 @@ confirmation.Edit_CSS_Source=Your existing CSS edits will be discarded.\nAre you
# Console messages # Console messages
warning.Console_must_be_enabled=Console must be enabled warning.Console_must_be_enabled=Console must be enabled
warning.Command_line_blocked?=Command line blocked? warning.Command_line_blocked?=Command line blocked?
warning.dollar_change=The console command line function $() has changed meaning from $=getElementById(id) to $=querySelector(selector). You might try $("#%S") instead.
message.Reload_to_activate_window_console=Reload to activate window console message.Reload_to_activate_window_console=Reload to activate window console


# LOCALIZATION NOTE (message.sourceNotAvailableFor, message.The_resource_from_this_URL_is_not_text): # LOCALIZATION NOTE (message.sourceNotAvailableFor, message.The_resource_from_this_URL_is_not_text):
Expand Down

0 comments on commit d8eca50

Please sign in to comment.